Prerequisites: CCNP level skills.
Topology
Task 1
Configure routers so that the traffic originated in AS 50 towards 172.16.101.1/24) takes the path through AS 30, AS 20, AS 40, AS 10 as long as the physical connection between R1 and R4 is operational. In case this connection is 'down', the traffic should be sent via AS 30 and AS 10. Do not modify any BGP attribute to accomplish this.
Solution
Task 1
Configure routers so that the traffic originated in AS 50 towards 172.16.101.1/24) takes the path through AS 30, AS 20, AS 40, AS 10 as long as the physical connection between R1 and R4 is operational. In case this connection is 'down', the traffic should be sent via AS 30 and AS 10. Do not modify any BGP attribute to accomplish this.
Notice!
BGP can advertise prefixes conditionally. The condition here is going to be the presence of another routing entry (10.1.14.0/24). If this link is up, R1 is not going to advertise 172.16.101.0/24 towards R3. In case the link between R1 and R4 is down, R1 is going to advertise its loopback0 towards R3.
Pic. 2 - Current BGP Path on R5.
!
ip prefix-list LOOPBACK0 seq 5 permit 172.16.101.0/24
!
ip prefix-list R1_R4_LINK seq 5 permit 10.1.14.0/24
!
route-map CHECK_LINK permit 10
match ip address prefix-list R1_R4_LINK
!
route-map CONDITION_ADVERT permit 10
match ip address prefix-list LOOPBACK0
!
router bgp 10
no synchronization
bgp router-id 172.16.101.1
bgp log-neighbor-changes
network 10.1.14.0 mask 255.255.255.0
network 172.16.101.0 mask 255.255.255.0
neighbor 10.1.13.3 remote-as 30
neighbor 10.1.13.3 advertise-map CONDITION_ADVERT non-exist-map CHECK_LINK
neighbor 10.1.14.4 remote-as 40
no auto-summary
!
ip prefix-list R1_R4_LINK seq 5 permit 10.1.14.0/24
!
route-map CHECK_LINK permit 10
match ip address prefix-list R1_R4_LINK
!
route-map CONDITION_ADVERT permit 10
match ip address prefix-list LOOPBACK0
!
router bgp 10
no synchronization
bgp router-id 172.16.101.1
bgp log-neighbor-changes
network 10.1.14.0 mask 255.255.255.0
network 172.16.101.0 mask 255.255.255.0
neighbor 10.1.13.3 remote-as 30
neighbor 10.1.13.3 advertise-map CONDITION_ADVERT non-exist-map CHECK_LINK
neighbor 10.1.14.4 remote-as 40
no auto-summary
!
Notice!
For this to work, the network 10.1.14.0 (R1_R4_LINK) must be advertised into BGP.
Verification:
Pic. 3 - R1's Advertisement to R3
(Link between R1 and R4 OKAY).
R1 is NOT advertising 172.16.101.0/24 because the link between R1 and R4 is up.
Pic. 4 - R5's Path towards 172.16.101.0/24.
Pic. 5 - Link between R1 and R4 is DOWN.
Pic. 6 - R1's Advertisement to R3.
Pic. 7 - R5's Path towards 172.16.101.0/24.