天天看點

50、BGP配置實驗之社團屬性community

1、社團屬性community解析

<a href="http://s4.51cto.com/wyfs02/M01/77/BF/wKioL1ZtYLaQ_uOlAABm5SPyRW4379.png" target="_blank"></a>

BGP社團屬性community:

可開啟:BGP社團屬性community為可選屬性,預設不識别。可通過指令開啟:neighbor x.x.x.x send-community

傳遞性:BGP社團屬性community隻在鄰居有效,鄰居的鄰居不再有效,想要傳遞到鄰居的鄰居需配置neighbor x.x.x.x send-community

修改BGP社團屬性community步驟:

ip prefix-list 1 permit 1.1.1.0/24

route-map COM permit 10

 match ip address prefix-list 1

 set community no-advertise 不傳給BGP鄰居

 set community no-export不傳出大AS

 set community local-AS 不傳出小AS

route-map COM permit 20

router bgp 1

 neighbor 12.1.1.2 send-community

 neighbor 12.1.1.2 route-map COM out

2、實驗拓撲

<a href="http://s4.51cto.com/wyfs02/M01/77/C0/wKiom1ZtYTnSR2ZxAABRAUFLou4631.png" target="_blank"></a>

3、基礎配置

R1配置

interface Loopback0

 ip address 1.1.1.1 255.255.255.0

interface Serial0/0

 ip address 12.1.1.1 255.255.255.0

 no synchronization

 bgp router-id 1.1.1.1

 network 1.1.1.0 mask 255.255.255.0

 neighbor 12.1.1.2 remote-as 2

 no auto-summary

R2配置

 ip address 2.2.2.2 255.255.255.0

 ip address 12.1.1.2 255.255.255.0

interface Serial0/1

 ip address 23.1.1.2 255.255.255.0

router ospf 110

 router-id 2.2.2.2

 network 2.2.2.0 0.0.0.255 area 0

 network 23.1.1.0 0.0.0.255 area 0

router bgp 64512

 bgp router-id 2.2.2.2

 bgp confederation identifier 2

 neighbor 3.3.3.3 remote-as 64512

 neighbor 3.3.3.3 update-source Loopback0

 neighbor 3.3.3.3 next-hop-self

 neighbor 12.1.1.1 remote-as 1

 neighbor 3.3.3.3 send-community

R3配置

 ip address 3.3.3.3 255.255.255.0

 ip address 34.1.1.3 255.255.255.0

 ip address 23.1.1.3 255.255.255.0

 router-id 3.3.3.3

 network 3.3.3.0 0.0.0.255 area 0

 network 34.1.1.0 0.0.0.255 area 0

 bgp router-id 3.3.3.3

 bgp confederation peers 64513 

 neighbor 2.2.2.2 remote-as 64512

 neighbor 2.2.2.2 update-source Loopback0

 neighbor 4.4.4.4 remote-as 64513

 neighbor 4.4.4.4 ebgp-multihop 255

 neighbor 4.4.4.4 update-source Loopback0

 neighbor 4.4.4.4 send-community 

R4配置

 ip address 4.4.4.4 255.255.255.0

 ip address 34.1.1.4 255.255.255.0

 ip address 45.1.1.4 255.255.255.0

 router-id 4.4.4.4

 network 4.4.4.0 0.0.0.255 area 0

 network 45.1.1.0 0.0.0.255 area 0

router bgp 64513

 bgp router-id 4.4.4.4

 bgp confederation peers 64512 

 neighbor 3.3.3.3 ebgp-multihop 255

 neighbor 5.5.5.5 remote-as 64513

 neighbor 5.5.5.5 update-source Loopback0

 neighbor 5.5.5.5 send-community 

R5配置

 ip address 5.5.5.5 255.255.255.0

 ip address 56.1.1.5 255.255.255.0

 ip address 45.1.1.5 255.255.255.0

 router-id 5.5.5.5

 network 5.5.5.0 0.0.0.255 area 0

 bgp router-id 5.5.5.5

 neighbor 56.1.1.6 remote-as 6

 neighbor 56.1.1.6 send-community 

R6配置

 ip address 6.6.6.6 255.255.255.0

 ip address 56.1.1.6 255.255.255.0

router bgp 6

 bgp router-id 6.6.6.6

 neighbor 56.1.1.5 remote-as 2

4、社團屬性驗證

ip prefix-list 1 seq 5 permit 1.1.1.0/24

 set community no-advertise

<a href="http://s5.51cto.com/wyfs02/M00/77/C0/wKiom1ZtZeXgzZPtAAAVpDkptrw125.png" target="_blank"></a>

<a href="http://s5.51cto.com/wyfs02/M00/77/BF/wKioL1ZtZeqiPFzAAAANW0ZgfwA681.png" target="_blank"></a>

 set community no-export

<a href="http://s3.51cto.com/wyfs02/M01/77/C1/wKioL1Ztjl-xGWa9AAAUuiMMdkM643.png" target="_blank"></a>

<a href="http://s1.51cto.com/wyfs02/M02/77/C1/wKioL1ZtjmDDBXFpAAAK540p-tc573.png" target="_blank"></a>

 set community local-AS

<a href="http://s2.51cto.com/wyfs02/M00/77/C2/wKiom1ZtjwGyZkY6AAATd_vZlvk427.png" target="_blank"></a>

<a href="http://s1.51cto.com/wyfs02/M00/77/C1/wKioL1ZtjwbwRO60AAALGukMTNw566.png" target="_blank"></a>

      本文轉自開源殿堂 51CTO部落格,原文連結:http://blog.51cto.com/kaiyuandiantang/1722619,如需轉載請自行聯系原作者

繼續閱讀