Distance 命令修改之前,学习到的外部OSPF路由都是默认的110管理距离
- [Copy to clipboard]CODE:C 102.0.0.0/8 is directly connected, FastEthernet1/3O N2 103.0.0.0/8 [110/20] via 219.146.244.2, 00:00:02, FastEthernet1/4C 101.0.0.0/8 is directly connected, FastEthernet1/2O IA 172.17.0.0/16 [110/129] via 219.146.242.1, 00:00:02, Serial0/1O IA 172.16.0.0/16 [110/192] via 219.146.242.1, 00:00:02, Serial0/1O IA 172.19.0.0/16 [110/129] via 219.146.242.1, 00:00:02, Serial0/1O IA 172.18.0.0/16 [110/193] via 219.146.242.1, 00:00:02, Serial0/1
- ....
通过distance 40命令修改之后,所有的通过ospf 100学习来的路由AD变为我们指定的40
- [Copy to clipboard]
- CODE:
- C 102.0.0.0/8 is directly connected, FastEthernet1/3
- O N2 103.0.0.0/8 [40/20] via 219.146.244.2, 00:00:18, FastEthernet1/4
- C 101.0.0.0/8 is directly connected, FastEthernet1/2
- O IA 172.17.0.0/16 [40/129] via 219.146.242.1, 00:00:18, Serial0/1
- O IA 172.16.0.0/16 [40/192] via 219.146.242.1, 00:00:18, Serial0/1
- O IA 172.19.0.0/16 [40/129] via 219.146.242.1, 00:00:18, Serial0/1
- O IA 172.18.0.0/16 [40/193] via 219.146.242.1, 00:00:18, Serial0/1
[使用Distance 命令修改默认某条特定路由的管理距离]
所有的通过ospf 100学习来的路由都将被更改AD,如果我们只是希望更改某一条外部路由的metric
通过distance 扩展命令就不用根据进程号来进行管理距离的改变,而是根据从哪儿学习来的路由
这里我们拿RIP来实验
修改之前我们先再SW1上面查看学习到的RIP路由
[Copy to clipboard]
- CODE:
- R 106.0.0.0/8 [120/1] via 101.0.0.1, 00:00:11, FastEthernet1/2
- R 105.0.0.0/8 [120/1] via 101.0.0.1, 00:00:12, FastEthernet1/2
- R 108.0.0.0/8 [120/1] via 102.0.0.1, 00:00:16, FastEthernet1/3
- R 107.0.0.0/8 [120/1] via 102.0.0.1, 00:00:22, FastEthernet1/3
都是从101.0.0.1学习来SR1的RIP路由,从102.0.0.1学习来SR2的RIP路由
我们现在让从101.0.0.1学习来的RIP路由的AD变为40
那么执行
- router rip
- distance 40 101.0.0.1 255.255.255.255
- [Copy to clipboard]
- CODE:
- R 106.0.0.0/8 [40/1] via 101.0.0.1, 00:00:02, FastEthernet1/2
- R 105.0.0.0/8 [40/1] via 101.0.0.1, 00:00:14, FastEthernet1/2
- R 108.0.0.0/8 [120/1] via 102.0.0.1, 00:00:06, FastEthernet1/3
- R 107.0.0.0/8 [120/1] via 102.0.0.1, 00:00:12, FastEthernet1/3
- [distribute rip sub metric 30]
更改我们先查看学习到的RIP路由的Metric
- [Copy to clipboard]CODE:
- SW2#sh ip route
- O N2 102.0.0.0/8 [110/20] via 219.146.244.1, 00:00:02, FastEthernet1/4
- O N2 108.0.0.0/8 [110/20] via 219.146.244.1, 00:00:02, FastEthernet1/4
- O N2 106.0.0.0/8 [110/20] via 219.146.244.1, 00:00:03, FastEthernet1/4
- O N2 107.0.0.0/8 [110/20] via 219.146.244.1, 00:00:03, FastEthernet1/4
- O N2 105.0.0.0/8 [110/20] via 219.146.244.1, 00:00:03, FastEthernet1/4
- ...........
我们在SW1上面redistribute rip sub metric 30以后,再看SW2
- [Copy to clipboard]CODE:
- SW2#sh ip route
- CODE:
- C 102.0.0.0/8 is directly connected, FastEthernet1/3
- O N2 103.0.0.0/8 [110/20] via 219.146.244.2, 00:00:02, FastEthernet1/4
- C 101.0.0.0/8 is directly connected, FastEthernet1/2
- O IA 172.17.0.0/16 [110/129] via 219.146.242.1, 00:00:02, Serial0/1
- O IA 172.16.0.0/16 [110/192] via 219.146.242.1, 00:00:02, Serial0/1
- O IA 172.19.0.0/16 [110/129] via 219.146.242.1, 00:00:02, Serial0/1
- O IA 172.18.0.0/16 [110/193] via 219.146.242.1, 00:00:02, Serial0/1
- ....
通过distance 40命令修改之后,所有的通过ospf 100学习来的路由AD变为我们指定的40
Distance 命令修改默认管理距离的配置就为大家介绍完了,希望大家已经掌握并且理解了。
【编辑推荐】