You can actually understand the community attribute as the route tag of BGP. Routes in OSPF and ISIS can be tagged. BGP does not use Tags. Instead, the group attribute is used. The community attribute refers to a type of routes with the same nature, which facilitates filtering of a large number of identical routes. Or routing policy control.
Group attribute filtering experiment
You can actually understand the community attribute as the route tag of BGP. Routes in OSPF and ISIS can be tagged. BGP does not use Tags. Instead, the group attribute is used.
The community attribute refers to a type of routes with the same nature, which facilitates filtering of a large number of identical routes. Or routing policy control.

The Community attribute is an optional transition attribute and is a routing tag used to simplify the execution of routing policies.

[R1]ip ip-prefix comm permit 192.168.1.1 32
[R1]ip ip-prefix comm2 permit 192.168.2.1 32
[R1]route-policy lo1 permit node 10
[R1-route-policy]if-match ip-prefix comm
[R1-route-policy]apply community 100:11
[R1]route-policy lo1 permit node 20
[R1-route-policy]if-match ip-prefix comm2
[R1-route-policy]apply community 100:21
[R1-bgp]import-route direct route-policy lo1
[R1-bgp]peer 12.1.1.2 advertise-community //Community attributes need to be manually enabled for sending, and are not sent by default.
<R2>dis bgp routing-table 192.168.2.1 32 //Check the group attribute in a specific route
BGP local router ID : 23.1.1.2
Local AS number : 200
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of 192.168.2.1/32:
From: 12.1.1.1 (12.1.1.1)
Route Duration: 00h00m09s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 12.1.1.1
Qos information : 0x0
Community:<100:21>
AS-path 100, origin incomplete, MED 0, pref-val 0, valid, external, best, selec
t, active, pre 255
Advertised to such 2 peers:
23.1.1.3
12.1.1.1
<R2>dis bgp routing-table community 100:11 //You can individually view the routes of a community group in a community attribute
BGP Local router ID is 23.1.1.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Community
*> 192.168.1.1/32 12.1.1.1 0 0 <100:11>
You can add the neighbor community attribute to the route route to transition the attribute, otherwise it will not be passed.
[R2-bgp]peer 23.1.1.3 advertise-community
[R2]ip community-filter 1 deny 100:11
[R2]ip community-filter 1 permit 100:21
[R2]dis ip community-filter //View community filter entries
Community filter Number: 1
deny 100:11
permit 100:21
[R2]route-policy name permit node 10
[R2-route-policy]if-match community-filter 1
[R2-bgp]peer 23.1.1.3 route-policy name export
//You can see on R3 that 100:11 is filtered out and only the 100:21 route of 192.168.2.1 is available. But the community attribute disappears. To see the community attribute on R3, you need to add it on the bgp neighbor.
federal experiment
[R1]bgp 100
[R1-bgp]peer 12.1.1.2 as-number 200
[R2]bgp 64512
[R2-bgp]confederation id 200 //Configure federation id
[R2-bgp]peer 3.3.3.3 as-number 64512
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R2-bgp]peer 3.3.3.3 next-hop-local
[R3]bgp 64512
[R3-bgp]confederation id 200 //Configure federation id
[R3-bgp]confederation peer-as 64513 //Configure the AS number of federated EBGP
[R3-bgp]peer 2.2.2.2 as-number 64512
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3-bgp]peer 2.2.2.2 next-hop-local
[R3-bgp]peer 4.4.4.4 as-number 64513
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R3-bgp]peer 4.4.4.4 ebgp-max-hop
[R3-bgp]peer 4.4.4.4 next-hop-local
[R4]bgp 64513
[R4-bgp]confederation id 200 //Configure federation id
[R4-bgp]confederation peer-as 64512 //Configure the AS number of federated EBGP
[R4-bgp]peer 3.3.3.3 as-number 64512
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R4-bgp]peer 3.3.3.3 ebgp-max-hop
[R4-bgp]peer 3.3.3.3 next-hop-local
[R4-bgp]peer 45.1.1.5 as-number 300
[R5]bgp 300
[R5-bgp]peer 45.1.1.4 as-number 200
Internal AS static interconnection
[R2]ip route-static 3.3.3.3 32 23.1.1.3
[R3]ip route-static 2.2.2.2 32 23.1.1.2
[R3]ip route-static 4.4.4.4 32 34.1.1.4
[R4]ip route-static 3.3.3.3 32 34.1.1.3
[R4]ip route-static 2.2.2.2 32 34.1.1.3
R1 creates a direct connection and introduces BGP
[R1-LoopBack2]ip address 11.11.11.111 32
[R1-bgp]network 11.11.11.111 32
[R3]dis bgp peer //Check the BGP confederation peers: the sessions are established! !
BGP local router ID : 23.1.1.3
Local AS number : 64512
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
2.2.2.2 4 64512 6 5 0 00:03:07 Established
1
4.4.4.4 4 64513 4 6 0 00:02:37 Established
0
[R4]dis bgp routing-table
BGP Local router ID is 45.1.1.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 11.11.11.111/32 2.2.2.2 0 100 0 (64512) 10
0i
<R5>dis bgp routing-table
BGP Local router ID is 45.1.1.5
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 11.11.11.111/32 45.1.1.4 0 200 100i