已登录 首页 | 产品报价 全国行情 产品排行榜 | 渠道商情 商铺大全 | 新闻 评测 专题 下载 | 培训 视频 高端访谈 | 产品论坛 MY168 圈子 装备
IT168.com
当前位置:IT168首页 > 网络通信 > BGP聚合路由实验
[收藏此页] [打印] [推荐] [评论]

BGP聚合路由实验

责任编辑:吴玲作者:IT168   2008-05-05   

  BGP下有两种方法生成聚合地址,第一种方法是在路由表中为聚合路由建立一条静态路由条目,然后用network命令通告出去,第二种方法是用aggregate-address命令生成聚合地址.
  命令aggregate-address使用注意事项,在通告聚合地址的ROUTE上,如果只用aggregate-address通告聚合地址,那么聚合路由和详细路由都通告给对等体,如果在aggregate-address后加上关键字summary-only,那么将只通告聚合路由.
  实验
  

拓扑图

 

  在AS 100 中用网络192.168.192.0/24---192.168.198.0/24的网络,使用LOOPBACK接口实现,AS 100向AS 200通告聚合路由和全部详细路由,在R4和R5上重分布直连,AS 200中只向AS 100通告聚合地址,在R2和R3上使用ROUTE-MAP,设置BGP的团体属性,如果路由与访问列表匹配,则不设置团体属性,如果不匹配,就给该路由分配一个NO_EXPORT的团体属性.
  因为使用TELNET配置ROUTE,所以E0口被占用,在重分布时使用ROUTE-MAP E0过滤掉E0的地址.
  R5的配置
  interface Loopback0
  ip address 50.50.50.50 255.255.255.0
  !
  interface Loopback1
  ip address 192.168.192.1 255.255.255.0
  !
  interface Loopback2
  ip address 192.168.193.1 255.255.255.0
  !
  interface Loopback3
  ip address 192.168.195.1 255.255.255.0
  !
  interface Loopback4
  ip address 192.168.196.1 255.255.255.0
  !
  interface Loopback5
  ip address 192.168.197.1 255.255.255.0
  !
  interface Loopback6
  ip address 192.168.198.1 255.255.255.0
  !
  interface Loopback7
  ip address 192.168.199.1 255.255.255.0
  !
  interface Loopback8
  ip address 192.168.194.1 255.255.255.0
  !
  interface Ethernet0
  ip address 192.168.100.6 255.255.255.0
  !
  interface Serial0
  ip address 192.168.1.245 255.255.255.252
  clockrate 64000
  !
  interface Serial1
  no ip address
  !
  router bgp 100
  bgp router-id 5.5.5.5
  bgp cluster-id 67372036
  bgp log-neighbor-changes
  aggregate-address 192.168.192.0 255.255.248.0
  redistribute connected route-map e0
  neighbor 192.168.1.246 remote-as 200
  neighbor 192.168.1.246 send-community
  neighbor 192.168.1.246 route-map comm out
  !
  no ip classless
  no ip http server
  !
  access-list 1 deny   192.168.100.0 0.0.0.255
  access-list 1 permit any
  access-list 101 permit ip host 192.168.192.0 host 255.255.248.0
  route-map comm permit 10
  match ip address 101
  set community none
  !
  route-map comm permit 20
  set community no-export
  !
  route-map e0 permit 1
  match ip address 1
  !
  R4的配置
  interface Loopback0
  ip address 40.40.40.40 255.255.255.0
  !
  interface Loopback1
  ip address 192.168.192.1 255.255.255.0
  !
  interface Loopback2
  ip address 192.168.193.1 255.255.255.0
  !
  interface Loopback3
  ip address 192.168.194.1 255.255.255.0
  !
  interface Loopback4
  ip address 192.168.195.1 255.255.255.0
  !        
  interface Loopback5
  ip address 192.168.196.1 255.255.255.0
  !
  interface Loopback6
  ip address 192.168.197.1 255.255.255.0
  !
  interface Loopback7
  ip address 192.168.198.1 255.255.255.0
  !
  interface Loopback8
  ip address 192.168.199.1 255.255.255.0
  !
  interface Ethernet0
  ip address 192.168.100.5 255.255.255.0
  !
  interface Serial0
  no ip address
  !
  interface Serial1
  ip address 192.168.1.254 255.255.255.252
  clockrate 64000
  !
  router bgp 100
  bgp router-id 4.4.4.4
  bgp log-neighbor-changes
  aggregate-address 192.168.192.0 255.255.248.0
  redistribute connected route-map e0
  neighbor 192.168.1.253 remote-as 200
  neighbor 192.168.1.253 send-community
  neighbor 192.168.1.253 route-map comm out
  !
  ip classless
  no ip http server
  !
  access-list 1 deny   192.168.100.0 0.0.0.255
  access-list 1 permit any
  access-list 101 permit ip host 192.168.192.0 host 255.255.248.0
  route-map comm permit 10
  match ip address 101
  set community none
  !
  route-map comm permit 20
  set community no-export
  !
  route-map e0 permit 10
  match ip address 1
  !
  R2的配置
  router bgp 200
  bgp router-id 2.2.2.2
  bgp log-neighbor-changes
  neighbor 192.168.1.250 remote-as 300
  neighbor 192.168.1.254 remote-as 100
  neighbor 192.168.100.4 remote-as 200
  !
  R3的配置
  router bgp 200
  bgp router-id 3.3.3.3
  bgp log-neighbor-changes
  neighbor 192.168.1.242 remote-as 300
  neighbor 192.168.1.245 remote-as 100
  neighbor 192.168.100.3 remote-as 200
  !
  R1的配置
  router bgp 300
  bgp router-id 1.1.1.1
  bgp log-neighbor-changes
  neighbor 192.168.1.241 remote-as 200
  neighbor 192.168.1.249 remote-as 200
  !
  现在我们来看看R2和R3的BGP路由表
  R2#sho ip b
  BGP table version is 69, local router ID is 2.2.2.2
  Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
  Origin codes: i - IGP, e - EGP, ? - incomplete
  Network          Next Hop            Metric LocPrf Weight Path
  * i192.168.1.0      192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?
  * i192.168.192.0    192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?
  * i192.168.192.0/21 192.168.1.245                 100      0 100 i
  *>                  192.168.1.254                          0 100 i
  * i192.168.193.0    192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?
  * i192.168.194.0    192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?
  * i192.168.195.0    192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?
  * i192.168.196.0    192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?
  * i192.168.197.0    192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?
  * i192.168.198.0    192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?
  * i192.168.199.0    192.168.1.245            0    100      0 100 ?
  *>                  192.168.1.254            0             0 100 ?

  R3#sho ip b
  BGP table version is 38, local router ID is 3.3.3.3
  Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
  Origin codes: i - IGP, e - EGP, ? - incomplete
  Network          Next Hop            Metric LocPrf Weight Path
  *> 192.168.1.0      192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  *> 192.168.192.0    192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  *> 192.168.192.0/21 192.168.1.245                          0 100 i
  * i                 192.168.1.254                 100      0 100 i
  *> 192.168.193.0    192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  *> 192.168.194.0    192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  *> 192.168.195.0    192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  *> 192.168.196.0    192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  *> 192.168.197.0    192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  *> 192.168.198.0    192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  *> 192.168.199.0    192.168.1.245            0             0 100 ?
  * i                 192.168.1.254            0    100      0 100 ?
  接下来我们可以看下带有NO_EXPORT属性的路由条目
  R2#sho ip b community no-export
  BGP table version is 69, local router ID is 2.2.2.2
  Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
  Origin codes: i - IGP, e - EGP, ? - incomplete
  Network          Next Hop            Metric LocPrf Weight Path
  *> 192.168.1.0      192.168.1.254            0             0 100 ?
  *> 192.168.192.0    192.168.1.254            0             0 100 ?
  *> 192.168.193.0    192.168.1.254            0             0 100 ?
  *> 192.168.194.0    192.168.1.254            0             0 100 ?
  *> 192.168.195.0    192.168.1.254            0             0 100 ?
  *> 192.168.196.0    192.168.1.254            0             0 100 ?
  *> 192.168.197.0    192.168.1.254            0             0 100 ?
  *> 192.168.198.0    192.168.1.254            0             0 100 ?
  *> 192.168.199.0    192.168.1.254            0             0 100 ?
  在R3上看到的带有NO_EXPORT的路由,只有NEXT-HOP和R不同(192.168.1.245),所以就不贴了.
  现在可以看看R1上BGP的路由表
  R1#sho ip b 
  BGP table version is 37, local router ID is 1.1.1.1
  Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
  Origin codes: i - IGP, e - EGP, ? - incomplete
  Network                 Next Hop            Metric LocPrf Weight Path
  *  192.168.192.0/21  192.168.1.241                          0 200 100 i
  *>192.168.1.249                                                        0 200 100 i
  至此本次实验成功.

 

上一页
1
下一页
收藏到: 添加到“百度搜藏”添加到“QQ书签”添加到“Google书签”添加到“Yahoo收藏”添加到“和讯网摘”
【内容导航】
本文欢迎转载,转载请注明:转载自IT168 [ http://www.it168.com/ ]
本文链接:http://net.it168.com/app/2008-05-05/200805051657425.shtml
网络通信相关文章   BGP聚合路由
  • 暂无
友情推介