Assume R3 is a breakout for your network, and lets assume for a second you want to advertise a default route into the OSPF domain, but on the condition that you have reachability to the Gateway (GW) 192.10.1.254.
The usual and a really easy way to do this is by originating a default-route based on a route-map with a condition that a specific route is in the routing table.
interface Gi0/0
ip address 192.10.1.3 255.255.255.0
!
ip prefix-list GW seq 5 permit 192.10.1.0/24
!
route-map DEF-GW permit 10
match ip address prefix-list GW
!
router ospf 1
default-information originate route-map DEF-GW
This will work, but there is a design flaw to this particular setup. This setup is based on the prefix 192.10.1.0/24 being in the routing table, but since Gi0/0 is a connected interface, that prefix will always be in the routing table, whether or not the GW router is up or down. Remember this is a not a serial link, where the link state could determine point-to-point reachability. The only time that prefix will not be in the routing table and as a result, not originate the 0.0.0.0/0 default-route, is when the physical local connection to the switch dies. Inevitably this will create a black-hole, which is no good.
So now what. You need to have some form of tracking the IP address on the remote-end, not just the interface state.
We could do this by using a IP Sla Monitor, track the remote-end IP, conditionally create a default route in the routing table, and then when we have reachability, originate the default route into OSPF .
First we would create the Ip Sla Monitor:
ip sla monitor 1
type echo protocol ipIcmpEcho 192.10.1.254 source-interface GigabitEthernet0/0
frequency 10
ip sla monitor schedule 1 life forever start-time now
Next, setup the Track that your conditional static route would reference before creating the default route:
track 1 rtr 1
ip route 0.0.0.0 0.0.0.0 Null0 track 1
Then the easy part, originate and advertise a default route into the OSPF domain if 0.0.0.0/0 is available in the routing table:
router ospf 1
default-information originate
Now if the GW router goes, or the local Gi0/0 interface dies, the default route would be removed from the routing table, and as a result R3 would stop originating a default route, until connectivity is restored.
Nice, Going through OSPF as part of my CCIE lab revision, this is really helping. Bought your R&S notes also, they’re really great.
Thanks a bunch
But R3 is going to drop traffic to 0/0 because it’s pointing to Null0?
I am probably missing something here.