Community Attribute是BGP路由里面一个可传输的,可选的属性,和MED, Weight, Local_Prf等对BGP路由选路和传播路由起到了很重要的作用。Community属性的定义可以是使用名字定义,数值定义,或者AA:NN格式定义。
Community Attribute通过特定的community属性来对路由选路进行改变,而且这些属性可以被传播。
知名的Community属性有如下几种:
- no-export—不通告给其他eBGP邻居,该路由尽在该AS中进行传播
- no-advertise—不通告给其他BGP邻居,不管是eBGP还是iBGP邻居
- internet—宣告给任何属于internet community的路由器
- local-as—在联邦路由(Confederation)中使用,阻止数据包离开local AS
下面是一个关于BGP Community Attribute的一个简单实验,拓扑如下:
R1的配置
interface loopback 0
ip address 11.11.11.11 255.255.255.0
!
interface f0/0
ip address 137.1.1.1 255.255.255.0
!
interface s0/0
ip address 137.1.200.1 255.255.255.0
encapsulation frame-relay
no frame-relay inverse-arp
frame-relay map ip 137.1.200.2 101 broadcast
!
router bgp 123
no synchronization
no auto-summary
bgp log-neighbor-changes
network 11.11.11.0 mask 255.255.255.0
neighbor 137.1.200.2 remote-as 714
neighbor 137.1.200.2 next-hop-self
neighbor 137.1.1.4 remote-as 123
neighbor 137.1.1.4 next-hop-self
R2的配置
interface loopback 0
ip address 22.22.22.22 255.255.255.0
!
interface s0/0
ip address 137.1.200.2 255.255.255.0
encapsulation frame-relay
no frame-relay inverse-arp
frame-relay map ip 137.1.200.1 110 broadcast
!
router bgp 714
bgp router-id 22.22.22.22
no synchronization
no auto-summary
bgp log-neighbor-changes
neighbor 137.1.200.1 remote-as 123
R3的配置
interface loopback 0
ip address 44.44.44.44 255.255.255.0
!
interface f0/0
ip address 137.1.1.4 255.255.255.0
!
router bgp 123
no synchronization
no auto-summary
bgp log-neighbor-changes
network 44.44.44.0 mask 255.255.255.0
neighbor 137.1.1.1 remote-as 123
neighbor 137.1.1.1 next-hop-self
neighbor 137.1.1.1 send-community
neighbor 137.1.1.1 route-map no_advertise out
!
access-list 1 permit 22.22.22.0 0.0.0.255
!
route-map no_advertise permit 10
match ip address 1
set community no-advertise
实验结果:
R1显示关于22.22.22.0/24的路由已经打上了community属性no-advertise。
因为R1不会对这条路由宣告给其他任何BGP邻居,因此R3上不会收到这条路由了。
文章评论
不错啊~~~~~~~~~~~~~~非常详细
兄弟你的拓扑图用的是viso么
@yanyp 没有哦,没有用visio做过处理,是GNS3做实验直接截下来的……
@挨踢小茶 哦,gns3还可以画圈圈,线路还可写上ip,我咋就没发现呢
@yanyp 哈哈,是有这个功能的,工具栏上就有,你看看就知道了。
@挨踢小茶 试过了,确实有,多谢小茶
不错支持了喔~!~
这是路由器设置的参数吗?看样是应该是公司或者企业学校用的那种大型路由器吧。我是搞PHP程序的,嘿嘿
@网络茶馆 是的,BGP属性一般是企业最核心的那几台路由器开启的,和Internet上所有的BGP路由器通信的。
占个沙发~支持一下