| 0 comments ]

This post will shows applications of BGP Community.  It doesn't show deep description about BGP Community.  BGP communities are tags, or attributes that can be attached to BGP prefixes announcement.  Based on that community, policy can be define to do something to that routes.  BGP Communities are descibed in RFC 1997.  According to RFC 1997, BGP Communities describe as a group of destinations which share some common property.  Each autonomus system administrator may define which communities a destination belongs to.  By default, all destinations belong to the general Internet community.  BGP Community have 32 bit value.

BGP communities can be used to influence routes.  Based on BGP Communities attached, administrator can prepend as-path, add local preference, or another policy, to prefix that received.  Also, if adminsitrator knows communities value, or have aggreement with upstream, administrator can set some communities value to influence routes at the upstream.

Applications of BGP Communities
If you want to define policy based on community value, the first thing to do is add community value to routes or prefixes.  Then in the receiver router, set policy for routes or prefixes that have community.  In IOS, you must set neighbor send-community in order BGP speaker include community in routes announcement.

Example

AS 65000 want set community for their customers prefixes to control routes advertisement.  Community value 65000:1 will be prepended twice when adevrtise to Telia, and community value 65000:2 will be prepended twice when advertised to Sprint.  Router A is router that connected to customer, and router B is router that connected to upstream.
In router A, you configure policy to set community 65000:1 or 65000:2.  In router B, you configure policy to prepend as-path based on community.

In Cisco router

Router A Configuration

router bgp 65000
neighbor 10.1.1.1 remote-as 65000
neighbor 10.1.1.1 description To_Border_Router_B
neighbor 10.1.1.1 send-community both
neighbor 10.1.1.1 update-source loopback0
neighbor 172.16.1.2 remote-as 65001
neighbor 172.16.1.2 description To_Cust_X
neighbor 172.16.1.2 route-map SET_COM_TELIA in
neighbor 172.16.1.4 remote-as 65002
neighbor 172.16.1.4 description To_Cust_Y
neighbor 172.16.1.2 route-map SET_COM_SPRINT in

route-map SET_COM_TELIA permit 10
set community 65000:1

route-map SET_COM_SPRINT permit 10
set community 65000:2

Router B Configuration

router bgp 65000
neighbor 10.1.1.2 remote-as 65000
neighbor 10.1.1.2 description To_Edge_Router_A
neighbor 10.1.1.2 send-community both
neighbor 10.1.1.2 update-source loopback0
neighbor 192.168.1.2 remote-as 1299
neighbor 192.168.1.2 description To_Telia
neighbor 192.168.1.2 send-community both
neighbor 192.168.1.2 route-map TO_TELIA out
neighbor 192.168.1.4 remote-as 1239
neighbor 192.168.1.4 description To_Sprint
neighbor 192.168.1.4 send-community both
neighbor 192.168.1.4 route-map TO_SPRINT out

route-map TO_TELIA permit 10
match community 65000:1
set as-path prepend 65000
route-map TO_TELIA permit 15

route-map TO_SPRINT permit 10
match community 65000:2
set as-path prepend 65000
route-map TO_SPRINT permit 15

In Juniper router

Router A

[edit]
protocols {
bgp {
group Customer {
type external;
neighbor 172.16.1.1 {
description Cust_X;
import SET_TELIA
peer-as 65001;
}
neighbor 172.16.1.2 {
description Cust_Y;
import SET_TELIA
peer-as 65002;
}
}
policy-option {
policy-statement SET_TELIA {
then {
community add TELIA;
accept;
}
}
policy-option SET_SPRINT {
then {
community add SPRINT;
accept;
}
}
community TELIA members 65000:1;
community SPRINT members 65000:2;
}

Router B

[edit]
protocols {
bgp {
group Upstream {
type external;
neighbor 192.168.1.2 {
description Telia;
export TO_TELIA
peer-as 1299;
}
neighbor 192.168.1.4 {
description Sprint;
export TO_SPRINT
peer-as 1239;
}
}
policy-option {
policy-statement TO_TELIA {
term 2 {
from community TELIA;
then {
as-path-prepend "65000";
accept;
}
}
term 2 {
then accept;
}
}
policy-statement TO_SPRINT {
term 1 {
from community SPRINT;
then {
as-path-prepend "65000";
accept;
}
}
term 2 {
then accept;
}
}
community TELIA members 65000:1;
community SPRINT members 65000:2;
}

Reference:
http://tools.ietf.org/rfc/rfc1997.txt

0 comments

Post a Comment