A BGP community is a group of destinations that share some common property. A
community is not restricted to one network or one autonomous system; it has no
physical boundaries. An example is a group of networks that belong to the
educational or government communities. These networks can belong to any AS.
Communities are used to simplify routing policies by identifying routes based on
a logical property rather than an IP prefix or an AS number. A BGP speaker can
use this attribute in conjunction with other attributes to control which routes
to accept, prefer, and pass on to other BGP neighbors.
The community attribute (type code 8) is an optional transitive attribute
that is of variable length and consists of a set of 4-byte values. Communities
in the range 0x00000000 through 0x0000FFFF and 0xFFFFF0000 through 0xFFFFFFFF
are reserved. These communities are well known-that is, they have a global
meaning. Examples of well-known communities follow:
NO_EXPORT (0xFFFFFF01) -- A route carrying this community value should not be
advertised to peers outside a confederation (or the AS if it is the only AS in
the confederation).
NO_ADVERTISE (0xFFFFFF02) -- A route carrying this community value, when
received, should not be advertised to any BGP peer.
Besides well-known community attributes, private community attributes can be
defined for special uses. A common practice is to use the first two bytes of the
community attribute for the AS number and the last two bytes to define a value
in relation to that AS. A provider (AS256, for example), who wants to define a
private community called "my-peer-routers" could use the community
256:1 represented in a decimal notation. The number 256 indicates that this
provider has defined the community, and the 1 has special meaning to the
provider; in this case it is "my-peer-routers."
A route can have more than one community attribute. A BGP speaker that sees
multiple community attributes in a route can act based on one, some, or all the
attributes. A router has the option of adding or modifying community attributes
before passing routes on to other peers. The figure shows a simple use of the
community attribute. XNET is sending toward YNET routes X and Y with a NO_EXPORT
community attribute, and route Z with no modification. The BGP router in YNET
will propagate route Z only toward ZNET. Routes X and Y will not be propagated
because of the NO_EXPORT community attribute.