02-11-2014 12:14 PM - edited 03-04-2019 10:19 PM
Hey All,
I'm trying to figure out how to propigate a default route from OSPF if the devices default route is learned via BGP.
This is what I have in my config. I've removed the non-relevant commands.
router ospf 100
default-information originate metric-type 1 route-map CHECK_DEFAULT
!
!
ip prefix-list CHECK_DEFAULT seq 5 permit 0.0.0.0/0
!
route-map CHECK_DEFAULT permit 20
match ip address prefix-list CHECK_DEFAULT
match source-protocol bgp 65001
My problem is that this router, when BGP is down, will learn a default route from a backup router. This it readvertises the default route again and creates a ping pong effect.
This is what the route looks like when coming from BGP.
Routing entry for 0.0.0.0/0, supernet
Known via "bgp 65001", distance 20, metric 0, candidate default path
Tag 209, type external
Redistributing via ospf 100
Last update from 192.168.255.4 00:00:15 ago
Routing Descriptor Blocks:
* 192.168.255.4, from 192.168.255.4, 00:00:15 ago
Route metric is 0, traffic share count is 1
AS Hops 2
Route tag 209
And this is what is looks like when coming from OSPF.
Routing entry for 0.0.0.0/0, supernet
Known via "ospf 100", distance 110, metric 1, candidate default path
Tag 100, type extern 2, forward metric 110
Redistributing via bgp 65001
Last update from 192.168.1.18 on FastEthernet0/1, 02:37:50 ago
Routing Descriptor Blocks:
* 192.168.1.18, from 192.168.255.7, 02:37:50 ago, via FastEthernet0/1
Route metric is 1, traffic share count is 1
Route tag 100
If BGP is up then I want to advertise the default inbound via OSPF. If it is not, I do not.
It seems that the route-map is doing an either or match. I need it to do a AND match.
Any ideas?
--Patrick
02-11-2014 01:01 PM
Hi Patrick,
From my understanding, the route-map option at the end of the OSPF 'default-information originate' command is only used for conditional advertisement where a default route will only be advertised when certain other routes are present in the routing table.
So in your example, when BGP is down and the BGP default is withdrawn, a default route still exists in the routing table via the backup so the route-map is still matched and OSPF advertises the default to its neighbors.
A workaround is to use conditional route advertisement with object tracking. Here we can setup a IP SLA monitor to ping your BGP neighbor and if successful install a dummy route in the routing table, this dummy route is then matched in the route-map and allow OSPF to advertise the default. If the BGP neighbor is down, the IP SLA fails and the dummy route is withdrawn resulting is OSPF from withdrawing its default route.
I can send you an example config if that helps.
Thanks,
Will
02-11-2014 01:16 PM
Will,
I'd love to see an example.
I made a little progress. I was able to get my config working when I used this route map.
route-map CHECK_DEFAULT permit 10
match ip address prefix-list CHECK_DEFAULT
match tag 209
The route tag from my BGP network is 209. I'll be doing some testing to see if this will work for me.
--Patrick
02-11-2014 01:30 PM
Yes, matching the tag as well is a good idea, I didnt think of that. Your method is also less config intensive :-)
Example config using IP SLA. Host 1.1.1.1 will be the BGP neighbor
ip sla 1
icmp-echo 1.1.1.1
!
ip sla schedule 1 life forever start-time now
!
track 1 rtr 1
!
ip route 169.1.1.1 255.255.255.255 Null0 track 1
!
ip prefix-list DUMMYROUTE seq 5 permit 169.1.1.1/32
!
route-map OSPF-DEFAULT permit 10
match ip address prefix-list DUMMYROUTE
!
router ospf 1
default-information originate route-map OSPF-DEFAULT
02-12-2014 09:17 AM
Thanks Will. I had not thought of using the track statement on the route line.
--Patrick
02-12-2014 09:27 AM
Patrick
Just a quick addition.
I think the matching on the tag should work fine although Will seems to be suggesting you can't do a conditional advertisement for the default route when the route you are checking for is the default route so as you say it would need testing.
In terms of using match source-protocol i found this document which states that it just does not work for OSPF conditional advertisement so it may just be you were unlucky in choosing that specific option -
http://wiki.nil.com/Conditional_OSPF_default_route_origination_based_on_classless_IP_prefixes
Jon
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide