Configuring Border Gateway Protocol (BGP) Communities
A BGP community is a group of prefixes that share some common property and can be configured with the BGP community attribute. The BGP Community attribute is an optional transitive attribute of variable length. The attribute consists of a set of four octet values that specify a community. The community attribute values are encoded with an Autonomous System (AS) number in the first two octets, with the remaining two octets defined by the AS. A prefix can have more than one community attribute. A BGP speaker that sees multiple community attributes in a prefix can act based on one, some or all the attributes. A router has the option to add or modify a community attribute before the router passes the attribute on to other peers.
The local preference attribute is an indication to the AS which path is preferred in order to reach a certain network. When there are multiple paths to the same destination, the path with the higher preference is preferred (the default value of the local preference attribute is 100).
Common Community Attributes
- Standard (well known) — These community attributes are 4 octets long, with well known values
- Internet (0) — advertise these routes to all neighbors.
- no-export (0xFFFFFF01) — do not advertise to outside a BGP confederation boundary.
- no-advertise (0xFFFFFF02) — do not advertise to other BGP peers .
- local-AS (0xFFFFFF03) — do not advertise to external BGP peers.
- Standard - generic (AS:value) — These community attributes are also 4 octet long, but values can be really generic. The first 16-bit number is normally the AS number of the network that sets the community or looks for it, and the second number is one that conveys the intended information, for example: 65001:100.
For example to set the community attribute, no-export, to all route prefixes matching prefix subnet100, use the following syntax:
CLI (network-admin@Leaf1) > vrouter-route-map-add vrouter-name vr1 name rmap1 seq 10 action permit match-prefix subnet100 community-attribute no-export
To set the community attribute, 65002:200 to all route prefixes matching prefix subnet100, use the following syntax:
CLI (network-admin@Leaf1) > vrouter-route-map-add vrouter-name vr1 name peer vr2 action permit seq 20 match-prefix subnet99 community-attribute-generic 65002:200
Community Lists
BGP community list is a user defined BGP communities attribute list. The BGP community list can be used for matching or manipulating BGP communities attribute in updates. This is used on the receive side of the BGP updates to match what is set in the received updates. Community lists can be used in route-map with match-community keyword to apply any policy on the receive side.
- Standard — Standard community list defines attribute which matches standard communities as defined above (well known or generic).
To set the community list permitting the community value 300 for AS 65002, use the following syntax:
CLI (network-admin@Leaf1) > vrouter-community-list-add vrouter-name vr2 style standard name clist300 action permit community-attribute 65002:300
The Netvisor One commands for vrouter-route-maps-* support additional parameters for BGP communities:
CLI (network-admin@Leaf1) > vrouter-route-map-add
match-community match-community-string |
Specify the community string to match. (BGP only) |
exact-match|no-exact-match |
Specify if the community string is an exact match or not. (BGP only) |
community-attribute-generic community-attribute-generic-string |
Specify a generic community attribute such as AA:NN. (BGP only) |
additive|no-additive |
Specify if a given community is appended to existing communities value. |
comm-list-del vrouter community-list name |
Specify if you want to remove community values from BGP community attributes. |
New commands support creating BGP Communities:
CLI (network-admin@Leaf1) > vrouter-community-list-add
vrouter-name name-string |
Specify a vRouter to add the community list. |
Add the following community list parameters: |
|
style standard |
Specify the style of the community list. |
name name-string |
Specify a name for the community list. |
action permit|deny |
Specify the action for the community list. |
community-attribute community-attribute-string |
Specify the community attribute. |
CLI (network-admin@Leaf1) > vrouter-community-list-remove
vrouter-name name-string |
Specify a vRouter to remove the community list. |
Add the following community list parameters: |
|
style standard |
Specify the style of the community list. |
name name-string |
Specify a name for the community list. |
action permit|deny |
Specify the action for the community list. |
community-attribute community-attribute-string |
Specify the community attribute. |
CLI (network-admin@Leaf1) > vrouter-community-list-show
vrouter-name name-string |
Displays the vRouter name. |
Add the following community list parameters: |
|
style standard |
Displays the style of the community list. |
name name-string |
Displays a name for the community list. |
action permit|deny |
Displays the action for the community list. |
community-attribute community-attribute-string |
Displays the community attribute. |