Network labs Docs Open simulator →

BGP — expanded community-list with regex match

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

What you will do

  1. On R1, define a route-map that tags outbound prefixes with community 65001:777 and bind it to the eBGP neighbour. (Re-using the pattern from np-bgp-community-tag-and-filter.)

  2. On R2, define an *expanded* community-list ANY-65001 matching ^65001: (any community whose AS-part is 65001).

  3. On R2, define route-map MATCH-65001 permit 10 with match community ANY-65001 and set local-preference 200. Bind inbound to R1.

Open this lab in your browser →

More labs on this topic

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