Cisco 877 – Advertise OSPF default route only when PPP is up

ciscoospf

I've got a Cisco 877 ADSL router from which I advertise a default route via OSPF to our central router. It also does a standard ADSL / PPP connection to one of our ISPs. What I want is to advertise the default route only when PPP is up. If it goes down stop advertising 0.0.0.0/0. We don't get a BGP or OSPF feed over that ADSL so I can't simply redistribute what I receive. Is that doable?

Here is the PPP config:

interface Dialer0
 ip address negotiated
 ip access-group INTERNET-IN in
 no ip redirects
 no ip unreachables
 ip mtu 1492
 ip nat outside
 ip inspect INTERNET out
 ip virtual-reassembly
 encapsulation ppp
 dialer pool 1
 no cdp enable
 ppp authentication pap callin
 ppp pap sent-username ...
 ppp ipcp route default

And here is the OSPF config:

router ospf 1
 log-adjacency-changes
 redistribute static subnets route-map ospf_tcl
 network 192.168.128.0 0.0.15.255 area 1
 default-information originate metric 1

route-map ospf_tcl permit 10
 match ip address prefix-list adsl_defroute

ip prefix-list adsl_defroute seq 5 permit 0.0.0.0/0
ip prefix-list adsl_defroute seq 10 permit 192.168.128.0/20

Thanks!

UPDATE based on the comments below…

The main router has one other internet link (SHDSL) through a different ISP with BGP feed of national prefixes. The ADSL link (slow, cheap data) via Cisco 877 is primarily used for international traffic and the SHDSL link (fast, expensive data) for national traffic (welcome back to the 90's – that's what we get on a remote pacific island 😉 However in the even of one link going down I want to automatically fail over all traffic to the other link. At the moment it requires a manual intervention on the main router manually replacing the default route.

The goal is to have under normal circumstances a higher metric default route over SHDSL, lower metric default route via ADSL and a bunch of more specific national routes via SHDSL. That part already works, just the default routes updating doesn't.

Here are the static routes from the Cisco box:

#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 218.101.y.y to network 0.0.0.0

C    192.168.128.0/24 is directly connected, Vlan128
     203.97.x.0/32 is subnetted, 1 subnets
C       203.97.x.x is directly connected, Dialer0
     218.101.y.0/32 is subnetted, 1 subnets
C       218.101.y.y is directly connected, Dialer0
S*   0.0.0.0/0 [1/0] via 218.101.y.y
S    192.168.128.0/20 [1/0] via 192.168.128.221

The main router is connected over Vlan128.

Thanks!

Best Answer

Change your static route to use the interface as well as the next hop. That way, when the interface goes down, the route will be removed and no longer advertised over OSPF.

no ip route 0.0.0.0 0.0.0.0 218.101.y.y  

ip route 0.0.0.0 0.0.0.0 218.101.y.y Dialer0

You should also remove the redistribute command -- it's not needed

Related Topic