CCNP精粹系列之十八--路由映射实战二,博主推荐文章
生活随笔
收集整理的這篇文章主要介紹了
CCNP精粹系列之十八--路由映射实战二,博主推荐文章
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
路由映射實戰二 本篇博文和上一篇是緊密結合的,只是在上個試驗的基礎上作了改動,達到其他的試驗效果。 試驗二: 在R1上增加一個網段,并發布路由。這里采用三種方法。 如下是第一種,是在試驗一的基礎上直接增加一個網段,發布路由。 ? A(config)#int lo2 A(config-if)#ip addr 192.168.30.1 255.255.255.0 A(config-if)#exit A(config)#router eigrp 100 A(config-router)#net 192.168.30.0 分別在R2 ,R3上做測試: 正常情況下, R2上是能學習到路由,R3上不能學到路由。 ? B# B#show ip ro 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 ???????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 ? D????192.168.30.0/24 [90/2297856] via 202.110.100.1, 00:00:21, Serial1/0????//新學到的路由。 C????202.110.100.0/24 is directly connected, Serial1/0 C????202.110.101.0/24 is directly connected, Serial1/1 D????192.168.10.0/24 [90/2297856] via 202.110.100.1, 00:16:44, Serial1/0 D????192.168.20.0/24 [90/2297856] via 202.110.100.1, 00:16:44, Serial1/0 ? ? C>en C#show ip ro 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 ???????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 ? C????202.110.101.0/24 is directly connected, Serial1/1 R????192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:18, Serial1/1 R????192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:18, Serial1/1 解決方案:在B上重新做路由映射,及路由的再發布。 ? B(config)#route-map abc permit 30 B(config-route-map)#match ip addr 3 B(config-route-map)#set metric 10 B(config-route-map)#exit B(config)#access-list 3 permit 192.168.30.0?0.0.0.255 B(config)#router rip B(config-router)#redistribute eigrp 100 route-map abc 在C上做測試; ? C#show ip ro 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 ???????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 ? R????192.168.30.0/24 [120/10] via 202.110.101.1, 00:00:10, Serial1/1 C????202.110.101.0/24 is directly connected, Serial1/1 R????192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:10, Serial1/1 R????192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:10, Serial1/1 ? 第二種方法 在訪問控制列表中做文章,一個列表放兩個路由, ?B(config)#route-map abc permit 20 B(config-route-map)#match ip addr 2 B(config-route-map)#set metric 5 B(config-route-map)#exit B(config)#access-list 2 permit 192.168.30.0??0.0.0.255 B(config)# B(config)#router rip B(config-router)#redistribute eigrp 100 route-map abc B(config-router)# 在C上再次做測試: ? C#show ip ro 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 ???????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 ? R????192.168.30.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1 注意:學到的路由種子度量和20網段的種子度量相同。 C????202.110.101.0/24 is directly connected, Serial1/1 R????192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:12, Serial1/1 R????192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1 ? 方法三: 路由再發布時,滿足1號表的路由,修改度量值為3,不滿足1號表的路由,修改度量值為5.(即對有set無match的應用) B(config)#route-map abc permit 10 B(config-route-map)#match ip addr 1 B(config-route-map)#set metric 3 ? B(config)#route-map abc permit 20 B(config-route-map)#no match ip addr 2 B(config-route-map)#set metric 5 這里還可以采用不配置20網段的訪問控制列表,效果是一樣的,并不沖突。 在C路由器上做測試: ? R????192.168.30.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1 R????202.110.100.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1 C????202.110.101.0/24 is directly connected, Serial1/1 R????192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:12, Serial1/1 R????192.168.20.0/24 [120/5] via 202.110.101.1, 00:00:12, Serial1/1 因為利用上一種方法時30網段的種子度量是5,此時30網段種子度量也是5,顯然有點不清楚,下面利用同樣的方法將30網段的種子度量該為3。由于利用再發布是一樣的,所以只需要將10網段和20網段對應的match和set?調整一下即可。 在R2做操作: ? B(config)#route-map abc permit 20 B(config-route-map)# match ip addr 2?????//啟用20網段的match B(config-route-map)#set metric 5 ? R3上測試: ? R????192.168.30.0/24?[120/3]?via 202.110.101.1, 00:00:23, Serial1/1???//試驗結果在我們預料之中。 R????202.110.100.0/24 [120/3] via 202.110.101.1, 00:00:23, Serial1/1 C????202.110.101.0/24 is directly connected, Serial1/1 R????192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:23, Serial1/1 R????192.168.20.0/24 [120/3] via 202.110.101.1, 00:00:23, Serial1/1 ? 試驗三:在發布過程中,滿足1號表的路由,修改種子度量為3,滿足2號表的路由,使用默認屬性正常發布。 R2上修改:(理解默認屬性:即match和set均不配置) ? B(config-route-map)#route-map abc permit 10 B(config-route-map)#no??match ip addr 1??? B(config-route-map)#set metric 3 ? B(config)#route-map abc permit 20 B(config-route-map)#no??match ip addr 2 B(config-route-map)#no set metric 5 由于10網段在route-map abc permit 10??,它里面包含的match和set語句,正常情況下,R3應該只能學到10網段的路由,而20,30網段屬于默認屬性,滿足表2,應該學習不到路由。 ? Gateway of last resort is not set ? C????202.110.101.0/24 is directly connected, Serial1/1 R????192.168.10.0/24 [120/3] via 202.110.101.1, 00:00:08, Serial1/1 試驗現象和我們的理論分析完全吻合。 ? 有set無match的情況我們看到了,那么有match無set會怎樣呢??? R3只能學到匹配10網段的路由。呵呵,學習!其樂無窮啊!!加油吧!
? ? ?本文轉自shenleigang 51CTO博客,原文鏈接:http://blog.51cto.com/shenleigang/151090,如需轉載請自行聯系原作者
? ? ?本文轉自shenleigang 51CTO博客,原文鏈接:http://blog.51cto.com/shenleigang/151090,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的CCNP精粹系列之十八--路由映射实战二,博主推荐文章的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JAVA实现飞机大战详解
- 下一篇: C语言笔记:格式化输入输出(fprint