实验 9.11.4 c BGP团体属性
一、实验拓扑图:
二、实验目的:
国际互联网培训中心ITAA和ISP是对等的互联关系,但ITAA会担心自己内部的网络被ISP通告给其他的对等体,而ITAA又不能直接配置ISP内部的路由器,所以采用团体属性(community no-export),禁止应用于策略的路有条目发布到下一个AS区域。
三、具体实验内容:
步骤:
-实验基本配置(包括BGP的配置); |
-在ITAA上配置团体属性,控制路由发布; |
-结论 |
实验基本配置(包括BGP的配置):
ITAA#sh run Building configuration...
Current configuration : 1573 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname ITAA interface Loopback0 ip address 1.1.1 .1 255.255.255.0 ! interface Serial1/0 ip address 192.168.1.1 255.255.255.252 serial restart-delay 0 ! router bgp 100 no synchronization bgp log-neighbor-changes network 1.1.1 .0 mask 255.255.255.0 neighbor 192.168.1.2 remote-as 200 neighbor 192.168.1.2 send-community neighbor 192.168.1.2 route-map OUTLIMIT out no auto-summary ! end | ISP#sh run Building configuration...
Current configuration : 1389 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname ISP interface Loopback0 ip address 2.2.2 .2 255.255.255.0 interface Serial1/0 ip address 172.16.1.1 255.255.255.0 serial restart-delay 0 ! interface Serial1/1 ip address 192.168.1.2 255.255.255.252 serial restart-delay 0 ! router bgp 200 no synchronization bgp log-neighbor-changes network 2.2.2 .0 mask 255.255.255.0 neighbor 172.16.1.2 remote-as 400 neighbor 192.168.1.1 remote-as 100 no auto-summary end |
OUT#sh run Building configuration...
Current configuration : 1338 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname OUT interface Loopback0 ip address 3.3.3 .3 255.255.255.0 ! interface Serial1/1 ip address 172.16.1.2 255.255.255.0 serial restart-delay 0 ! router bgp 400 no synchronization bgp log-neighbor-changes network 3.3.3 .0 mask 255.255.255.0 neighbor 172.16.1.1 remote-as 200 no auto-summary end |
在ITAA上配置团体属性,控制路由发布:
在配置之前,我们查看一下OUT路由器上面的BGP表:
OUT#sh ip bgp BGP table version is 4, local router ID is 3.3.3 .3 Network Next Hop Metric LocPrf Weight Path *> 1.1.1 .0/24 172.16.1.1 0 200 100 i *> 2.2.2 .0/24 172.16.1.1 0 0 200 i *> 3.3.3 .0/24 0.0.0 .0 0 32768 i |
条目中是有 1.1.1 .0的路由条目的,下面我们在ITAA上面配置团体属性,来达到控制路由发布的目的(前提还要保证ISP可以获得相应路由):
ITAA(config)#access-list 10 per 1.1.1 .0 0.0.0.255 ITAA(config)#route-map OUTLIMIT per 10 ITAA(config-route-map)#match ip address 10 ITAA(config-route-map)#set community no-export ITAA(config-route-map)#route-map OUTLIMIT per 20 ITAA(config-route-map)#exi ITAA(config)#router bgp 100 ITAA(config-router)#nei 192.168.1.2 route-map OUTLIMIT out ITAA(config-router)#nei 192.168.1.2 send-community |
通过配置路由策略,控制 1.1.1 .0的网段通告给下一个AS(不包括ISP)。我们来验证一下:
查看OUT路由器上面的BGP表:
OUT#sh ip bgp BGP table version is 7, local router ID is 3.3.3 .3 Network Next Hop Metric LocPrf Weight Path *> 2.2.2 .0/24 172.16.1.1 0 0 200 i *> 3.3.3 .0/24 0.0.0 .0 0 32768 i |
可以看到, 1.1.1 .0的路由条目已经消失了,我们再来查看一下ISP上面的BGP条目:
ISP#sh ip bgp BGP table version is 4, local router ID is 2.2.2 .2 Network Next Hop Metric LocPrf Weight Path *> 1.1.1 .0/24 192.168.1.1 0 0 100 i *> 2.2.2 .0/24 0.0.0 .0 0 32768 i *> 3.3.3 .0/24 172.16.1.2 0 0 400 i |
很明显, 1.1.1 .0的条目很清楚的存在。
结论:
1. 团体属性中的no-export命令是在本地控制相隔一个AS的路由发布情况,也就是说,通过团体属性的控制可以实现只传给它的直接邻居对等体,而不继续传下去,这样也就解决了不能在类似于ISP这样的中间提供商直接配置的局限;