R1#show ip interface briefInterface IP-Address OK? Method Status ProtocolEthernet0/0 192.168.1.254 YES manual up up Ethernet0/1 unassigned YES unset administratively down down Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down Serial1/0 192.168.12.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#show ip interface briefInterface IP-Address OK? Method Status ProtocolEthernet0/0 unassigned YES unset administratively down down Ethernet0/1 unassigned YES unset administratively down down Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down Serial1/0 192.168.12.2 YES manual up up Serial1/1 192.168.23.2 YES manual up up Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down
?
檢查R3:
?
?
?
?
?
?
?
?
?
?
R3#show ip interface briefInterface IP-Address OK? Method Status ProtocolEthernet0/0 192.168.2.254 YES manual up up Ethernet0/1 unassigned YES unset administratively down down Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down Serial1/0 192.168.23.3 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
PC1> ping 192.168.1.25484 bytes from 192.168.1.254 icmp_seq=1 ttl=255 time=0.359 ms84 bytes from 192.168.1.254 icmp_seq=2 ttl=255 time=0.459 ms84 bytes from 192.168.1.254 icmp_seq=3 ttl=255 time=0.463 ms84 bytes from 192.168.1.254 icmp_seq=4 ttl=255 time=0.403 ms84 bytes from 192.168.1.254 icmp_seq=5 ttl=255 time=0.417 ms
測試R1跟R2之間的網絡連通性:
?
?
?
?
?
R1#ping 192.168.12.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 8/9/10 ms
?
測試R2跟R3之間的網絡連通性:
?
?
?
?
?
R2#ping 192.168.23.3Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 9/9/11 ms
?
測試PC2跟網關的網絡連通性:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
PC2> ping 192.168.2.25484 bytes from 192.168.2.254 icmp_seq=1 ttl=255 time=0.469 ms84 bytes from 192.168.2.254 icmp_seq=2 ttl=255 time=0.484 ms84 bytes from 192.168.2.254 icmp_seq=3 ttl=255 time=0.518 ms84 bytes from 192.168.2.254 icmp_seq=4 ttl=255 time=0.400 ms84 bytes from 192.168.2.254 icmp_seq=5 ttl=255 time=0.405 ms注意,雖然設備之間的網絡連通性正常了,但是PC1和PC2之間的網絡是不可達的:PC1> ping 192.168.2.1*192.168.1.254 icmp_seq=1 ttl=255 time=0.345 ms (ICMP type:3, code:1, Destination host unreachable)*192.168.1.254 icmp_seq=2 ttl=255 time=0.462 ms (ICMP type:3, code:1, Destination host unreachable)*192.168.1.254 icmp_seq=3 ttl=255 time=0.543 ms (ICMP type:3, code:1, Destination host unreachable)*192.168.1.254 icmp_seq=4 ttl=255 time=0.494 ms (ICMP type:3, code:1, Destination host unreachable)*192.168.1.254 icmp_seq=5 ttl=255 time=0.467 ms (ICMP type:3, code:1, Destination host unreachable)因為PC1把數據包發送給R1后,R1沒有到達網絡192.168.2.0/24的路由,所以R1無法轉發數據包。
?
檢查R1的路由表:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
R1#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is not set 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.1.0/24 is directly connected, Ethernet0/0L 192.168.1.254/32 is directly connected, Ethernet0/0 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.12.0/24 is directly connected, Serial1/0L 192.168.12.1/32 is directly connected, Serial1/0R1只有兩條直連路由,分別是192.168.1.0/24和192.168.12.0/24。因此,我們需要在R1上配置去往192.168.2.0/24的靜態路由。
R3(config)#ip route 192.168.1.0 255.255.255.0 serial 1/0//當然也可以跟下一跳另外,沿途的路由器也要有去往源和目標網絡的路由。
?
配置R2:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.12.1//當然也可以跟出接口R2(config)#ip route 192.168.2.0 255.255.255.0 192.168.23.3//當然也可以跟出接口這樣當PC1把數據包發送給R1時,R1查路由表:R1#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is not set 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.1.0/24 is directly connected, Ethernet0/0L 192.168.1.254/32 is directly connected, Ethernet0/0S 192.168.2.0/24 [1/0] via 192.168.12.2 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.12.0/24 is directly connected, Serial1/0L 192.168.12.1/32 is directly connected, Serial1/0R1有到達網絡192.168.2.0/24的路由,所以R1把數據包發送給下一跳R2,R2檢查路由表:R2#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is not setS 192.168.1.0/24 [1/0] via 192.168.12.1S 192.168.2.0/24 [1/0] via 192.168.23.3 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.12.0/24 is directly connected, Serial1/0L 192.168.12.2/32 is directly connected, Serial1/0 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.23.0/24 is directly connected, Serial1/1L 192.168.23.2/32 is directly connected, Serial1/1R2有到達網絡192.168.2.0/24的路由,所以R2把數據包發送給下一跳R3,R3檢查路由表:R3#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is not setS 192.168.1.0/24 is directly connected, Serial1/0 192.168.2.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.2.0/24 is directly connected, Ethernet0/0L 192.168.2.254/32 is directly connected, Ethernet0/0 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.23.0/24 is directly connected, Serial1/0L 192.168.23.3/32 is directly connected, Serial1/0R3上192.168.2.0/24是自己的直連網絡,所以R3把數據包直接發給PC2?;爻虜祿霓D發原理一樣,這里不再撰述。
?
步驟5:測試PC1跟PC2的網絡連通性
?
?
?
?
?
?
?
?
?
?
PC1> ping 192.168.2.184 bytes from 192.168.2.1 icmp_seq=1 ttl=61 time=22.503 ms84 bytes from 192.168.2.1 icmp_seq=2 ttl=61 time=18.859 ms84 bytes from 192.168.2.1 icmp_seq=3 ttl=61 time=19.251 ms84 bytes from 192.168.2.1 icmp_seq=4 ttl=61 time=19.350 ms84 bytes from 192.168.2.1 icmp_seq=5 ttl=61 time=17.856 ms因為需求要求全網路由可達;如果這個時候在R1上Ping PC2,能不能通呢?不能!在R1上Ping PC2,數據包源地址是192.168.12.1,數據包能到達PC2,但是回不來,因為R3上沒有到達192.168.12.0/24的路由;同理,R3上Ping PC1也不通,因為R1沒有到達192.168.23.0/24的路由。
?
檢查R3的路由表:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
R3#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is not setS 192.168.1.0/24 is directly connected, Serial1/0 192.168.2.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.2.0/24 is directly connected, Ethernet0/0L 192.168.2.254/32 is directly connected, Ethernet0/0 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.23.0/24 is directly connected, Serial1/0L 192.168.23.3/32 is directly connected, Serial1/0R3沒有到達網絡192.168.12.0/24的路由。
R1(config)#ip route 192.168.23.0 255.255.255.0 serial 1/0//當然也可以跟下一跳
?
檢查R1的路由表:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
R1#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is not set 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.1.0/24 is directly connected, Ethernet0/0L 192.168.1.254/32 is directly connected, Ethernet0/0S 192.168.2.0/24 [1/0] via 192.168.12.2 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.12.0/24 is directly connected, Serial1/0L 192.168.12.1/32 is directly connected, Serial1/0S 192.168.23.0/24 is directly connected, Serial1/0R1有到達192.168.2.0/24和192.168.23.0/24的路由。
?
檢查R3的路由表:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
R3#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is not setS 192.168.1.0/24 is directly connected, Serial1/0 192.168.2.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.2.0/24 is directly connected, Ethernet0/0L 192.168.2.254/32 is directly connected, Ethernet0/0S 192.168.12.0/24 [1/0] via 192.168.23.2 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.23.0/24 is directly connected, Serial1/0L 192.168.23.3/32 is directly connected, Serial1/0R3有到達192.168.1.0/24和192.168.12.0/24的路由。
?
步驟6:測試網絡連通性
在PC1上測試:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
PC1> ping 192.168.2.184 bytes from 192.168.2.1 icmp_seq=1 ttl=61 time=21.429 ms84 bytes from 192.168.2.1 icmp_seq=2 ttl=61 time=18.079 ms84 bytes from 192.168.2.1 icmp_seq=3 ttl=61 time=19.108 ms84 bytes from 192.168.2.1 icmp_seq=4 ttl=61 time=19.006 ms84 bytes from 192.168.2.1 icmp_seq=5 ttl=61 time=18.163 msPC1> ping 192.168.23.384 bytes from 192.168.23.3 icmp_seq=1 ttl=253 time=18.265 ms84 bytes from 192.168.23.3 icmp_seq=2 ttl=253 time=18.186 ms84 bytes from 192.168.23.3 icmp_seq=3 ttl=253 time=18.184 ms84 bytes from 192.168.23.3 icmp_seq=4 ttl=253 time=18.257 ms84 bytes from 192.168.23.3 icmp_seq=5 ttl=253 time=18.240 msPC1> ping 192.168.12.284 bytes from 192.168.12.2 icmp_seq=1 ttl=254 time=9.899 ms84 bytes from 192.168.12.2 icmp_seq=2 ttl=254 time=9.380 ms84 bytes from 192.168.12.2 icmp_seq=3 ttl=254 time=9.159 ms84 bytes from 192.168.12.2 icmp_seq=4 ttl=254 time=9.300 ms84 bytes from 192.168.12.2 icmp_seq=5 ttl=254 time=9.268 ms
任務2:實驗拓撲?
?
任務2:實驗需求
1.?在R1和R3上刪除任務1的靜態路由;
2.?在路由器R1、R3上配置默認路由,使得全網路由可達。
?
任務2:實驗步驟
步驟1:刪除R1和R3上的靜態路由并配置默認路由
配置R1:
?
?
?
R1(config)#no ip route 192.168.2.0 255.255.255.0 192.168.12.2R1(config)#no ip route 192.168.23.0 255.255.255.0 Serial1/0R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.12.2
?
配置R3:
?
?
?
R3(config)#no ip route 192.168.1.0 255.255.255.0 Serial1/0R3(config)#no ip route 192.168.12.0 255.255.255.0 192.168.23.2R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.23.2
?
步驟2:檢查默認路由
檢查R1:
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
R1#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is 192.168.12.2 to network 0.0.0.0S* 0.0.0.0/0 [1/0] via 192.168.12.2 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.1.0/24 is directly connected, Ethernet0/0L 192.168.1.254/32 is directly connected, Ethernet0/0 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.12.0/24 is directly connected, Serial1/0L 192.168.12.1/32 is directly connected, Serial1/0檢查R3:R3#show ip routeCodes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfRGateway of last resort is 192.168.23.2 to network 0.0.0.0S* 0.0.0.0/0 [1/0] via 192.168.23.2 192.168.2.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.2.0/24 is directly connected, Ethernet0/0L 192.168.2.254/32 is directly connected, Ethernet0/0 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.23.0/24 is directly connected, Serial1/0L 192.168.23.3/32 is directly connected, Serial1/0
?
步驟3:網絡連通性測試
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
PC1> ping 192.168.2.184 bytes from 192.168.2.1 icmp_seq=1 ttl=61 time=20.698 ms84 bytes from 192.168.2.1 icmp_seq=2 ttl=61 time=19.478 ms84 bytes from 192.168.2.1 icmp_seq=3 ttl=61 time=18.593 ms84 bytes from 192.168.2.1 icmp_seq=4 ttl=61 time=19.404 ms84 bytes from 192.168.2.1 icmp_seq=5 ttl=61 time=19.616 msPC1> ping 192.168.23.384 bytes from 192.168.23.3 icmp_seq=1 ttl=253 time=22.048 ms84 bytes from 192.168.23.3 icmp_seq=2 ttl=253 time=20.271 ms84 bytes from 192.168.23.3 icmp_seq=3 ttl=253 time=19.362 ms84 bytes from 192.168.23.3 icmp_seq=4 ttl=253 time=20.110 ms84 bytes from 192.168.23.3 icmp_seq=5 ttl=253 time=21.321 msPC1> ping 192.168.12.284 bytes from 192.168.12.2 icmp_seq=1 ttl=254 time=10.201 ms84 bytes from 192.168.12.2 icmp_seq=2 ttl=254 time=10.220 ms84 bytes from 192.168.12.2 icmp_seq=3 ttl=254 time=8.304 ms84 bytes from 192.168.12.2 icmp_seq=4 ttl=254 time=9.170 ms84 bytes from 192.168.12.2 icmp_seq=5 ttl=254 time=10.084 ms