操縱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 ////
int lo0
  ip ad 2.2.2.2 255.255.255.0
 
int e2/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
 
router os 1
  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 ////
int lo0
  ip ad 3.3.3.3 255.255.255.0
 
int e3/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
 
router os 1
  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 ////
int lo0
  ip ad 4.4.4.4 255.255.255.0
 
int e4/0
  ip ad 194.1.1.4 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.0 area 0
 
router bgp 65001
  no syn
  neighbor 194.1.1.3 remote-as 65001
  network 4.0.0.0
 
 
 
//// r5 ////
int lo0
  ip ad 5.5.5.5 255.255.255.0
 
int e5/0
  ip ad 195.1.1.5 255.255.255.0
 
int e6/0
  ip ad 196.1.1.5 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.255 area 0
 
router bgp 65001
  no syn
  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內部路由器的選路影響.
 
命令如下:
//// r5 ////
access-list 1 permit 5.0.0.0 0.255.255.255   //定義出路由條目
 
route-map MED permit 10
  match ip address 1
  set metric 50
route-map MED permit 10
 
router bgp 100
  neighbor 196.1.1.3 route-map MED out

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章