By default, we only advertise the subnet 50.50.50.0/24 to ISP1 and if the subnet 20.20.20.0/24 disappears, we announce it also to ISP2. We can typically use this feature when ISP2 is more expensive than ISP1.
- Configuration:
R1:
interface Loopback50
ip address 50.50.50.50 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.50.1 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.150.1 255.255.255.0
!
router bgp 50
network 50.50.50.0 mask 255.255.255.0
neighbor 192.168.50.2 remote-as 100
neighbor 192.168.150.3 remote-as 200
neighbor 192.168.150.3 advertise-map NOT_ANNOUNCE_R3 non-exist-map ADVERTISE
!
ip prefix-list LO20 seq 5 permit 20.20.20.0/24
!
ip prefix-list LO50 seq 5 permit 50.50.50.0/24
!
route-map NOT_ANNOUNCE_R3 permit 10
match ip address prefix-list LO50
!
route-map ADVERTISE permit 10
match ip address prefix-list LO20
R2:
interface Loopback20
ip address 20.20.20.20 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.50.2 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.100.2 255.255.255.0
!
router bgp 100
network 20.20.20.0 mask 255.255.255.0
neighbor 192.168.50.1 remote-as 50
neighbor 192.168.100.3 remote-as 200
R3:
interface Ethernet0/0
ip address 192.168.100.3 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.200.3 255.255.255.0
!
interface Ethernet0/2
ip address 192.168.150.3 255.255.255.0
!
router bgp 200
neighbor 192.168.100.2 remote-as 100
neighbor 192.168.150.1 remote-as 50
- Initial behavior:
R3 sees subnet 50.50.50.0/24 only from R3
R3#sho ip bgp
Network Next Hop Metric LocPrf Weight Path
* 20.20.20.0/24 192.168.150.1 0 50 100 i
*> 192.168.100.2 0 0 100 i
*> 50.50.50.0/24 192.168.100.2 0 100 50 i
We can check that R1 is not advertising the subnet to R3:
R1#sho ip bgp neighbors 192.168.150.3 advertised-routes
Network Next Hop Metric LocPrf Weight Path
*> 20.20.20.0/24 192.168.50.2 0 0 100 i
R1#sho ip bgp neighbors 192.168.50.2 advertised-routes
Network Next Hop Metric LocPrf Weight Path
*> 50.50.50.0/24 0.0.0.0 0 32768 i
R1#sho ip bgp neighbors 192.168.150.3 | in Conditio
Condition-map ADVERTISE, Advertise-map NOT_ANNOUNCE_R3, status: Withdraw
- Now the subnet 20.20.20.0/24 is removed from the routing table:
R2#int lo20
shut
We can check that R1 is now advertising the subnet to R3:
R1#sho ip bgp neighbors 192.168.150.3 | in Conditio
Condition-map ADVERTISE, Advertise-map NOT_ANNOUNCE_R3, status: Advertise
R1#sho ip bgp neighbors 192.168.150.3 advertised-routes
Network Next Hop Metric LocPrf Weight Path
*> 50.50.50.0/24 0.0.0.0 0 32768 i
R3#sho ip bgp
BGP table version is 18, local router ID is 192.168.200.3
*> 50.50.50.0/24 192.168.150.1 0 0 50 i
* 192.168.100.2 0 100 50 i