天天看點

操縱BGP聯綁屬性(confederation)實際案例(配圖+詳細驗證過程)

//// r1 ////

int lo0

  ip ad 1.1.1.1 255.255.255.0

int e2/0

  ip ad 192.1.1.1 255.255.255.0

router os 1

  net 0.0.0.0 255.255.255.255  //宣告所有接口,内部路由協定IGP先将AS内路由打通

router bgp 65000  //啟用BGP,注意此時為子AS号.

  no syn          //關閉同步.同步是一種過時的技術,當初是用來防止IGP不知道EGP路由條目的情況下做資料轉發,會産生黑洞的問題應運而生的.同步的存在要求IGP 路由協定必須知道所有EGP路由條目,這就要求将EGP路由條目全部重分發進IGP路由表.最初的網絡規模較小,這也許算不上什麼問題.但現在全球路由條 目已經超過了18萬,這樣多的路由條目同時出現在一台普通的路由器上,隻能說後果很嚴重了.曾經有過某省的核心骨路器因為錯誤地注入了EGP路由導緻網絡 大規模斷線4個小時的嚴重後果.

ps:現在我們要求統一關閉同步,并且所有路由器全互連!

  neighbor 192.1.1.2 remote-as 65000

  network 1.0.0.0

//// r2 ////

  ip ad 2.2.2.2 255.255.255.0

  ip ad 192.1.1.2 255.255.255.0

int e3/0

  ip ad 193.1.1.2 255.255.255.0

int e5/0

  ip ad 195.1.1.2 255.255.255.0

  network 0.0.0.0 255.255.255.255 a 0  //宣告所有接口,注意掩碼格式的意義

router bgp 65000

  no syn  //關閉同步

  bgp confederation identifier 200

  bgp confederation peers 65001

  neighbor 192.1.1.1 remote-as 65000

  neighbor 193.1.1.3 remote-as 65001

  neighbor 193.1.1.3 next-hop-self

  neighbor 195.1.1.4 remote-as 100

  network 2.0.0.0

//// r3 ////

  ip ad 3.3.3.3 255.255.255.0

  ip ad 193.1.1.3 255.255.255.0

int e4/0

  ip ad 194.1.1.3 255.255.255.0

int e6/0

  ip ad 196.1.1.3 255.255.255.0

  network 3.3.3.3 255.255.255.0

router bgp 65001

  no syn

  bgp confederation identifier 200     //bgp聯邦設定,辨別出真正的AS

  bgp confederation peers 65000        //BGP聯邦内部成員

  neighbor 193.1.1.2 remote-as 65000

  neighbor 193.1.1.2 next-hop-self     //從AS100學來的路由下一跳改為自已

  neighbor 194.1.1.4 remote-as 65001

  neighbor 196.1.1.4 remote-as 100

  network 3.0.0.0

//// r4 ////

  ip ad 4.4.4.4 255.255.255.0

  ip ad 194.1.1.4 255.255.255.0

  network 0.0.0.0 255.255.255.0 area 0

  neighbor 194.1.1.3 remote-as 65001

  network 4.0.0.0

//// r5 ////

  ip ad 5.5.5.5 255.255.255.0

  ip ad 195.1.1.5 255.255.255.0

  ip ad 196.1.1.5 255.255.255.0

  network 0.0.0.0 255.255.255.255 area 0

  neighbor 195.1.1.2 remote-as 200

  neighbor 196.1.1.3 remote-as 200

完成以上所有配置後,應看到1.0.0.0 - 5.0.0.0 所有網段都将出現在路由表内,通過PING測試後,全網全通才正确.具體show ip bgp 以及 show ip ro内容有空我會發上來.

這個實驗最後一步,建議可以在R5上改變發往AS200的路由條目的METRIC值.發往r3的metric設定為50,觀察對AS内部路由器的選路影響.

指令如下:

access-list 1 permit 5.0.0.0 0.255.255.255   //定義出路由條目

route-map MED permit 10

  match ip address 1

  set metric 50

router bgp 100

  neighbor 196.1.1.3 route-map MED out

本文轉自 ciscodocu51CTO部落格,原文連結:http://blog.51cto.com/ciscodocu/52817,如需轉載請自行聯系原作者

繼續閱讀