CCNP Day1 静态路由
1、路由复习

2、R1配置
R1>enable R1#config t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#interface f0/0 R1(config-if)#ip add R1(config-if)#ip address 172.168.12.1 255.255.255.0 R1(config-if)#no shu R1#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 172.168.12.1 YES manual up up Serial1/0 unassigned YES unset administratively down down Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down R1#ping 172.168.12.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.168.12.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms R1#ping 172.168.12.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.168.12.2, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 24/29/32 ms R1# R1#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 172.168.0.0/24 is subnetted, 1 subnets C 172.168.12.0 is directly connected, FastEthernet0/0 /***直链路由***/ R1#
3、R2配置
R2> R2>enable R2#config t Enter configuration commands, one per line. End with CNTL/Z. R2(config)#int R2(config)#interface f0/0 R2(config-if)#ip address 172.168.12.2 255.255.255.0 R2(config-if)#exit R2(config)#int R2(config)#interface S1/0 R2(config-if)#ip add R2(config-if)#ip address 192.168.23.1 255.255.255.0 R2(config-if)#no shutdown R2(config-if)# *Nov 22 14:34:15.719: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up *Nov 22 14:34:16.719: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up R2(config-if)# *Nov 22 14:34:40.211: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down R2(config-if)# *Nov 22 14:35:00.199: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up R2(config-if)# R2(config-if)# R2(config-if)#end R2#show int R2#show interfaces *Nov 22 14:42:44.931: %SYS-5-CONFIG_I: Configured from console by console R2#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 172.168.12.2 YES manual administratively down down Serial1/0 192.168.23.1 YES manual up up Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down R2# R2# R2# R2#config t Enter configuration commands, one per line. End with CNTL/Z. R2(config)#int R2(config)#interface f0/0 R2(config-if)#shutdown R2(config-if)#no shu R2(config-if)#no shutdown R2(config-if)#end *Nov 22 14:43:41.163: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up *Nov 22 14:43:42.163: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up R2(config-if)#end R2#show ip *Nov 22 14:43:43.047: %SYS-5-CONFIG_I: Configured from console by console R2#show ip int R2#show ip interface br R2#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 172.168.12.2 YES manual up up Serial1/0 192.168.23.1 YES manual up up Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down R2#ping 172.168.12.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.168.12.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 24/29/32 ms R2#ping 172.168.12.1192.168.23.2 % Unrecognized host or address, or protocol not running. R2#ping 192.168.23.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.23.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/32/36 ms R2# R2# R2#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 172.168.0.0/24 is subnetted, 1 subnets C 172.168.12.0 is directly connected, FastEthernet0/0 C 192.168.23.0/24 is directly connected, Serial1/0 R2#
4、R3配置
R3> R3>enable R3#config t Enter configuration commands, one per line. End with CNTL/Z. R3(config)#int R3(config)#interface S1/0 R3(config-if)#ip add R3(config-if)#ip address 192.168.23.2 255.255.255.0 R3(config-if)#no shu R3(config-if)#no shutdown R3(config-if)# R3(config-if)# R3(config-if)# R3(config-if)#exit R3(config)# *Nov 22 14:34:48.759: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up *Nov 22 14:34:49.759: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up R3(config)#int R3(config)#interface l R3(config)#interface loopback 0 R3(config-if)#ip add R3(config-if)#ip address 3.3.3.3 255.255.255.0 R3(config-if)#no shu R3(config-if)#no shutdown R3(config-if)# R3(config-if)# R3(config-if)# R3(config-if)#ping 3.3.3.3 ^ % Invalid input detected at '^' marker. R3(config-if)#end R3#ping *Nov 22 14:44:49.223: %SYS-5-CONFIG_I: Configured from console by console R3#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms R3#show ip int R3#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial1/0 192.168.23.2 YES manual up up Serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down Loopback0 3.3.3.3 YES manual up up R3#ping 192.168.23.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.23.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 24/30/36 ms R3#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 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0 C 192.168.23.0/24 is directly connected, Serial1/0 R3#
5、发现问题,R1到R3的Loopback 0 不通,添加一条静态路由
R1#ping 192.168.23.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.23.1, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) R1#
6、发现问题,R1到R3的Loopback 0 不通
R1(config)#ip route 3.3.3.0 255.255.255.0 172.168.12.2 R1#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 3.0.0.0/24 is subnetted, 1 subnets S 3.3.3.0 [1/0] via 172.168.12.2 172.168.0.0/24 is subnetted, 1 subnets C 172.168.12.0 is directly connected, FastEthernet0/0 R1#
R1(config)#ip route 192.168.23.0 255.255.255.0 172.168.12.2
R1(config)#exit
R1#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
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 172.168.12.2
172.168.0.0/24 is subnetted, 1 subnets
C 172.168.12.0 is directly connected, FastEthernet0/0
S 192.168.23.0/24 [1/0] via 172.168.12.2
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/65/76 ms
R1#
R2(config)#ip route 3.3.3.0 255.255.255.0 192.168.23.2
R2#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
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 192.168.23.2
172.168.0.0/24 is subnetted, 1 subnets
C 172.168.12.0 is directly connected, FastEthernet0/0
C 192.168.23.0/24 is directly connected, Serial1/0
R2#
添加回包路由
R3#config t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#ip route 172.168.12.0 255.255.255.0 s1/0
R3(config)#end
R3#show ip
*Nov 22 15:13:38.443: %SYS-5-CONFIG_I: Configured from console by console
R3#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
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
172.168.0.0/24 is subnetted, 1 subnets
S 172.168.12.0 is directly connected, Serial1/0
C 192.168.23.0/24 is directly connected, Serial1/0
R3#
实验结论:配置静态路由,优先选择下一跳IP地址;其次选择出接口,如果选择出接口时,要确保对端代理ARP功能开启;
在一个网络总,除了自己直链路由外,需要拥有所有非直链路由条目,才能实现全网互通。
浙公网安备 33010602011771号