BGP的community社團屬性
標準Community社團屬性----鄰居之間一定要開啟傳輸社團屬性
R2#show run | s route-map
route-map aa permit 10
match ip address 1
set community internet 全網都可以傳遞
route-map aa permit 20
match ip address 2
set community local-AS 不能傳出小AS
route-map aa permit 30
match ip address 3
set community no-advertise 不能傳遞給任何鄰居
match ip address 4
set community no-export 不能傳出大AS
route-map aa permit 50
R2#show access-lists
Standard IP access list 1
10 permit 200.1.1.0
Standard IP access list 2
10 permit 200.1.2.0
Standard IP access list 3
10 permit 200.1.3.0
Standard IP access list 4
10 permit 200.1.4.0
R2(config)#router bgp 23
R2#show ip bgp 200.1.1.0
BGP routing table entry for 200.1.1.0/24, version 19
Paths: (1 available, best #1, table default)
Advertised to update-groups:
2
Refresh Epoch 13
1
12.1.1.1 from 12.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
R3#show ip bgp 200.1.1.0
BGP routing table entry for 200.1.1.0/24, version 6
Paths: (1 available, best #1, table default)
Advertised to update-groups:
2
Refresh Epoch 9
1
2.2.2.2 (metric 65) from 2.2.2.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, confed-internal, best
R2(config)#router bgp 23
R2(config-router)#neighbor 3.3.3.3 send-community both
R3(config)#router bgp 23
R3(config-router)#neighbor 4.4.4.4 send-community both
R4(config)#
R4(config)#router bgp 4
R4(config-router)#neighbor 45.1.1.2 send-community
% Specify remote-as or peer-group commands first 一定要指定好對端的IP地址
R4(config-router)#neighbor 45.1.1.5 send-community both 開啟社團屬性
R2#show ip bgp 200.1.1.0
BGP routing table entry for 200.1.1.0/24, version 19
Paths: (1 available, best #1, table default)
Advertised to update-groups:
4
Refresh Epoch 15
1
12.1.1.1 from 12.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: internet
R3#show ip bgp 200.1.1.0
BGP routing table entry for 200.1.1.0/24, version 17
Paths: (1 available, best #1, table default)
Advertised to update-groups:
4
Refresh Epoch 11
1
2.2.2.2 (metric 65) from 2.2.2.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, confed-internal, best
Community: internet
R4#show ip bgp 200.1.1.0
BGP routing table entry for 200.1.1.0/24, version 15
Paths: (1 available, best #1, table default)
Advertised to update-groups:
3
Refresh Epoch 1
(23) 1
2.2.2.2 (metric 129) from 3.3.3.3 (3.3.3.3)
Origin IGP, metric 0, localpref 100, valid, confed-external, best
Community: internet
R5#show ip bgp 200.1.1.0
BGP routing table entry for 200.1.1.0/24, version 17
Paths: (1 available, best #1, table default)
Not advertised to any peer
Refresh Epoch 1
100 1
45.1.1.4 from 45.1.1.4 (4.4.4.4)
Origin IGP, localpref 100, valid, external, best
Community: internet
R3#show ip bgp
BGP table version is 17, 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, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
>i 1.1.1.1/32 2.2.2.2 0 100 0 1 i
> 5.5.5.5/32 4.4.4.4 0 100 0 (4) 5 i
>i 200.1.1.0 2.2.2.2 0 100 0 1 i
>i 200.1.2.0 2.2.2.2 0 100 0 1 i
>i 200.1.4.0 2.2.2.2 0 100 0 1 i
R4#show ip bgp
BGP table version is 17, 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, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.1/32 2.2.2.2 0 100 0 (23) 1 i
> 5.5.5.5/32 45.1.1.5 0 0 5 i
> 200.1.1.0 2.2.2.2 0 100 0 (23) 1 i
> 200.1.4.0 2.2.2.2 0 100 0 (23) 1 i
R5#show ip bgp
BGP table version is 17, 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, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.1/32 45.1.1.4 0 100 1 i
> 5.5.5.5/32 0.0.0.0 0 32768 i
> 200.1.1.0 45.1.1.4 0 100 1 i
擴展community屬性----鄰居之間一定要開啟傳輸社團屬性
R2(config)#router bgp 23
R2(config-router)# neighbor 12.1.1.1 route-map aa in
R2(config-route-map)#set community 100000
R2#show ip bgp 200.1.1.0
BGP routing table entry for 200.1.1.0/24, version 16
Paths: (1 available, best #1, table default)
Advertised to update-groups:
2
Refresh Epoch 5
1
12.1.1.1 from 12.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: internet 100000
R2(config)#ip bgp-community new-format
R2(config)#exit
Apr 9 17:06:06.826: %SYS-5-CONFIG_I: Configured from console by console
R2#show ip bgp 200.1.1.0
BGP routing table entry for 200.1.1.0/24, version 16
Paths: (1 available, best #1, table default)
Advertised to update-groups:
2
Refresh Epoch 7
1
12.1.1.1 from 12.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: internet 1:34464
BGP的community社團屬性