Distance 命令修改默認管理距離
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 命令修改默認管理距離的配置就為大家介紹完了,希望大家已經掌握并且理解了。
【編輯推薦】