There is a way to tag a route advertisements with additional information. you can tag route using bgp communities. A community defines a property of a prefix, in such a way that a router can be configured to treat all prefixes with a certain community in a certain way, for example, to give those a higher preference. This way, one does not have to build an access list to match all the prefixes explicitly. A prefix can be tagged with multiple communities, and a community can be attached to multiple prefixes.RFC1997 gives you more details on BGP communities.
Most important communities are NO_ADVERTISE and NO_EXPORT, indicating that a prefix should not be re-advertised beyond the router or the autonomous system receiving the prefix respectively. The latter is useful if you want to announce a more-specific prefix to one of your upstreams without polluting the global routing table.
One application of communities is described in RFC 1998. This RFC describes a scenario in which two ISPs provide each other with backup connectivity. Using communities, they can tag the prefixes for which they provide backup routing. The upstream provider can then apply a lower local preference to these routes so that in the normal case traffic is not routed via the backup path. Of course, this assumes some cooperation of the upstream provider, but the level of cooperation is less than would be required if the usptream provider would have to create explicit access lists for the prefixes or ASes involved.
WARNING: Setting the
no-export-subconfed communities can have the (possibly unwanted) side effect that no routes are announced, even if there are other routes that would otherwise be eligible for announcement.
For instance, if we have 2 ISP's ISP A and ISP B,if you set the
no-advertise community on routes announced to ISP B, other customers of ISP Bwon't see these routes because they aren't advertised. This is as intended. But routes with the same NLRI that ISP B has learned from ISP A will not be advertised either, because ISP B considers the directly received routes with the
no-advertise community best, and only the best route is eligible for further announcement over BGP.