BGP Filtering – A nice trick to prevent being used as transit BGP AS

BGP Filtering

BGP Filtering

In dual-homing network scenarios, one of the important features to implement in BGP is to prevent our BGP AS number to be used as a transit AS between two service providers. Although there are a number of methods to perform for example using BGP Communities, etc. One easy approach is to use BGP filtering to achieve this design.

 >> Suppose our AS is 300 and we don’t want BGP AS 200 to use our AS as a transit AS. We are able to accomplish this through the use of an “IP as-path access-list” and by matching the as-path and then filtering it to the desired neighbor by BGP “filter-list”. Below is an example –

>>The syntax of AS-PATH access-list.

 RTC(conf)#ip as-path access-list 13 allow ^$

 Right here ^ is matching the beginning of the string.

Right here $ is matching the end of the string.

>>The syntax of BGP filter-list.

router bgp 300

neighbor[ip address] filter-list 13 out

By doing this, we are only advertising network prefixes originated in local AS which is AS300 to our neighbors AS100 and AS 200. The result of this filter list will be that AS 200 will not be able to use AS 300 to reach AS 100. This is achieved by using filtering primarily based on AS-PATH data. Because the AS-PATH of a prefix was not added when the prefix leaves the AS, prefixes which have been originated inside AS could have an empty AS-PATH. This may be simply matched with a REGULAR EXPRESSION which specifies that the end of the as-path string comes instantly after the beginning of the AS path string and is denoted as ^$.

Let’s check our configuration by the command:-

R1#show ip bgp neighbors [ip address of EBGP Neighbor] advertised-routes

Default image
Afroz Ahmad
My name is Afroz. I am a CCIE, and I have been working in Networking Industry for more than 14 years. Currently, I work as a Network Designer for a large Organization. I write about technical topics and challenges a Network engineer faces in day-to-day life in my blog. I love to teach people, and I believe in the simple concept that teaching makes you a better learner.
Articles: 35

Leave a Reply