BGP — expanded community-list with regex match
- Routing
- Intermediate
- 12 min
- 3 steps
- Cisco IOS-style
Standard community-lists do exact-value matching. Expanded community-lists let you regex-match against the printed <asn>:<n> form — useful for "match any community starting with 65001:". Demonstrate by tagging a prefix with 65001:777, defining an expanded list ^65001:, and verifying the tagged prefix matches.
Open this lab in your browser →
Free · no install · no account
Scenario
Two community-list flavours: | Type | Match form | Use case | | --- | --- | --- | | standard | exact value (e.g. 65001:100) | "permit if community is exactly X" | | expanded | regex over the printed string | "permit if community is 65001:*" | Expanded matches against the COMMUNITIES attribute rendered as a space-separated <asn>:<n> string — 65001:100 65001:200 for a prefix carrying both. Anchor with ^ / $; use \b for word boundaries. netverdict deviation from real Cisco: real IOS treats _ as a boundary metacharacter (matches space, comma, start, end). netverdict uses JavaScript's RegExp verbatim — use \b for boundaries instead. In this lab R1 tags 192.168.1.0/24 with 65001:777. R2 defines an expanded list ^65001: and confirms the prefix matches.
Topology
2 × router · Cisco IOS-style
R1— routerR2— router
What you will do
On R1, define a route-map that tags outbound prefixes with community
65001:777and bind it to the eBGP neighbour. (Re-using the pattern fromnp-bgp-community-tag-and-filter.)On R2, define an *expanded* community-list
ANY-65001matching^65001:(any community whose AS-part is 65001).On R2, define
route-map MATCH-65001 permit 10withmatch community ANY-65001andset local-preference 200. Bind inbound to R1.
Open this lab in your browser →
More labs on this topic
- Syntax delta — static route (Extreme EXOS)Beginner · 4 min
- Syntax delta — static route (Cisco IOS)Beginner · 4 min
- Syntax delta — static route (Juniper Junos)Beginner · 5 min
- Syntax delta — static route (VyOS)Beginner · 5 min
- Static routes — fix hub-and-spokeBeginner · 12 min
- Static routes — egress-interface form (point-to-point)Beginner · 8 min
This lab in other languages
BGP — expanded Community-List mit Regex-MatchBGP — community-list expandida con regexBGP — community-list expandida com match regexBGP — community-list expanded avec match regexBGP — regex match के साथ expanded community-listBGP — 使用正则匹配的 expanded community-listBGP — community-list expanded con match regexBGP — 正規表現マッチ付き expanded community-listBGP — 정규식 매치를 가진 expanded community-listBGP — expanded community-list с regex-совпадениемBGP — regex eşleşmeli expanded community-listBGP — community-list expanded khớp regex