BGP
community
local-AS(联邦范围)
additive:add to the existing community //如何使用?
internet: (well-know commuity)
no-advertise:Do not advertise to any peer
no-export:No community attribute 在没有联邦就打上local-as 效果和no-export一样
neighbor [ip] send-community //加上才能传递community属性 hop-by-hop
=====================================================================
TOP:
(AS600)---(AS105-[AS65104-AS65500]-AS105)--(AS700)
 
R6-AS600-)-(-AS105-[--AS65104-R4-R2-R1-R3-AS65104--]-[--AS65500-R5-AS65500-]-)-(AS700-R7
试验环境:BGP各路由互通。在6上发布了相应网段做测试
目的:community-list 的使用,和community属性的应用。
 6.6.1.0网段不发出AS105
 6.6.2.0网段不发出联邦AS65104
 6.6.3.0能到达7.7.7.7
注意:R4上的route-map对6.6.4.0的作用
备注:IP规划 RX|fa1--- fa2|RY
fa1 ip: 10.1.xy.x fa2 ip:10.1.xy.y
R6配置
----------------------------------------------------------------
interface Loopback0
 ip address 6.6.6.6 255.255.255.0
!
interface Loopback1
 ip address 6.6.1.1 255.255.255.0
!
interface Loopback2
 ip address 6.6.2.2 255.255.255.0
!
interface Loopback3
 ip address 6.6.3.3 255.255.255.0
!
interface Loopback4
 ip address 6.6.4.4 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.1.46.6 255.255.255.0
 duplex auto
 speed auto
...
!
router bgp 600
 no synchronization
 bgp router-id 6.6.6.6
 bgp log-neighbor-changes
  network 6.6.1.0 mask 255.255.255.0
 network 6.6.2.0 mask 255.255.255.0
 network 6.6.3.0 mask 255.255.255.0
 network 6.6.4.0 mask 255.255.255.0

 neighbor 10.1.46.4 remote-as 105
  neighbor 10.1.46.4 send-community
  neighbor 10.1.46.4 route-map ccl out
 no auto-summary
!
...
!
ip prefix-list 1 seq 5 permit 6.6.1.0/24
!
ip prefix-list 2 seq 5 permit 6.6.2.0/24
!
route-map ccl permit 10
 match ip address prefix-list 1
 set community 39321601 no-export
!        
route-map ccl permit 20
 match ip address prefix-list 2
 set community 39321602 local-AS
!
route-map ccl permit 30
!
...
----------------------------------------------------------------
R4配置
----------------------------------------------------------------
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.1.46.4 255.255.255.0
 duplex auto
 speed auto
!
...
!
router eigrp 105
 network 4.4.4.0 0.0.0.255
 network 10.1.24.0 0.0.0.255
 no auto-summary
 eigrp router-id 4.4.4.4
!
router bgp 65104
 no synchronization
 bgp router-id 4.4.4.4
 bgp log-neighbor-changes
 bgp confederation identifier 105
 neighbor 2.2.2.2 remote-as 65104
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
  neighbor 2.2.2.2 send-community
 neighbor 2.2.2.2 route-map ccl out
 neighbor 10.1.46.6 remote-as 600
 no auto-summary
!
...
!
ip community-list 1 permit 39321601
ip community-list 2 permit 39321602
!

!
ip prefix-list 3 seq 5 permit 6.6.3.0/24
!
route-map ccl permit 10
 match community 1
 set metric 6001
!
route-map ccl permit 20
 match community 2
 set metric 6002
!
route-map ccl permit 30
 match ip address prefix-list 3
!        
----------------------------------------------------------------
R2配置
----------------------------------------------------------------
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
!
interface Serial2/0
 ip address 10.1.24.2 255.255.255.0
 serial restart-delay 0
 clock rate 201600
!
interface Serial2/2
 ip address 10.1.12.2 255.255.255.0
 serial restart-delay 0
 clock rate 201600
!
...
!
router eigrp 105
 network 0.0.0.0
 no auto-summary
 eigrp router-id 2.2.2.2
!
router bgp 65104
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 bgp confederation identifier 105
 neighbor 1.1.1.1 remote-as 65104
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 send-community
 neighbor 4.4.4.4 remote-as 65104
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 route-reflector-client
 no auto-summary
!
----------------------------------------------------------------
R1配置
----------------------------------------------------------------
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
...
!
interface Serial2/2
 ip address 10.1.12.1 255.255.255.0
 serial restart-delay 0
!
interface Serial2/3
 ip address 10.1.13.1 255.255.255.0
 serial restart-delay 0
!
...
!
router eigrp 105
 network 0.0.0.0
 no auto-summary
 eigrp router-id 1.1.1.1
!
router bgp 65104
 no synchronization
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 bgp confederation identifier 105
 neighbor 2.2.2.2 remote-as 65104
 neighbor 2.2.2.2 route-reflector-client
 neighbor 3.3.3.3 remote-as 65104
 neighbor 3.3.3.3 route-reflector-client
 neighbor 3.3.3.3 send-community
 no auto-summary
!  
----------------------------------------------------------------
R3配置
----------------------------------------------------------------
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
!
...
!
interface Serial2/0
 ip address 10.1.35.3 255.255.255.0
 serial restart-delay 0
 clock rate 201600
!
interface Serial2/3
 ip address 10.1.13.3 255.255.255.0
 serial restart-delay 0
 clock rate 201600
!
router eigrp 105
 network 0.0.0.0
 no auto-summary
 eigrp router-id 3.3.3.3
!
router bgp 65104
 no synchronization
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
  bgp confederation identifier 105
 bgp confederation peers 65500

 neighbor 1.1.1.1 remote-as 65104
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 5.5.5.5 remote-as 65500
  neighbor 5.5.5.5 ebgp-multihop 2
 neighbor 5.5.5.5 update-source Loopback0
 neighbor 5.5.5.5 send-community
 no auto-summary
!
----------------------------------------------------------------
R5配置
----------------------------------------------------------------
!
interface Loopback0
 ip address 5.5.5.5 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.1.57.5 255.255.255.0
 duplex auto
 speed auto
!
interface Serial2/0
 ip address 10.1.35.5 255.255.255.0
 serial restart-delay 0
!
...
!
router eigrp 105
 network 5.5.5.0 0.0.0.255
 network 10.1.35.0 0.0.0.255
 no auto-summary
 eigrp router-id 5.5.5.5
!
router bgp 65500
 no synchronization
 bgp router-id 5.5.5.5
  bgp log-neighbor-changes
 bgp confederation identifier 105
 bgp confederation peers 65104
 neighbor 3.3.3.3 remote-as 65104
 neighbor 3.3.3.3 ebgp-multihop 2

 neighbor 3.3.3.3 update-source Loopback0
  neighbor 3.3.3.3 next-hop-self
 neighbor 10.1.57.7 remote-as 700
 neighbor 10.1.57.7 send-community
 no auto-summary
!
----------------------------------------------------------------
R7配置
----------------------------------------------------------------
!
interface Loopback0
 ip address 7.7.7.7 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.1.57.7 255.255.255.0
 duplex auto
 speed auto
!
...
!
router bgp 700
 no synchronization
 bgp router-id 7.7.7.7
 bgp log-neighbor-changes
 network 7.7.7.0 mask 255.255.255.0
 neighbor 10.1.57.5 remote-as 105
 no auto-summary
!
----------------------------------------------------------------
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
R6上的信息
----------------------------------------------------------------
R6#show ip bg
BGP table version is 10, local router ID is 6.6.6.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 6.6.1.0/24       0.0.0.0                  0         32768 i
*> 6.6.2.0/24       0.0.0.0                  0         32768 i
*> 6.6.3.0/24       0.0.0.0                  0         32768 i
*> 6.6.4.0/24       0.0.0.0                  0         32768 i
*> 7.7.7.0/24       10.1.46.4                              0 105 700 i
R6#show ip bg 6.6.1.0
BGP routing table entry for 6.6.1.0/24, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1        
  Local
    0.0.0.0 from 0.0.0.0 (6.6.6.6)
      Origin IGP, metric 0, localpref 100, weight 32768, valid, sourced, local, best
R6#show ip bg 6.6.2.0
BGP routing table entry for 6.6.2.0/24, version 3
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1        
  Local
    0.0.0.0 from 0.0.0.0 (6.6.6.6)
      Origin IGP, metric 0, localpref 100, weight 32768, valid, sourced, local, best
----------------------------------------------------------------
R4上的信息
----------------------------------------------------------------
R4#show ip bg
BGP table version is 9, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 6.6.1.0/24       10.1.46.6                0             0 600 i
*> 6.6.2.0/24       10.1.46.6                0             0 600 i
*> 6.6.3.0/24       10.1.46.6                0             0 600 i
*> 6.6.4.0/24       10.1.46.6                0             0 600 i
*>i7.7.7.0/24       5.5.5.5                  0    100      0 (65500) 700 i
R4#show ip bg 6.6.1.0
BGP routing table entry for 6.6.1.0/24, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
  Advertised to update-groups:
     2        
  600
    10.1.46.6 from 10.1.46.6 (6.6.6.6)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: 39321601 no-export
R4#show ip bg 6.6.2.0
BGP routing table entry for 6.6.2.0/24, version 7
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
  Advertised to update-groups:
     2        
  600
    10.1.46.6 from 10.1.46.6 (6.6.6.6)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: 39321602 local-AS
----------------------------------------------------------------
R2上的信息
----------------------------------------------------------------
R2#show ip bg
BGP table version is 5, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*>i6.6.1.0/24       4.4.4.4               6001    100      0 600 i
*>i6.6.2.0/24       4.4.4.4               6002    100      0 600 i
*>i6.6.3.0/24       4.4.4.4                  0    100      0 600 i
*>i7.7.7.0/24       5.5.5.5                  0    100      0 (65500) 700 i
R2#show ip bg 6.6.1.0
BGP routing table entry for 6.6.1.0/24, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
  Advertised to update-groups:
     1        
  600, (Received from a RR-client)
    4.4.4.4 (metric 2297856) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 6001, localpref 100, valid, confed-internal, best
      Community: 39321601 no-export
R2#show ip bg 6.6.2.0
BGP routing table entry for 6.6.2.0/24, version 3
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
  Advertised to update-groups:
     1        
  600, (Received from a RR-client)
    4.4.4.4 (metric 2297856) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 6002, localpref 100, valid, confed-internal, best
      Community: 39321602 local-AS
----------------------------------------------------------------
R1上的信息
----------------------------------------------------------------
R1#show ip bg 
BGP table version is 40, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*>i6.6.1.0/24       4.4.4.4               6001    100      0 600 i
*>i6.6.2.0/24       4.4.4.4               6002    100      0 600 i
*>i6.6.3.0/24       4.4.4.4                  0    100      0 600 i
*>i7.7.7.0/24       5.5.5.5                  0    100      0 (65500) 700 i
R1#show ip bg 6.6.1.0
BGP routing table entry for 6.6.1.0/24, version 38
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
  Advertised to update-groups:
     1        
  600, (Received from a RR-client)
    4.4.4.4 (metric 2809856) from 2.2.2.2 (2.2.2.2)
      Origin IGP, metric 6001, localpref 100, valid, confed-internal, best
      Community: 39321601 no-export
      Originator: 4.4.4.4, Cluster list: 2.2.2.2
R1#show ip bg 6.6.2.0
BGP routing table entry for 6.6.2.0/24, version 39
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
  Advertised to update-groups:
     1        
  600, (Received from a RR-client)
    4.4.4.4 (metric 2809856) from 2.2.2.2 (2.2.2.2)
      Origin IGP, metric 6002, localpref 100, valid, confed-internal, best
      Community: 39321602 local-AS
      Originator: 4.4.4.4, Cluster list: 2.2.2.2
R1#show ip bg 6.6.3.0
BGP routing table entry for 6.6.3.0/24, version 40
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1        
  600, (Received from a RR-client)
    4.4.4.4 (metric 2809856) from 2.2.2.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, confed-internal, best
      Originator: 4.4.4.4, Cluster list: 2.2.2.2
----------------------------------------------------------------
R3上的信息
----------------------------------------------------------------
R3#show ip bg
BGP table version is 28, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*>i6.6.1.0/24       4.4.4.4               6001    100      0 600 i
*>i6.6.2.0/24       4.4.4.4               6002    100      0 600 i
*>i6.6.3.0/24       4.4.4.4                  0    100      0 600 i
*> 7.7.7.0/24       5.5.5.5                  0    100      0 (65500) 700 i
R3#show ip bg 6.6.1.0
BGP routing table entry for 6.6.1.0/24, version 26
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
  Advertised to update-groups:
     2        
  600
    4.4.4.4 (metric 3321856) from 1.1.1.1 (1.1.1.1)
      Origin IGP, metric 6001, localpref 100, valid, confed-internal, best
      Community: 39321601 no-export
      Originator: 4.4.4.4, Cluster list: 1.1.1.1, 2.2.2.2
R3#show ip bg 6.6.2.0
BGP routing table entry for 6.6.2.0/24, version 27
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
  Not advertised to any peer
  600
    4.4.4.4 (metric 3321856) from 1.1.1.1 (1.1.1.1)
      Origin IGP, metric 6002, localpref 100, valid, confed-internal, best
      Community: 39321602 local-AS
      Originator: 4.4.4.4, Cluster list: 1.1.1.1, 2.2.2.2
R3#show ip bg 6.6.3.0
BGP routing table entry for 6.6.3.0/24, version 28
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     2        
  600
    4.4.4.4 (metric 3321856) from 1.1.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, confed-internal, best
      Originator: 4.4.4.4, Cluster list: 1.1.1.1, 2.2.2.2
----------------------------------------------------------------
R5上的信息
----------------------------------------------------------------
R5#show ip bg
BGP table version is 26, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 6.6.1.0/24       4.4.4.4               6001    100      0 (65104) 600 i
*> 6.6.3.0/24       4.4.4.4                  0    100      0 (65104) 600 i
*> 7.7.7.0/24       10.1.57.7                0             0 700 i
R5#show ip bg 6.6.1.0
BGP routing table entry for 6.6.1.0/24, version 24
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
  Not advertised to any peer
  (65104) 600
    4.4.4.4 (metric 3833856) from 3.3.3.3 (3.3.3.3)
      Origin IGP, metric 6001, localpref 100, valid, confed-external, best
      Community: 39321601 no-export
----------------------------------------------------------------
R7上的信息
----------------------------------------------------------------
R7#show ip bg
BGP table version is 25, local router ID is 7.7.7.7
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 6.6.3.0/24       10.1.57.5                              0 105 600 i
*> 7.7.7.0/24       0.0.0.0                  0         32768 i
R7#show ip bg 6.6.3.0
BGP routing table entry for 6.6.3.0/24, version 25
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  105 600
    10.1.57.5 from 10.1.57.5 (5.5.5.5)
      Origin IGP, localpref 100, valid, external, best
----------------------------------------------------------------
=====================================================================
Well-known attributes
1:Well-known mandatory : AS-path,next-hop
2:Well-known discretionary:
Optional attributes
1:Optional transitive
2:Optional nontransitive