This article provides information on how to export the BGP community attribute to routes that are being advertised to a BGP neighbor.
How to add the BGP community attribute to the routes that are being advertised to a BGP neighbor.
Two eBGP neighbors - 1.1.1.1 and 1.1.1.2 are present. The community attribute has to be added to the routes that are being exported from 1.1.1.1 to 1.1.1.2 . Before making the changes, the routes that are being received on 1.1.1.2 from 1.1.1.1 are as follows:
[edit] root@3400-2# run show route receive-protocol bgp 1.1.1.1 detail inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden) * 3.3.3.3/32 (1 entry, 1 announced) Accepted Nexthop: 1.1.1.1 AS path: 2 I * 4.4.4.4/32 (1 entry, 1 announced) Accepted Nexthop: 1.1.1.1 AS path: 2 I
[edit] root@240-2# show policy-options policy-statement p1 { term t1 { from { protocol static; route-filter 3.3.3.3/32 exact; } then { community add test-1; accept; } } term t2 { from { protocol static; route-filter 4.4.4.4/32 exact; } then { community add test-2; accept; } } term t3 { then reject; } } community test-1 members 1:2; community test-2 members 1:3;
[edit] root@240-2# show protocols bgp group g1 { export p1; peer-as 1; local-as 2; neighbor 1.1.1.2; }
root@3400-2# run show route receive-protocol bgp 1.1.1.1 detail inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) * 3.3.3.3/32 (1 entry, 1 announced) Accepted Nexthop: 1.1.1.1 AS path: 2 I Communities: 1:2 * 4.4.4.4/32 (1 entry, 1 announced) Accepted Nexthop: 1.1.1.1 AS path: 2 I Communities: 1:3