2路由策略_route-map(执行路由策略)
生活随笔
收集整理的這篇文章主要介紹了
2路由策略_route-map(执行路由策略)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
拓撲圖: 配置參數: R1: access-list 10 permit 192.168.5.0 0.0.0.255?//配置匹配的流量 route-map ospf permit 10?//創建一個路由圖配置要匹配的流量 match ip address 10??//關聯要匹配的流量 set metric 1?//設置匹配流量的度量值為1 route-map ospf permit 20?//接著用上面的路由圖,配置序號為20,設置其它的流量 set metric 2//設置其它的流量的度量值為2 router ospf 1 redistribute rip subnets//在OSPF里重發布RIP,讓R4可以學習到 network 192.168.3.0 0.0.0.255 area 0 router rip version 2 redistribute ospf 1 route-map ospf//在RIP里重發布OSPF,并應用上面配置好的路由圖,達到?分流(兩臺設備[R1,R3]配置不同的度量值)和熱備(動態路由可以動態感知網絡拓撲的變化,動態的將度量值小的路由裝進路由表)的效果!!! network 192.168.1.0 no auto-summary
r1(config-if)#no shutdown R2: r2#??SH IP ROU R????192.168.4.0/24 [120/2] via 192.168.2.2, 00:00:05, Ethernet1/1 [120/2] via 192.168.1.2, 00:00:25, Ethernet1/0 192.168.5.0/32 is subnetted, 1 subnets R???????192.168.5.1 [120/1] via 192.168.1.2, 00:00:25, Ethernet1/0 192.168.6.0/32 is subnetted, 1 subnets R???????192.168.6.1 [120/1] via 192.168.2.2, 00:00:05, Ethernet1/1 C????192.168.1.0/24 is directly connected, Ethernet1/0 C????192.168.2.0/24 is directly connected, Ethernet1/1 C????192.168.100.0/24 is directly connected, FastEthernet0/0 R????192.168.3.0/24 [120/2] via 192.168.2.2, 00:00:05, Ethernet1/1 [120/2] via 192.168.1.2, 00:00:25, Ethernet1/0 r2# 可以看出,R2通過動態路由感知到網絡拓撲的變化,動態地學習到了度量值優的路由,然后入進入路由表里!!!
? ? ? 本文轉自810105851 51CTO博客,原文鏈接:http://blog.51cto.com/4708948/1130037,如需轉載請自行聯系原作者
?
R2: access-list 20 permit 192.168.6.0 0.0.0.255 route-map ospf permit 10 match ip address 20 set metric 1 route-map ospf permit 20 set metric 2 router ospf 1 redistribute rip subnets network 192.168.4.0 0.0.0.255 area 0 router rip version 2 redistribute ospf 1 route-map ospf network 192.168.2.0 no auto-summary 測試: r5#sh ip int b Interface??????????????????IP-Address??????OK? Method Status????????????????Protocol FastEthernet0/0????????????192.168.100.2???YES NVRAM??up????????????????????up????? r5#traceroute 192.168.5.1 1 192.168.100.1 1032 msec 20 msec 4 msec 2 192.168.1.2 16 msec 8 msec 60 msec 3 192.168.3.2 32 msec 12 msec * r5#traceroute 192.168.6.1 ??1 192.168.100.1 32 msec 16 msec 16 msec ??2 192.168.2.2 12 msec 28 msec 32 msec ??3 192.168.4.2 16 msec 32 msec * r5# 可以看出要去192.168.5.0的網絡走左邊,去192.168.6.0的網絡走右邊!!!?
配置成功后路由表是這樣的: R2: R????192.168.4.0/24 [120/2] via 192.168.2.2, 00:00:17, Ethernet1/1 ????????????????????[120/2] via 192.168.1.2, 00:00:11, Ethernet1/0 ?????192.168.5.0/32 is subnetted, 1 subnets R???????192.168.5.1 [120/1] via 192.168.1.2, 00:00:11, Ethernet1/0 ?????192.168.6.0/32 is subnetted, 1 subnets R???????192.168.6.1 [120/1] via 192.168.2.2, 00:00:17, Ethernet1/1 C????192.168.1.0/24 is directly connected, Ethernet1/0 C????192.168.2.0/24 is directly connected, Ethernet1/1 C????192.168.100.0/24 is directly connected, FastEthernet0/0 R????192.168.3.0/24 [120/2] via 192.168.2.2, 00:00:17, Ethernet1/1 ????????????????????[120/2] via 192.168.1.2, 00:00:11, Ethernet1/0 可以看出,R2通過R1學習到192.168.5.0并且為1跳,通過R3學習到192.168.6.0并且為1跳。 現在來測試一下,將R1的E0/0(連著R4的接口)down掉,看看會發現什么現象: R1: r1(config)#int e0/0 r1(config-if)#sh r1(config-if)#shutdown R2: r2#sh ip rou R????192.168.4.0/24 [120/2] via 192.168.2.2, 00:00:12, Ethernet1/1 ?????192.168.5.0/32 is subnetted, 1 subnets R???????192.168.5.1 [120/2] via 192.168.2.2, 00:00:12, Ethernet1/1 ?????192.168.6.0/32 is subnetted, 1 subnets R???????192.168.6.1 [120/1] via 192.168.2.2, 00:00:12, Ethernet1/1 C????192.168.1.0/24 is directly connected, Ethernet1/0 C????192.168.2.0/24 is directly connected, Ethernet1/1 C????192.168.100.0/24 is directly connected, FastEthernet0/0 R????192.168.3.0/24 [120/2] via 192.168.2.2, 00:00:12, Ethernet1/1 r2# 可以看出R2是通過R3學習到的192.168.5.0的路由的,它的跳數為2,R5要去192.168.5.0的路由要走右邊,因為左邊的R1的上連端口down掉了。這樣達到了熱備的效果!!!?
現在把R1的E0/0再開啟,看看會是什么效果: R1: r1(config)#int e0/0r1(config-if)#no shutdown R2: r2#??SH IP ROU R????192.168.4.0/24 [120/2] via 192.168.2.2, 00:00:05, Ethernet1/1 [120/2] via 192.168.1.2, 00:00:25, Ethernet1/0 192.168.5.0/32 is subnetted, 1 subnets R???????192.168.5.1 [120/1] via 192.168.1.2, 00:00:25, Ethernet1/0 192.168.6.0/32 is subnetted, 1 subnets R???????192.168.6.1 [120/1] via 192.168.2.2, 00:00:05, Ethernet1/1 C????192.168.1.0/24 is directly connected, Ethernet1/0 C????192.168.2.0/24 is directly connected, Ethernet1/1 C????192.168.100.0/24 is directly connected, FastEthernet0/0 R????192.168.3.0/24 [120/2] via 192.168.2.2, 00:00:05, Ethernet1/1 [120/2] via 192.168.1.2, 00:00:25, Ethernet1/0 r2# 可以看出,R2通過動態路由感知到網絡拓撲的變化,動態地學習到了度量值優的路由,然后入進入路由表里!!!
? ? ? 本文轉自810105851 51CTO博客,原文鏈接:http://blog.51cto.com/4708948/1130037,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的2路由策略_route-map(执行路由策略)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CCNA--增强型内部网关路由选择协议(
- 下一篇: Centos6.5部署大众点评CAT