By default, BGP will advertise all prefixes to its EBGP neighbors. If you are multi-homed environment (Two ISP's connected), that you might become a transit AS.
Consider the below topology where R3 is connected to R1 (ISP_1) and R2 (ISP_2)
Since, R3 is connected to two ISP's, it’s possible that the ISPs will use R3 to reach each other. In order to prevent this we’ll have to ensure that R3 only advertises prefixes from its own autonomous system.
There are 4 ways to prevent Transit AS:
- Prefix-list Filtering
- Distribute-list Filtering
- Filter-list with AS PATH access-list.
- No-Export Community
Now in this session we are going to look into Prefix-list prevention.
R1 Interface configuration:
ISP-1#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.13.1 YES NVRAM up up
FastEthernet0/1 unassigned YES NVRAM administratively down down
Loopback0 1.1.1.1 YES NVRAM up up
ISP-1#
R2 Interface configuration:
ISP-2#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.23.2 YES NVRAM up up
FastEthernet0/1 unassigned YES NVRAM administratively down down
Loopback0 2.2.2.2 YES NVRAM up up
ISP-2#
R3 Interface configuration:
R3#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.13.3 YES NVRAM up up
FastEthernet0/1 192.168.23.3 YES NVRAM up up
Loopback0 3.3.3.3 YES NVRAM up up
R3#
ISP 1 - R1 BGP Configuration:
ISP-1#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
ISP-1(config)#router bgp 1
ISP-1(config-router)#neighbor 192.168.13.3 remote-as 65000
ISP-1(config-router)#redistribute connected
ISP-1(config-router)#end
ISP-1#
ISP 2- R2 BGP Configuration:
ISP-2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
ISP-2(config)#router bgp 2
ISP-2(config-router)#neighbor 192.168.23.3 remote-as 65000
ISP-2(config-router)#redistribute connected
ISP-2(config-router)#end
ISP-2#
R3 BGP Configuration:
R3#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router bgp 65000
R3(config-router)#neighbor 192.168.13.1 remote-as 1
R3(config-router)#neighbor 192.168.23.2 remote-as 2
R3(config-router)#redistribute connected
R3(config-router)#end
R3#
When you look at the BGP table of R1, you can see the network 2.2.2.2/32 is learned which is from the AS_2 (ISP_2) through the router R3.
Now, I am going to create a prefix list in R3 that matches only the loopback interface (3.3.3.3/32) and map it to the bgp configuration in R3.
Creating a prefix-list:
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#ip prefix-list TEST-PREFIX permit 3.3.3.3/32
R3(config)#end
R3#
You can view the configured prefix list using the below command:
R3#show ip prefix-list
ip prefix-list TEST-PREFIX: 1 entries
seq 5 permit 3.3.3.3/32
R3#
R3#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router bgp 65000
R3(config-router)#neighbor 192.168.13.1 prefix-list TEST-PREFIX out
R3(config-router)#neighbor 192.168.23.2 prefix-list TEST-PREFIX out
R3(config-router)#end
R3#
R3 BGP Configuration:
R3#show running-config | section router bgp
router bgp 65000
no synchronization
bgp log-neighbor-changes
redistribute connected
neighbor 192.168.13.1 remote-as 1
neighbor 192.168.13.1 prefix-list TEST-PREFIX out
neighbor 192.168.23.2 remote-as 2
neighbor 192.168.23.2 prefix-list TEST-PREFIX out
no auto-summary
R3#
You need to clear the BGP session to take the newly applied configuration to take effect.
In-order to clear the bgp session, use the command "clear ip bgp * soft in"
Now on looking in to the BGP table of R1(ISP_1), 2.2.2.2/32 will be removed and only 3.3.3.3/32 will only be available because this is the only network advertised through prefix-list.
You can also look in to my video tutorial in tamil:
Post a Comment
Post a Comment