操纵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

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