BGP Allowas-in
Let’s understand Allowas-in configuration in BGP. BGP routers use AS attribute feature for loop prevention mechanism which prompts them to check if their own AS is anywhere in the path.
If their AS number is seen in the path, the prefix is rejected (since BGP senses a loop).
Below scenario will help understand the default behaviour of BGP to drop prefix learned via same AS in the path and how to mitigate this condition (using “Allowas-in” where prefix coming from same AS in path may be required not to be dropped.
Related- BGP Confederation
Below is the base configuration on R1,R2 and R3 where R1 and R3 are in same AS = 1 and R2 is in AS = 2.All the Routers form eBGP neighborship.
Loopback of Each Router is advertised in BGP to its neighbor.
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
router bgp 1
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
network 192.168.12.0
neighbor 192.168.12.2 remote-as 2
neighbor 192.168.12.2 soft-reconfiguration inbound
no auto-summary
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.23.2 255.255.255.0
!
router bgp 2
no synchronization
bgp log-neighbor-changes
network 2.2.2.0 mask 255.255.255.0
network 192.168.12.0
network 192.168.23.0
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.12.1 soft-reconfiguration inbound
neighbor 192.168.23.3 remote-as 1
neighbor 192.168.23.3 soft-reconfiguration inbound
no auto-summary
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
!
router bgp 1
no synchronization
bgp log-neighbor-changes
network 3.3.3.0 mask 255.255.255.0
network 192.168.23.0
neighbor 192.168.23.2 remote-as 2
neighbor 192.168.23.2 soft-reconfiguration inbound
no auto-summary
Once the eBGP neighborship is up between the Routers, next lets see the bgp Routes learned by R3 using “show ip bgp” command –
BGP table version is 8, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incompleteNetwork Next Hop Metric LocPrf Weight Path
*> 2.2.2.0/24 192.168.23.2 0 0 2 i
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 192.168.12.0 192.168.23.2 0 0 2 i
* 192.168.23.0 192.168.23.2 0 0 2 i
*> 0.0.0.0 0 32768 i
R3#
As seen above , R3 is not learning Loopback of R1 (1.1.1.1/24) since its coming from same AS number ie AS 1. R3 will see the prefix of nework 1.1.1.0/24 and seeing the AS path contains its same AS ie 1 , will drop the route.
In order to allow same AS prefix to be received from eBGP neighbor and installed in BGP table, “Allowas-in” command will be issued on R3 towards R2 as below –
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router bgp
R3(config-router)#neighb 192.168.23.2 allowas-in
Once the command is issued, R3 is now able to install route for 1.1.1.0/24 network in its BGP table as below –
BGP table version is 9, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incompleteNetwork Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 192.168.23.2 0 2 1 i
*> 2.2.2.0/24 192.168.23.2 0 0 2 i
* 3.3.3.0/24 192.168.23.2 0 2 1 i
*> 0.0.0.0 0 32768 i
*> 192.168.12.0 192.168.23.2 0 0 2 i
* 192.168.23.0 192.168.23.2 0 0 2 i
*> 0.0.0.0 0 32768 i
Hope this document helped the viewers. Thanks a lot all !!!
Continue Reading:
Are you Preparing for your Next Job Interview?
If you want to learn more about Linux, then check our e-book on BGP Interview Questions in easy to understand PDF Format explained with relevant Diagrams (where required) for better ease of understanding.
ABOUT THE AUTHOR
I am here to share my knowledge and experience in the field of networking with the goal being – “The more you share, the more you learn.”
I am a biotechnologist by qualification and a Network Enthusiast by interest. I developed interest in networking being in the company of a passionate Network Professional, my husband.
I am a strong believer of the fact that “learning is a constant process of discovering yourself.”
– Rashmi Bhardwaj (Author/Editor)