对等体组是对一组路由器实施策略,而社团属性是对一组路由实施策略。

社团属性分以下两种:

1、well-known communities 公认团体
2、Private communities 私有团体

社团属性中已经预定义好的三类well-known属性:

  • no-advertise:携带此属性的路由不会通告给任何BGP邻居。也就是说只传达给一个邻居
  • no-export:携带此属性的路由不会传出本AS外,只会传给IBGP。(联邦中的小AS会递)。
  • local-AS:  携带此属性的路由不会传出小AS。
  • internat :携带此属性的可以任意传播不受AS的限制

拓扑:

配置:

R1
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Loopback10
ip address 10.1.1.1 255.255.255.0
!
interface Loopback20
ip address 20.1.1.1 255.255.255.0
!
interface Loopback30
ip address 30.1.1.1 255.255.255.0
!
interface Loopback40
ip address 40.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 12.1.1.1 255.255.255.0
duplex auto
speed auto
!
router bgp 100
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 10.1.1.0 mask 255.255.255.0
network 20.1.1.0 mask 255.255.255.0
network 30.1.1.0 mask 255.255.255.0
network 40.1.1.0 mask 255.255.255.0
neighbor 12.1.1.2 remote-as 200
neighbor 12.1.1.2 send-community
neighbor 12.1.1.2 route-map community out
no auto-summary
!
access-list 10 permit 10.1.1.0 0.0.0.255
access-list 20 permit 20.1.1.0 0.0.0.255
access-list 30 permit 30.1.1.0 0.0.0.255
access-list 40 permit 40.1.1.0 0.0.0.255
!
!
!
route-map community permit 10
match ip address 10
set community internet
!
route-map community permit 20
match ip address 20
set community local-AS
!
route-map community permit 30
match ip address 30
set community no-advertise
!
route-map community permit 40
match ip address 40
set community no-export
!
route-map community permit 50

 

R2
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 12.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 23.1.1.2 255.255.255.0
duplex auto
speed auto
!
router ospf 100
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 23.1.1.0 0.0.0.255 area 0
!
router bgp 400
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
bgp confederation identifier 200
neighbor 3.3.3.3 remote-as 400
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 next-hop-self
neighbor 3.3.3.3 send-community
neighbor 12.1.1.1 remote-as 100
no auto-summary

 

R3
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 34.1.1.3 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 23.1.1.3 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 35.1.1.3 255.255.255.0
speed 100
full-duplex
!
router ospf 100
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 23.1.1.0 0.0.0.255 area 0
network 34.1.1.0 0.0.0.255 area 0
!
router bgp 400
no synchronization
bgp log-neighbor-changes
bgp confederation identifier 200
bgp confederation peers 500
neighbor 2.2.2.2 remote-as 400
neighbor 2.2.2.2 update-source Loopback0
neighbor 4.4.4.4 remote-as 500
neighbor 4.4.4.4 ebgp-multihop 255
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 send-community
neighbor 35.1.1.5 remote-as 300
neighbor 35.1.1.5 send-community
no auto-summary

 

R4
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 34.1.1.4 255.255.255.0
duplex auto
speed auto
!
router ospf 100
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 0
network 34.1.1.0 0.0.0.255 area 0
!
router bgp 500
no synchronization
bgp router-id 5.5.5.5
bgp log-neighbor-changes
bgp confederation identifier 200
bgp confederation peers 400
neighbor 3.3.3.3 remote-as 400
neighbor 3.3.3.3 ebgp-multihop 255
neighbor 3.3.3.3 update-source Loopback0
no auto-summary

 

interface Loopback0
ip address 5.5.5.5 255.255.255.0
!
interface FastEthernet0/0
ip address 35.1.1.5 255.255.255.0
speed 100
full-duplex
!
router bgp 300
no synchronization
bgp router-id 5.5.5.5
bgp log-neighbor-changes
neighbor 35.1.1.3 remote-as 200
no auto-summary

分析:

R2能接收到所以的社团属性。

由于30.1.1.0携带了 no-advertise 路由不会通告给任何BGP邻居。也就是说只传达给一个居。

所以R3接收不到。

由于20.1.1.0 携带了local-AS,路由不会传出小AS,所以R4接收不到。

由于40.1.1.0携带了no-export,路由不会传出本AS外,只会传给IBGP。(联邦中的小AS会传递)。所以R5接收不到。