Static routing and experimental configuration

Static routes refer to routing information manually configured by users or network administrators. When the network topology or link status changes, the network administrator needs to manually modify the relevant static routing information in the routing table. Static routing information is private by default and will not be passed to other routers. Generally speaking, static routes are used in networks with small network scale and relatively fixed topology.

Features of static routing:

  1. Allows precise control over the behavior of routes. Because static routes are manually configured, administrators can control the flow of packets in the network through static routes.
  2. Static routes are unidirectional. That is to say, if two-way communication is desired, two-way static routes must be configured on both sides of the communication.
  3. The downside of static routing is the lack of flexibility. Although static routing can precisely control the packet's path through the router, it also limits its flexibility.

lab environment

GNS 3 emulator

Experimental topology

Static routing and experimental configuration

Configuration command:

router R1

R1>en
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#ip add 192.168.2.1 255.255.255.0                #配置接口IP地址
R1(config-if)#no shut                    #开启接口
R1(config-if)#ex
*Mar  1 00:06:18.167: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:06:19.167: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config)#int f0/1
R1(config-if)#ip add 192.168.1.1 255.255.255.0                #配置接口IP地址
R1(config-if)#no shut                    #开启接口
R1(config-if)#ex
*Mar  1 00:06:36.879: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:06:37.879: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2     #添加路由
R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.2.2     #添加路由
R1(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

S    192.168.4.0/24 [1/0] via 192.168.2.2
C    192.168.1.0/24 is directly connected, FastEthernet0/1
C    192.168.2.0/24 is directly connected, FastEthernet0/0
S    192.168.3.0/24 [1/0] via 192.168.2.2
R1(config)#

router R2

R2>en
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#ip add 192.168.2.2 255.255.255.0                #配置接口IP地址
R2(config-if)#no shut                      #开启接口
R2(config-if)#ex
R2(config)#int f0/
*Mar  1 00:08:49.555: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:08:50.555: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config)#int f0/1
R2(config-if)#ip add 192.168.3.1 255.255.255.0                #配置接口IP地址
R2(config-if)#no shut                    #开启接口
R2(config-if)#ex
R2(config)#ip route
*Mar  1 00:09:09.459: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:09:10.459: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1     #添加路由
R2(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2     #添加路由
R2(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

S    192.168.4.0/24 [1/0] via 192.168.3.2
S    192.168.1.0/24 [1/0] via 192.168.2.1
C    192.168.2.0/24 is directly connected, FastEthernet0/0
C    192.168.3.0/24 is directly connected, FastEthernet0/1
R2(config)#

router R3

R3>en
R3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#int f0/0
R3(config-if)#ip add 192.168.3.2 255.255.255.0                #配置接口IP地址
R3(config-if)#no shut                    #开启接口
R3(config-if)#ex
R3(config)#int f0
*Mar  1 00:06:18.167: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:06:19.167: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config)#int f0/1
R3(config-if)#ip add 192.168.4.1 255.255.255.0                #配置接口IP地址
R3(config-if)#no shut                    #开启接口
R3(config-if)#ex
R3(config)#ip
*Mar  1 00:06:36.879: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:06:37.879: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R3(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1     #添加路由
R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1     #添加路由
R3(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.4.0/24 is directly connected, FastEthernet0/1
S    192.168.1.0/24 [1/0] via 192.168.3.1
S    192.168.2.0/24 [1/0] via 192.168.3.1
C    192.168.3.0/24 is directly connected, FastEthernet0/0
R3(config)#

Experimental results

Static routing and experimental configuration

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325216762&siteId=291194637