修改静态路由的管理距离

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
查看路由表
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
查看路由表
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
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
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 subnetted, 1 subnets
S2.2.2.0 [1/0] via 12.12.12.2
现在的静态路由是:
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 [2/0] via 12.12.12.2
将静态路由的管理距离改成
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 [2/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
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
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#ip route 1.1.1.0 255.255.255.0 12.12.12.1
r2(config)#exit
查看路由表
R1
r1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
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
包含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:

执行命令
r1#configure terminal
r1(config)#no ip route 2.2.2.0 255.255.255.0 12.12.12.2
r1(config)#ip route 2.2.2.0 255.255.255.0 12.12.12.2 2
r1(config)#exit
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
执行命令
r1#configure terminal
r1(config)#no ip route 2.2.2.0 255.255.255.0 12.12.12.2 2
r1(config)#ip route 2.2.2.0 255.255.255.0 12.12.12.2 255
r1(config)#exit
12.0.0.0/24 is subnetted, 1 subnets
C 12.12.12.0 is directly connected, Serial1/2
显然包含2.2.2.2的路由条目
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 [1/0] via 12.12.12.2
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
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
r2(config-if)#ip address 12.12.12.2 255.255.255.0
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#interface loopback 0
r2(config-if)#ip address 2.2.2.2 255.255.255.0
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
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
由于两个路由器的路由表中的两条静态路由都正常工作。因此连通性良好。
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
12.0.0.0/24 is subnetted, 1 subnets
C 12.12.12.0 is directly connected, Serial1/2
发现路由表中没有刚才添加的包含有2.2.2.2的静态路由条目。
当管理距离设置为255的时候,说明该路由条目是不可信的,不会被写进路由表。
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#interface loopback 0
r1(config-if)#ip address 1.1.1.1 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#exit
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
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/116/256 ms
执行命令
r1#ping 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:
在R1的路由表里面
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
修改静态路由的管理距离
环境如图:
实验目的,使用静态路由命令的参数,修改静态路由的管理距离。
基本设置
R1
Router>en
Router#configure terminal
Router(config)#hostname r1
r1(config)#interface serial 1/2
r1(config-if)#ip address 12.12.12.1 255.255.255.0
r1(config)#ip route 2.2.2.0 255.255.255.0 12.12.12.2
r1(conBiblioteka Baiduig)#exit
R2
Router>en
Router#configure terminal
Router(config)#hostname r2
r2(config)#interface serial 1/3
相关文档
最新文档