《2022年永久存在路由表中的静态路由实用 .pdf》由会员分享,可在线阅读,更多相关《2022年永久存在路由表中的静态路由实用 .pdf(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、永久存在路由表中的静态路由R1R2S1/2:12.12.12.1/24S1/3:12.12.12.2/24Loopback0:1.1.1.1Loopback0:2.2.2.2环境如图:实验目的:使用permanent 参数,将静态路由永久的存放在路由表中。说明:配置IP 地址的动作必须在做路由之前。不然,路由是无法知道该从哪个借口将数据包丢出去。所谓永久路由:就是在静态路由被写进路由表后,不会被再次移除出路由表。基本设置R1 RouterenRouter#configure terminalRouter(config)# hostname r1r1(config)#interface seri
2、al 1/2r1(config-if)# ip address 12.12.12.1 255.255.255.0r1(config-if)# no shutdownr1(config-if)# exitr1(config)#interface loopback 0r1(config-if)# ip address 1.1.1.1 255.255.255.0r1(config-if)# no shutdownr1(config-if)# exitr1(config)#ip route 2.2.2.0 255.255.255.0 12.12.12.2r1(config)#exitR2 Router
3、enRouter#configure terminalRouter(config)# hostname r2r2(config)#interface serial 1/3r2(config-if)# ip address 12.12.12.2 255.255.255.0r2(config-if)# no shutdown名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 7 页 - - - - - - - - - r2(config-if)# exitr2(config)#i
4、nterface loopback 0r2(config-if)# ip address 2.2.2.2 255.255.255.0r2(config-if)# no shutdownr2(config-if)# exitr2(config)#ip route 1.1.1.0 255.255.255.0 12.12.12.1r2(config)#exit查看路由表R1 r1#show ip routeCodes: C - connected, S - static, R - RIP , M - mobile, B - BGP D - EIGRP , EX - EIGRP external, O
5、 - 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 -
6、 periodic downloaded static route Gateway of last resort is not set 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/24 is subnetted, 1 subnets S 2.2.2.0 1/0 via 12.12.12.2 12.0.0.0/24 is subnetted, 1 subnets C 12.12.12.0 is directly connected, Serial1/2 显然包含 2.2
7、.2.2 的路由条目2.0.0.0/24 is subnetted, 1 subnets S 2.2.2.0 1/0 via 12.12.12.2 在 R1的路由表里面R2 r2#show ip routeCodes: 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 - O
8、SPF external type 1, E2 - OSPF external type 2 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 7 页 - - - - - - - - - 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 -
9、 ODR, P - periodic downloaded static route Gateway of last resort is not set 1.0.0.0/24 is subnetted, 1 subnets S 1.1.1.0 1/0 via 12.12.12.1 2.0.0.0/24 is subnetted, 1 subnets C 2.2.2.0 is directly connected, Loopback0 12.0.0.0/24 is subnetted, 1 subnets C 12.12.12.0 is directly connected, Serial1/3
10、 包含 1.1.1.1 的路由条目1.0.0.0/24 is subnetted, 1 subnets S 1.1.1.0 1/0 via 12.12.12.1 在 R2的路由表里面Ping测试执行命令r1#ping 2.2.2.2可以连通Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: ! Success rate is 100 percent (5/5), round-trip min/avg/max = 48/116/256 ms 执行命令r1#p
11、ing 2.2.2.2 source 1.1.1.1可以连通Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 ! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/106/204 ms 由于两个路由器的路由表中的两条静态路由都正常工作。因此连通性良好。名师资料总结 - - -精品资料欢迎下载
12、 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 7 页 - - - - - - - - - 删除 R1的 S1/2 端口 IP 执行命令r1#configure terminalr1(config)#interface serial 1/2r1(config-if)# no ip address 12.12.12.1 255.255.255.0r1(config-if)# exitr1(config)#exit查看路由表R1 r1#show ip routeCodes: C - connected, S - s
13、tatic, 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 in
14、ter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 由于 R1的 S1/2 端口没有了IP。因此 R1路由表与12.12.12.0 从网段出去的相关路由2.0.0.0/24 is subnetted, 1 subnet
15、s S 2.2.2.0 1/0 via 12.12.12.2 12.0.0.0/24 is subnetted, 1 subnets C 12.12.12.0 is directly connected, Serial1/2 都已经消失名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 7 页 - - - - - - - - - 向 R1里面添加永久静态路由向 R1 的 S1/2 添加 IP 地址r1#configure terminalr1(config)#interfac
16、e serial 1/2r1(config-if)# ip address 12.12.12.1 255.255.255.0 / 因为刚才移除了IP 地址,之后写入永久静态路由是无效的,必须先配置IP 地址r1(config-if)# exit r1(config)#exit r1#show ip routeCodes: C - connected, S - static, R - RIP , M - mobile, B - BGP D - EIGRP , EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA ex
17、ternal 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 la
18、st resort is not set 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/24 is subnetted, 1 subnets S 2.2.2.0 1/0 via 12.12.12.2 12.0.0.0/24 is subnetted, 1 subnets C 12.12.12.0 is directly connected, Serial1/2 将静态路由移除r1#configure terminalr1(config)#no ip route 2.2.
19、2.0 255.255.255.0 12.12.12.2 / 移除静态路由r1(config)#exit r1#show ip routeCodes: 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 ext
20、ernal 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 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 7 页 - - - - -
21、 - - - - Gateway of last resort is not set 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 12.0.0.0/24 is subnetted, 1 subnets C 12.12.12.0 is directly connected, Serial1/2 添加永久静态路由r1#configure terminal r1(config)#ip route 2.2.2.0 255.255.255.0 12.12.12.2 permanent/ 配置永
22、久静态路由r1(config)#exit r1#show ip routeCodes: 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-
23、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 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/24 is subne
24、tted, 1 subnets S 2.2.2.0 1/0 via 12.12.12.2 12.0.0.0/24 is subnetted, 1 subnets C 12.12.12.0 is directly connected, Serial1/2 再次将 R1 的 S1/2 接口的 IP 地址移除r1#configure terminalr1(config)#interface serial 1/2r1(config-if)# no ip address 12.12.12.1 255.255.255.0 / 移除 IP 地址r1(config-if)# exitr1(config)#ex
25、it 查看路由表r1#show ip route名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 7 页 - - - - - - - - - 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 - OSP
26、F 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 1.
27、0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/24 is subnetted, 1 subnets S 2.2.2.0 1/0 via 12.12.12.2 仅丢失了直连的路由。12.0.0.0/24 is subnetted, 1 subnets C 12.12.12.0 is directly connected, Serial1/2 永久静态路由2.0.0.0/24 is subnetted, 1 subnets S 2.2.2.0 1/0 via 12.12.12.2 被保留在了路由表里面。名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 7 页 - - - - - - - - -