[Xorp-hackers] BGP community support

Marko Zec zec@icir.org
Wed, 3 Aug 2005 17:28:28 +0200


On Wednesday 03 August 2005 03:32, Ratul Mahajan wrote:
> hi -
>
> from the user manual
>    "We also have limited support for:
>       RFC 1997: BGP Communities Attribute."
>
> could someone briefly tell me what support is currently available?


Hi Ratul,

the current code from CVS includes a more or less functional policy 
framework, which among other things allows one to look at the community 
attributes.  Based on a received community tag, one can decide to 
accept or reject the route, or change some of its attributes, including 
the communities themselves.

As an example, the following config will match all the inbound routes 
that are tagged with both the communities 65000:1 and 65000:2, on such 
routes remove the 65000:2 tag, set the localpref value to 1001, and 
accept the route.

protocols {
    bgp {
...
        import: "bgp-in"
    }
}

policy {
    policy-statement bgp-in {
	term a {
	    from {
		community >= "65000:1,65000:2"
	    }
	    then {
		community-del: "65000:2"
		localpref = 1001
		accept
	    }
	}
    }
}

Another example - unconditionally set community tags to 
65001:101,NO_EXPORT on all received routes:

policy {
    policy-statement bgp-in {
	term a {
	    then {
		community = "65001:101,NO_EXPORT"
		accept
	    }
	}
    }
}

Hope this helps,

Marko