在所有的路由器上添加靜態路由。
能夠在小型的網絡環境中配置路由表。
能夠使用ping測試靜態路由配置
使用Tracert跟蹤數據包
排除網絡故障
刪除在Router3上刪除到172.16.0.0/24網段的路由信息
PKA文件下載地址:https://zhifubao.lanzous.com/iRFs5dibjja
2 網絡拓撲
3 基本配置步驟
試驗環境應經將路由器的所有接口和計算機的Ip地址已經按着網絡拓撲配置。
只需在路由器上添加靜態路由表即可。
3.1 在Router2上
1 Router#show ip route 查看現有的路由表,發現只有直連的網段的路由信息 2 Router#config t 3 Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.3.2 4 Router(config)#ip route 172.16.4.0 255.255.255.0 172.16.3.2 5 Router(config)#ip route 172.16.5.0 255.255.255.0 172.16.3.2 6 Router(config)#ip route 172.16.2.0 255.255.255.0 172.16.3.2 7 Router#show ip route 8 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 9 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 10 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 11 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 12 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 13 * - candidate default, U - per-user static route, o - ODR 14 P - periodic downloaded static route 15 Gateway of last resort is not set 16 172.16.0.0/24 is subnetted, 6 subnets 17 C 172.16.0.0 is directly connected, FastEthernet0/0 C 直連的網絡 18 S 172.16.1.0 [1/0] via 172.16.3.2 S 添加的靜態路由 19 S 172.16.2.0 [1/0] via 172.16.3.2 20 C 172.16.3.0 is directly connected, Serial2/0 21 S 172.16.4.0 [1/0] via 172.16.3.2 22 S 172.16.5.0 [1/0] via 172.16.3.2 23 Router#copy running-config startup-config 24 Destination filename [startup-config]? 25 Building configuration... 26 [OK]
3.2 在Router3上添加靜態路由
1 Router#config t 2 Router(config)#ip route 172.16.0.0 255.255.255.0 172.16.4.2 3 Router(config)#ip route 172.16.3.0 255.255.255.0 172.16.4.2 4 Router(config)#ip route 172.16.2.0 255.255.255.0 172.16.4.2 5 Router(config)#ip route 172.16.5.0 255.255.255.0 172.16.4.2 6 Router(config)#exit 7 %SYS-5-CONFIG_I: Configured from console by console 8 Router#show ip rout 顯示路由表 9 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 10 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 11 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 12 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 13 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 14 * - candidate default, U - per-user static route, o - ODR 15 P - periodic downloaded static route 16 Gateway of last resort is not set 17 172.16.0.0/24 is subnetted, 6 subnets 18 S 172.16.0.0 [1/0] via 172.16.4.2 19 C 172.16.1.0 is directly connected, FastEthernet0/0 20 S 172.16.2.0 [1/0] via 172.16.4.2 21 S 172.16.3.0 [1/0] via 172.16.4.2 22 C 172.16.4.0 is directly connected, Serial2/0 23 S 172.16.5.0 [1/0] via 172.16.4.2 24 Router#copy running-config startup-config 25 Destination filename [startup-config]? 26 Building configuration...
3.3 在Router0上添加靜態路由
1 Router#config t 2 Enter configuration commands, one per line. End with CNTL/Z. 3 Router(config)#ip route 172.16.0.0 255.255.255.0 172.16.3.1 4 Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.4.1 5 Router(config)#ip route 172.16.2.0 255.255.255.0 172.16.5.2 6 Router(config)# 7 Router#copy running-config startup-config 8 Destination filename [startup-config]? 9 Building configuration... 10 [OK]
3.4 在Router1上添加靜態路由
1 Router#configure 2 Configuring from terminal, memory, or network [terminal]? 3 Enter configuration commands, one per line. End with CNTL/Z. 4 Router(config)#ip route 172.16.0.0 255.255.255.0 172.16.5.1 5 Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.5.1 6 Router(config)#ip route 172.16.3.0 255.255.255.0 172.16.5.1 7 Router(config)#ip route 172.16.4.0 255.255.255.0 172.16.5.1 8 Router#copy running-config startup-config 9 Destination filename [startup-config]? 10 Building configuration... 11 [OK]
4 測試靜態路由
4.1 在PC1上測試到PC0的連接
1 PC>ping 172.16.1.1 靜態路由配置正確 2 Pinging 172.16.1.1 with 32 bytes of data: 3 Reply from 172.16.1.1: bytes=32 time=27ms TTL=253 4 Reply from 172.16.1.1: bytes=32 time=14ms TTL=253 5 Reply from 172.16.1.1: bytes=32 time=20ms TTL=253 6 Reply from 172.16.1.1: bytes=32 time=16ms TTL=253 7 PC>tracert 172.16.1.2 使用Tracert跟蹤數據包 8 Tracing route to 172.16.1.2 over a maximum of 30 hops: 9 1 9 ms 6 ms 8 ms 172.16.0.1 10 2 13 ms 10 ms 10 ms 172.16.3.2 11 3 17 ms 16 ms 16 ms 172.16.4.1 12 4 23 ms 24 ms 25 ms 172.16.1.2 13 Trace complete.
4.2 在PC1上測試到PC2的連接
1 PC>ping 172.16.2.1 靜態路由配置正確 2 Pinging 172.16.2.1 with 32 bytes of data: 3 Reply from 172.16.2.1: bytes=32 time=15ms TTL=253 4 Reply from 172.16.2.1: bytes=32 time=13ms TTL=253 5 Reply from 172.16.2.1: bytes=32 time=16ms TTL=253 6 Reply from 172.16.2.1: bytes=32 time=19ms TTL=253
4.3 在Router3上刪除到172.16.0.0/24網段的路由
1 Router(config)#no ip route 172.16.0.0 255.255.255.0 2 Router#show ip route 3 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 4 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 5 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 6 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 7 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 8 * - candidate default, U - per-user static route, o - ODR 9 P - periodic downloaded static route 10 Gateway of last resort is not set 11 172.16.0.0/24 is subnetted, 5 subnets 12 C 172.16.1.0 is directly connected, FastEthernet0/0 13 S 172.16.2.0 [1/0] via 172.16.4.2 14 S 172.16.3.0 [1/0] via 172.16.4.2 15 C 172.16.4.0 is directly connected, Serial2/0 16 S 172.16.5.0 [1/0] via 172.16.4.2 沒有到172.16.0.0/24網段的路由信息
4.4 在PC1上測試到PC0的連接 發現數據包不能返回
1 PC>ping 172.16.1.1 2 3 Pinging 172.16.1.1 with 32 bytes of data: 4 5 Request timed out. 6 7 Request timed out. 8 9 Request timed out. 10 11 Request timed out. 12 13 PC>tracert 172.16.1.2 使用tracert跟蹤數據包路徑 14 15 Tracing route to 172.16.1.2 over a maximum of 30 hops: 16 17 1 9 ms 7 ms 8 ms 172.16.0.1 18 19 2 12 ms 14 ms 14 ms 172.16.3.2 20 21 3 * * * Request timed out. 22 23 4 * * * Request timed out. 24 25 5 * * * Request timed out.
4.5 在PC0上測試到PC1的連接
1 PC>ping 172.16.0.2 2 3 Pinging 172.16.0.2 with 32 bytes of data: 4 5 Reply from 172.16.1.1: Destination host unreachable. 提示目標主機不可到達 6 7 Reply from 172.16.1.1: Destination host unreachable. 8 9 Reply from 172.16.1.1: Destination host unreachable. 10 11 Reply from 172.16.1.1: Destination host unreachable.