At work, we have a network with 2 routers connected to ISPs, and other routers in our internal network like this:

ISP                        ISP
|(BGP)                      |(BGP)
R1                         R2
|----(my_network/cloud)-----|

The default route for my routers in "my_network" is currently R1, and we switch it to R2 manually if there's a problem between R1 and the ISP. We'd like it to be automatic.

R1 and R2 run Cisco IOS and get their default routes to ISP with BGP.

I saw there that OSPF could propagate a default route with default-information originate, but I'm not sure how it works and I have no labs to test it.

If I configure both R1 and R2 like this:

R1 (config)> router ospf
R1 (router-ospf)> network my_network my_network_mask area 1
R1 (router-ospf)> default-information originate

will it do what I want?

Will the R2 default routes announcement have a lower metric than the one from R1 in the case R1 can't reach ISP?

migrated from stackoverflow.com Nov 5 '15 at 16:46

This question came from our site for professional and enthusiast programmers.

  • You should ask this question on Network Engineering. – Ron Maupin Nov 5 '15 at 15:06
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide your own answer and accept it. – Ron Maupin Aug 7 '17 at 13:35
  • Nice explanation !!! cheers good going guys – sandeep Aug 10 at 12:35

You can inject a default route into OSPF with the default-information originate command which will advertise a default route from a router, as long as there is a default route in the routing table of that router.

You can configure a static default route on each router, but have the defaults routes with different administrative distances. The default route with the lowest AD will be preferred, but when that link is down, the other default route will take over.

  • Since he's already getting a default route from the ISP, he doesn't need static routes. Just make the routes type 1 and increase the metric on R2 – Ron Trunk Nov 5 '15 at 17:44
  • I was just giving an alternative which offers more control. I understand about the default route from the ISP, and that works until it doesn't. I have seen where the default route stops coming from the ISP without the ISP being down. Unfortunately for me. both routers were connected to the same ISP (different POPs), and there was no default route being received, even though the connections to the ISPs were still up and working. – Ron Maupin Nov 5 '15 at 17:51
  • Yes. I've also seen ISPs who advertise a default route even when they lose connectivity upstream. There's no end to the ways it can fail insidiously. ;) – Ron Trunk Nov 5 '15 at 18:27
  • I found this. It takes the example of a configuration very similar to what I have at work. I can't test this until the whole team approved it, but I think it is the solution I'm searching for. About having 2 static routes with different metric, I think it can work if the link between R1 and other router of "my_network" is down, but I don't think it will work if the problem is on the link between R1 and the ISP. – david_loup Nov 6 '15 at 15:35
  • @david_loup If you configure the default routes to point to the WAN port and the ISP router address, it will be removed from the routing table if the link to the ISP fails. ip route 0.0.0.0 0.0.0.0 <interface> <ISP address> <AD> – Ron Maupin Nov 6 '15 at 15:45

You can redistribute default route from EBGP into OSPF, but you should form IBGP neighbor between your uplinks routers and either use local preference or AS_Path to control the the outbound traffic, Below simple setup for this

ISP                        ISP
|(BGP)                      |(BGP)
R1                         R2
|----(my_network/cloud)-----|

R1 ------  IBGP ------------- R2
R1  ------ OSPF ------------- R2

The scenario will be like this:

R1 receive default in EBGP from ISP 1 and redistribute it into OSPF

As EBGP AD is 20 R1 will install default route from EBGP and keep the redistributed default in the OSPF DB, R2 will receive default from ISP also here you need to modify either set local preference on R1 to ensure all your traffic will go via R1 or Prepend your ISP AS to the incoming default route from the ISP like

route-map FromISP permit 10
match ip address 1
set as-path prepend ISPAS ISPAS ISPAS

router bgp xxx
neighbour xxxx remote-as xxx
neighboor xxx route-map FromISP in

Now your are receiving 2 Default in 2 routers each router will receive 2 default one from the ISP directly (EBGP) and one from the IBGP neighbour.

Depending on the AS_Path length the router will decide to install one of these defaults routes, R1 will install the one that came from the EBGP because AS-Path length is shorter than that received from the IBGP, R2 will install the default that came from IBGP in the BGP table because it's the AS_Path shorter but will not use it like R1. Why? Because IBGP Administrative distance is 200, OSPF 110 for summary:

R1 - have 3 Default routes : 1 EBGP 1 IBGP 1 OSFP (redistributed from BGP)

  • Routing table of BGP will install the one from EBGP , shorter AS path.
  • Routing table of R1 will install the default from EBGP because AD = 20

R2 - have 3 Default routes : 1 EBGP 1 IBGP 1 OSFP (redistributed from BGP)

  • Routing table of BGP will install the one from IBGP , shorter AS path.
  • Routing table of R2 will install the default from OSPF because AD = 110

Hope this will help to understand

If the two routers are on the same network segment on the LAN side you can simply everything and use HSRP to advertise a Virtual IP. Then downstream you point the default route to that VIP.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.