Basic dynamic to static routing failover (BGP to Track Objects)

Topology

N.B: BGP is advertising specific prefixes as well as 0/0 route so the static routes on CPE1 don't take presidence over BGP because they are more specific routes than 0/0

CPE has a preferred link to the ISP edge (PE1), we can assume a leased line or Ethernet service. It also has backup links to the ISP edge (PE2) which we could assume are ADSL lines so are less preferable. PE1 advertises the preferred routers via BGP over the main link, and CPE has static routes using track objects to balance traffic over the two ADSL lines if the Ethernet line fails. The track objects track SLA monitor objects (ICMP Echo tests) and uses one link as the default route link (0.0.0.0/0) and the other for specific subnets (192.168.3/24, 192.168.4/24 and 192.168.5/24). This would allow one link to become saturated and the other to still provide critical services like DNS, VOIP, etc.

The loop back interfaces on the PE routers represent the specific ISP services CPEs route traffic to separately from their default 0/0 route over the 2nd ADSL line, when the main link fails. Three loop back interfaces on CPE1 represent local LANs the ISP is routing traffic towards.

CPE

ip sla monitor 2
 type echo protocol ipIcmpEcho 10.0.2.2 source-interface Ethernet0/1
 frequency 30
ip sla monitor schedule 2 life forever start-time now
ip sla monitor 3
 type echo protocol ipIcmpEcho 10.0.3.2 source-interface Ethernet0/2
 frequency 30
ip sla monitor schedule 3 life forever start-time now
!
track 2 rtr 2 reachability
 delay down 20 up 20
!
track 3 rtr 3 reachability
 delay down 20 up 20
!
interface Loopback10
 ip address 192.168.10.1 255.255.255.0
!
interface Loopback20
 ip address 192.168.20.1 255.255.255.0
!
interface Loopback30
 ip address 192.168.30.1 255.255.255.0
!
interface Ethernet0/0
 ip address 10.0.1.1 255.255.255.252
 full-duplex
!
interface Ethernet0/1
 ip address 10.0.2.1 255.255.255.252
 full-duplex
!
interface Ethernet0/2
 ip address 10.0.3.1 255.255.255.252
 full-duplex
!
router bgp 65002
 no synchronization
 bgp log-neighbor-changes
 network 192.168.10.0
 network 192.168.20.0
 network 192.168.30.0
 neighbor 10.0.1.2 remote-as 65001
 neighbor 10.0.1.2 soft-reconfiguration inbound
 no auto-summary
!
ip route 0.0.0.0 0.0.0.0 10.0.2.2 240 track 2
ip route 0.0.0.0 0.0.0.0 10.0.3.2 250 track 3
ip route 192.168.5.0 255.255.255.0 10.0.3.2 240 track 3
ip route 192.168.4.0 255.255.255.0 10.0.3.2 240 track 3
ip route 192.168.3.0 255.255.255.0 10.0.3.2 240 track 3 

PE1

interface Loopback4
 ip address 192.168.4.1 255.255.255.0
!
interface Loopback5
 ip address 192.168.5.1 255.255.255.0
!
interface Ethernet0/0
 ip address 10.0.1.2 255.255.255.252
 full-duplex
!
interface Ethernet0/3
 ip address 10.0.4.1 255.255.255.252
 full-duplex
!
router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 network 192.168.4.0
 network 192.168.5.0
 neighbor 10.0.1.1 remote-as 65002
 neighbor 10.0.1.1 next-hop-self
 neighbor 10.0.1.1 default-originate
 neighbor 10.0.1.1 soft-reconfiguration inbound
 neighbor 10.0.4.2 remote-as 65001
 neighbor 10.0.4.2 next-hop-self
 neighbor 10.0.4.2 soft-reconfiguration inbound
 no auto-summary

PE2

interface Loopback3
 ip address 192.168.3.1 255.255.255.0
!
interface Ethernet0/1
 ip address 10.0.2.2 255.255.255.252
 full-duplex
!
interface Ethernet0/2
 ip address 10.0.3.2 255.255.255.252
 full-duplex
!
interface Ethernet0/3
 ip address 10.0.4.2 255.255.255.252
 full-duplex
!
router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 network 192.168.3.0
 redistribute static route-map redist-static
 neighbor 10.0.4.1 remote-as 65001
 neighbor 10.0.4.1 next-hop-self
 neighbor 10.0.4.1 soft-reconfiguration inbound
 no auto-summary
!
ip route 192.168.10.0 255.255.255.0 10.0.2.1 240 tag 500
ip route 192.168.10.0 255.255.255.0 10.0.3.1 250 tag 600
ip route 192.168.20.0 255.255.255.0 10.0.2.1 240 tag 500
ip route 192.168.20.0 255.255.255.0 10.0.3.1 250 tag 600
ip route 192.168.30.0 255.255.255.0 10.0.3.1 240 tag 500
ip route 192.168.30.0 255.255.255.0 10.0.2.1 250 tag 600
!
route-map redist-static permit 10
 description match backup routes for redistribution
 match tag 500
 set local-preference 75
!
route-map redist-static permit 20
 match tag 600
 set local-preference 50