How to configure OSPF Default Route

Hello Rene,

Could you please explain the use case for using the metric attribute after the default-information originate command? Why would anyone need to use the metric and metric-types attributes.

Thanks

Shyam

Hi Shyam,

Let’s say we have a small network with two OSPF routers that are both connected to an ISP. You configure both routers to advertise a default route.

The E2 type can be useful since the metric remains the same. You can set a low metric on R1 and a higher metric on R2 to ensure that all OSPF routers always use the default route through R1. When R1 fails, they’ll use R2. You can also use the same metric to ensure that both default routes are used.

With the E1 type, the metric changes so OSPF routers will route to the closest router…R1 or R2, you can play a bit with the metric to influence which routers select R1 or R2.

So, that’s why you might want to use the different E1/E2 types and why you might want to change the metric. Hope this helps!

Rene

I had a question.

  1. with Static default route we configure something like the following:

ip route 0.0.0.0 0.0.0.0 xxx.DestinationAddress.xxx.xxx

  1. If it was EIGRP and we had the following manually configured default route to advertise in EIGRP we would then use the following:

R2(config)#router eigrp AS#
R2(config-router)#network 0.0.0.0

with OSPF I did not see something similar is that because you just did not put in the full configuration or because OSPF just uses that statement:

default-information originate always

I would think it would need a manual entry for the default route to point where it is going to? such as add a default route statically after that and then this statement will advertise it. I am however, not positive because it was missing any type of manual default route in the configurations.

I guess you state here:

advertise a default route if you don’t already have it in your routing table. If you add the always keyword it will advertise the default route even if you don’t have it in the routing table

I would probably have used the word create instead of advertise but after studying the statement a bit closer I get what you meant.

This is like 4rth - 6th time I am going through the OSPF, and BGP lessons trying to drill down and get everything memorized since Sept 2017(though to be honest had a few breaks in there and forgot everything a couple times… lol) I just want to go play Total War Rome but I will keep studying as I have next two weeks off on vacation and want to put in about 40-48 hours study time each week and prep for my CCNP Route and my new job. I hope to take CCNP Route before End of 2018.

Hi Brian,

If you use default-information originate always then OSPF advertises a default route, even if you don’t have a default route in your local routing table. The “problem” with this is that you “attract” traffic to destinations that you don’t have a route for. In reality, you probably use this on some edge router that is connected to the Internet and you have a default route pointing to your ISP.

If you wonder about something like this, instead of trying to “think it through”…boot up some routers, configure this on OSPF and see what happens when you send a ping from another router that receives that default route. Seeing it in action lets it sink in your brain 10x faster than trying to brute force things in your memory :smile:

Rene

1 Like

Hi ,

If you use the default-information originate you can advertise a default route in OSPF. OSPF won’t advertise a default route if you don’t already have it in your routing table. If you add the always keyword it will advertise the default route even if you don’t have it in the routing table

Does the above mean
EG: ’ If a routerA in network of 3 routers has a default route to reach internet it has to be configured with default-information originate to be available on routing table of routerA & to be advertised this default route to other routers in network so they know to reach to internet they have to come to routerA & if by some how if the link between routerA & ISP Router is broken still routerA will have the default route showing up on OSPF routing table ’

Regards
shaan

Hello Mohammed

Let’s say you have this topology:


Let’s assume that R1 has a default route in its routing table via the interface connected to the Internet.

Now if you have the default information originate command in R1, then:

  • R2 will install in its routing table a default route via OSPF with a next hop of 192.168.12.1 when there is a default route in the routing table of R1.
  • If the internet interface of R1 goes down, or if an administrator manually removes that default route from the routing table, R2 will be informed via OSPF, and will no longer have a default route via 192.168.12.1.

Now if you have the default information originate always command in R1, then:

  • R2 will learn of a default route via 192.168.12.1 and will install this in R2’s routing table, regardless of whether or not R1 has a default route installed in its routing table.

I hope this has been helpful!

Laz

2 Likes

thanks Laz for the explanation

1 Like

What is an example of a situation where you would have a default route but it wouldn’t be in the RIB?
i.e. I understand what the always keyword does but I don’t know when that would happen in a practical sense.

Second question, why is an advertised default route always metric 1? Here is a basic multi-router ospf lab I setup in gns3:

I set a static default route on R5 that points to R6 and then set default-info originate. That default route appears on R4 and all three routers behind R4 with a metric of 1.

By contrast, when I look at the routes to the loopback on R5 (10.5.5.1), the metric shows as 2 on R4 and 3 on R1, R2, and R3.

Hello Aaron

The “always” keyword is useful for adding stability to a network. If you already have a default route in the RIP that is provided by another routing protocol, such as RIP for example, and you don’t have the always keyword in place, if that default route begins to flap, then the OSPF process of the router will continually send out new default route information. The always keyword will cause the OSPF router to maintain the advertising of the default route even if the learned default route is flapping.

Remember that you can still use the always keyword if you do have a default route in the RIB. The statement essentially skips the checking for a default route already being installed in the table.

The metric of the advertised default route can be changed if you like:

default-information originate [always] [metric metric-value] [metric-type type-value] [route-map map-name]

By default, the metric is 1 and the metric type is a Type 2 External Route. Why? Well, all defaults implemented in OSPF are there because they have been rigorously tested to find the best values for most topologies. So this is just one of those cases, where, it is what it is because that was what was determined to be the best default value.

I hope this has been helpful!

Laz

Hello,

Is there any reason why the ABR of STUB and Totally STUB Areas inject the default route as LSA Type 3 while the default-information-originate given on this sample is LSA Type 5? Is it just because STUB and T-STUB areas don’t accept LSA Type 5?

Hello Alvis

The default-information originate command will advertise the default route if it exists in the routing table. It shows up as a Type 5 external route when advertised within the same OSPF area, because it is considered a route that has been advertised from a source outside of OSPF.

When it comes to the advertising of such routes to stub and totally stub areas, by definition the ABR will only send a type 3 LSA into such an area, even if the route being advertised was originally learned via the default-information originate command.

Now it is important to note here that if you have a router within an OSPF area that is a stub or is a totally stub, then using the default-information originate command on that router will make that area no longer be a stub or a totally stub area, because it makes that router an ASBR. By definition, among stub-type networks, only the NSSA can have an ASBR, so in such a case, only a type 7 external LSA will be used within the stub area to advertise the default route.

You can find out more about the way these stub areas and LSAs work at the following two lessons:



I hope this has been helpful!

Laz

1 Like

Thanks for the reply, Laz. Appreciate it!

1 Like

Hi Lazaros,

In this topology the creator uses a default route on the isp router out of the network. What is the benefit of doing this on a loopback and can you also use the loopback for the default route and then use that for default-information originate always?

Hello Daniel

In a production network, there is no benefit to creating a default route to a loopback interface unless you want to deliberately disable outgoing traffic. If you were to apply this to a real network, traffic will simply fail. From what I understand, the purpose of this specific lab and configuration is to demonstrate how to configure routing. The use of a loopback interface is simply for convenience.

In packet tracer, one way to simulate the “Internet” is to configure a loopback and use that as the interface that connects to the Internet. You can then arrange all routing accordingly. In later versions, you can install a WAN object that acts as the Internet. (At least I know this is the case for version 7.3)

I hope this has been helpful!

Laz

1 Like

Hi Rene,

I was told to not use the always command for a router connected to an isp and to just put in the default route before setting up ospf and to use the always command for something like an asbr situation when connected to another type of network like EIGRP is this accurate information?

Hello Daniel

It’s a good idea not to use the always keyword on your edge router, especially if you are creating an OSPF peering between your router and the ISP router. This is because, as @ReneMolenaar says in his post you attract traffic to destinations that you don’t have a route for. If the ISP has not configured their network correctly, this might result in the ISP sending you unwanted traffic. Now this traffic would be blackholed, that is, it would all be dropped by your router, but it would still have to process all of this unwanted traffic. It is unlikely that this would happen, but better to be safe.

It would make more sense to use it in an ASBR situation like you say, especially if the network you connect to with the ASBR is under your administration. Then you have control over what traffic is sent to and from there, so you can more safely use the always keyword.

I hope this has been helpful!

Laz

Hello everybody,
my intent is implement for a Group Hotel a network as below:

I take up your scenario, one router A has a WAN FASTWEB line and as a LAN network 192.168.0.0/24, the second router B has a WAN TELECOM connectivity and a LAN 10.10.10.0/24 network.
PtP between two routers 192.168.1.1 router A and 192.168.1.2 router B.
I will announce all the classes in OSPF AREA 0, my intent is to force the 192.168.0.0/24 network to use the internet via router A while for the network 10.10.10.0/24 use internet router B, and if router B goes down, the LAN 10.10.10.0/24 network will use the internet via router A and viceversa.

Is this a possible solution?

Thank you in advance

Hello Valerio

Yes, what you are describing is possible. You can do it in several ways including:

Or you can simply use OSPF equal cost load balancing and allow both subnets to use both ISP links simultaneously.

There are many options, but what you choose will ultimately depend on your requirements.

I hope this has been helpful!

Laz

How many possible ways to create the default route in EIGRP ??

Hello Narad

There are two methods to create a default route in EIGRP:

The first is to create a static route and advertise it into EIGRP. The second is to flag an EIGRP route as the default network. More information about these methods can be found here:

I hope this has been helpful!

Laz