200-301 Cisco CCNA – OSPF – Open Shortest Path First part 2
January 27, 2023

4. OSPF Basic Configuration Lab Demo

In this lecture, you’ll learn how to do a basic configuration of OSPF on our Cisco routers. So to enable OSPF, the top level command at Global Config is router OSPF and then a process ID. So you can see an example here. I’ve said router OSPF One. Different interface on a router can run in different instances or different process IDs of OSPF. And different instances have different link state databases, so they run separately. Only one instance is typically configured on OSPF. Routers multiple process IDs are very rarely used. It’s not normal to have different process IDs on the router. The process ID is locally significant, meaning it does not have to match on the neighbor router for them to form an adjacency. You’ll see what I mean about that coming up on the next slide.

 So in the example below, we’ve got three routers. R one, R two and R three, with R two in the middle. On R Three. Both interfaces have been put in process. ID One. On R Two, the left hand interface is in Process ID Two, the right hand interface is in Process Three, and on R One its left hand interface is in Process Four. R two will form adjacencies both with R three and with R one. So even though the Process ID is different on the routers, that’s a locally significant number. It does not have to match on both sides. So the routers will still form adjacencies. In our example here, on R Two, the left hand and the right hand interfaces are in two different processes.

So we’re going to have separate link state databases and information is not going to be shared between the two sides. So R One and R Three will not learn routes to each other because both sides are in different process IDs. On Router Two. The way we would configure this is on R Two. We say Router OSPF Two at Global config and then network. Ten o. The Wild Card Mask 0255 Area Zero And then for the other interface, we say router westpf three and network 100 one. Okay? So that’s how you can have different processes for wespf running on the same router. It is absolutely not normal to do that. Very rare that you would see this. I’m just showing you it here so that you can fully understand what the process ID is. What is more normal is where all the routers in your network are all using the same process ID number.

So you can see here now on routers R One, R Two and R Three, the same topology as before. We’ve configured OSPF process ID one on all interfaces. On R Two. We see. Router OSPF One. Network Ten o and Network Ten One are both under process one. And now R One and R Three will learn routes to each other. Don’t worry about the area statement on the end here yet. We’re going to cover what areas are and how they work towards the end of this section. Okay, so we configure router OSPF and then usually we’ll use a process ID of one. The next command to use is the network command. This is pretty much the same as the network command that we had for EIGRP as well.

So network and then the network address a space and then the wild card mask, which is the inverse of the subnet mask. And then specify the area. If you’ve got a small network, you can just put everything in area zero. Again, we’ll cover areas in more detail later on. So network command, it uses a wild card mask rather than a subnet mask, which is the inverse of the subnet mask. So if your subnet mask was 255-2550, your wildcard mask would be 025-5255.

If your subnet mask was two 5525-525-5252, your wildcard mask would be o three. To figure out the wild card mask, just subtract the octets in the subnet mask from two five five. Next thing in EIGRP, if you specify the network statement and you don’t include a wild card mask, it defaults to using the class four wildcard mask. For example 25 25 25 for a class A in OSPF, it does not default to doing that. You have to enter the wild card mask in OSPF. If you try answering a network statement without a wild card mask, it’s going to give you an error message. What the network command means is the same as it was in EIGRP.

 Look for interfaces with an IP address which falls within that range and then enable OSPF on those interfaces, meaning send out and listen for OSPF hello messages and pair with adjacent OSPF routers. Once the adjacency has been formed, advertise the network and mask which is configured on those interfaces. So the same example as we had before for EIGRP. You see, we’ve got our one here, fast ethernet zero has got IP address ten 124, fast 10 is on the 1001 O 24 network and fast two is on the ten o 224 network. So we could put in three separate network statements to cover each of the interfaces, or we could just cover them all with just one network statement.

Actually, an example here, we just want to turn on OSPF for interfaces fast 10 and 20, we don’t want to include zero, so we configure a network command network ten 00:25 two five five area zero. So all interfaces that have got an IP address that begins with 100 and then anything after that we’re going to turn OSPF on for those interfaces so that will match on interface fast 10 and 20. Fast zero begins with ten one, so that is not included in the network statement. So we’re not going to turn OSPF on there. The networks that will be advertised are 100 100:24 because that’s the IP address net subnet configured on interface and 100 two O 24.

 We do not advertise ten O 16, which is what we configured in the network statement. Okay? The network statement does not say advertise this subnet. The network statement says and look for interfaces which fall within this range. Enable OSPF on the interfaces and then advertise the subnet that is configured on that interface. Okay, so that’s how we do a basic configuration of OSPF. Moving on to actually verifying it. Now to see your OSPF configuration, we can do a Show run and then pipe it to section OSPF. That will show all of the OSPF commands in your running config, whether they’re under the main OSPF part of the configuration or at the interfacing level. So this is convenient to see all your OSPF commands.

It’s easier than doing a Show run and trying to scroll down to the actual part of the config. Show IP protocols will show all the routing protocols that are running on the router. You can see in the example here, we’re running OSPF with Process ID One. You can see other information like the networks is routing for the routing information sources which are the OSPF neighbors, et cetera. Show IP OSPF interface brief will show which interfaces have got OSPF enabled on them on this router, the Process ID for the interface, the area, the IP address, and mask the cost for the metric and how many neighbors are reachable through that interface.

 With the OSPF operations that run in the router, after you enable it, the first thing it does is it discovers neighbors and forms adjacencies. So if you’re going to verify that OSPF is working, it makes sense. The first thing to check is that it has been able to form adjacencies. The command to check that is show. Ipospf, neighbor. Whenever I configure OSPF, the first command I always do after that, once I’ve configured both sides of the link, is Show Ipospf Neighbor. Check that the routers can see each other and they have formed an adjacency. You see the example here. The Neighbor ID is 100 two one, and it’s reachable interface faster for net zero. The next thing that happens with OSPF operations is the routers will flood the links database to see if routes have been learned from OSPF.

You can use the Show IP OSPF database command that will show all the links that are available in that area and throughout the OSPF network. The next thing that happens is the routers will look at all the available possible paths and they will decide which is the best path using the shortest path first algorithm and put that best path into the routing table. So next command to verify is Show IP route and check that you’ve got OSPF routes in the routing table. Again, when I configure ISPF first command, I’ll use a Show IPF Neighbor check the adjacency has come up the next command. After that I’ll use a shoe IP route and check that OSPF routes are in the routing table. I won’t normally look at the database. Unless the routing table does not container routes. I was expecting. And then I’ll use that more as a troubleshooting command. Okay, so that was how to do a basic configuration of OSPF in the next lecture. We’ll actually do this in the lab.

5. OSPF Advanced Topics

In this lecture, you’ll learn about the advanced OSPF topics of the Router ID, how to configure passive interfaces, and default route injection. So we’ll start off with the Router ID. This is very similar to how the router ID worked for EIGRP as well. So our OSPF routers identify themselves to other OSPF routers. Using an OSPF router ID, which is in the form of an IPV four address, it defaults to using the highest IP address of any loot back interfaces configured on the router. Or if there’s no loot back interfaces, it will use the highest other IP address. Loot back interfaces never go down, so the router ID will not change. If you use a loopback. You can also manually specify the router ID.

 Best practice is to use a loop back or manually set the Router ID so it won’t change. Makes things more stable by doing that. So if you haven’t used or you haven’t configured a loopback address on your router, you can see an example here on R one. I’ve done a show IP interface brief. There’s no loopbacks configured there. The highest IP address is 100 three one, which is on interfacefast 30. So that will be selected as the router ID. We can verify that by using the Show IP protocols command.

 So we do that and we can see that, yes, the Router ID is 100 three one. Next example, we do Show IP interface brief. And this thing we do have a loopback interface. We’ve got loopback zero with IP address one one. So even though it’s lower than the physical addresses, because it’s a loopback, this is going to be preferred as the router ID. Again, we can verify that with the Show IP protocols command. Now, if you’ve got a router and you’ve just got physical IP addresses on there and you’ve already got OSPF configured, and then you configure a loop back afterwards, it’s not going to immediately update the router ID.

To change to the loopback, you would need to restart the OSPF process by rebooting the router or by shutting down and then restarting OSPF. Obviously in a production environment, you would just wait until the next reboot, because disabling and re enabling OSPF would be disruptive the command. If you want to manually configure, it is under the Routerspf configuration, router ID. And then the ID that you want to use in the format of an IP version for address.

The address that you use doesn’t have to actually be configured on the router. You could just make up a new address. However, it’s more logical and easier for troubleshooting if you do use an IP address that is actually configured on the router. Okay, so that was the router ID. Next up is passive interfaces. If you configure a passive interface, it will be advertised in OSPF, so other routers will learn how to get to that network. But the interface itself will not try to form any adjacencies, and it won’t give out any internal information. So you see in our example here we’ve got Router R One which has got a loop back interface and on interface Fast Ethernet 20 it’s connected to R Six, which in our example belongs to another organization. So it’s best practice to configure your loot box as passive interfaces. They’re not physical interfaces, so there can’t be a physical router on the other end of the link to form an adjacency with. So it’s more efficient. Rather than sending out OSPF information, we’ll make it a passive interface. Now we have to include it as a passive interface so that your other routers learn how to get to that loot back address. And we’re also going to make Fast Ethernet 20 a passive interface. Again, we want our other internal routers to know how to get to that network, but we don’t want to be giving out any of our own internal information out on that link. That would be a security issue. So it configure this.

We say Router OSPF One at Global Config and then under the OSPF configuration, passive interface loopback zero and passive interface Fast Ethernet 20. If more of your interfaces are passive rather than active interfaces, then you can set passive interface as the default. So here this configuration is going to do exactly the same as we did on the previous slide. We say Router OSPF One on Router R One and then passive interface default which will make all our interfaces passive. Then we say no passive interface fast zero, no passive interface fast 10 and no passive interface fast 30 so that the router will form adjacencies on those links. So that was our passive interfaces.

 Last thing to cover is default route injection. And this is configured in a similar way as what it was for rip. So the example here we’ve got R Four is connected out to an Internet service provider. So we configure a static default route on R Four with the command IP route Zero zero and the next top address of 203 01132. We don’t want to have to configure static routes to get out to the Internet on all of our routers. We want them to learn that dynamically. So we’re going to inject it into the OSPF process on Router R four. The command to do that is router OSPF One and then default information originate. It will look for a default route on the router and it will inject that into OSPF. To verify it, do a show IP route on your other routers and check that they do have a default route to be zero zero network. This will show up as an external route in OSPF.

 What an external route is, it doesn’t mean it’s come from somewhere outside your organization. What it means is that the route was redistributed into OSPF. What redistribution is, is when we take a route from another source, like another routing protocol, or it could be a static route, and we inject that into OSPF. So again, external does not mean it’s outside. It literally means it was redistributed into OSPF. So this was a default static route that we’ve redistributed into SPF. So it shows up as an external route when you view the routing table. So that was our or advanced topics next lecture. We’ll configure it in the last.

6. OSPF Advanced Topics Lab Demo

In this lecture, you’ll learn how to configure the OSPF Router ID passive interfaces, and how to do default route injection with a lab demo. So in our lab topology, we’ve got the usual five routers R one two, R five and R four is connected out to the Internet on interface fast 30 with IP address 200 and 03:01 one three one. So let’s go onto our four and check what the router ID is right now. So I’ll do a Show IP protocols and I can see that the Router ID is 203 one. If I do a Show IP interface brief, I see that I don’t have any loopback interfaces configured on here, so it’s taken the highest IP address, which is 203 1131. So it’s bad practice to have that. It’s better to use a loopback or to manually set the Router ID. So let’s configure a loop back first.

 So I’ll go config T, then interface and loop back zero, and I’ll give it IP address 1125 525-525-5255 as the subnet mask. It’s on loop back. So I don’t need to do a no shutdown. It’s no shut down automatically. If I now do a Show IP protocols, you’re going to see that the Router ID has not changed. What happens is when the router boots up or when OSPF starts, it checks to see what is the highest loopback or physical IP address if the Router ID has not been manually set. But if you change this later by adding a loop back, it’s not going to automatically update it. So we can force this to update by restarting OSPF. So let’s do a Show run section OSPF just so I could be able to copy and paste this back in. And I’m going to copy my current OSPF configuration.

 And then at global config, I’ll do a no router OSPF one and then paste the config back in so that will stop and start OSPF one here again. Obviously, don’t do this in a production environment because you would lose routes of an end. And if I do a Show IP protocol now, I’ll see that the Router ID has updated to the loop back. Other way that you can manipulate the Router ID is by setting it manually. So to do that in global configuration, I go router OSPF one and then Router ID and let’s give it two two. And with OSPF, I’m going to have to restart OSPF again so I can reload, or I can do a clear IP OSPF process command that’s similar to removing and then re enabling the config she saw with EIGRP. When I set the router ID, it took effect immediately. But with OSPF, if I now do a Show IP protocols, it’s still using the loopback address, so I can restart OSPF. I’ll just copy and paste this in so I’ll clear IP OSPF process. At the enable prompt, it will ask me to verify, because again, this would be disruptive. And I’ll say yes. And now if I do a Show IP protocols, I’ll see that it has taken that new router ID. You can see it was disruptive because you see that the adjacency went down and then came back up again. Okay? So that’s how you configure the router ID. Next thing, if we have a look back at the topology diagram, you see on Interface Fast 30, we’ve got the 203 0113 or 24 network, and that is not currently being advertised in OSPF. I want to advertise that to my routers on the inside. So routers r one, r two, r three and R five. But I don’t want to give out internal routing information to the Internet Service Provider router. So I’m going to make interface fast. Ethernet 30. A passive interface. So let’s go back on to R Four again.

 And if I do a show run for section OSPF, you’ll see that I’ve just got a network command right now for the ten networks. So that is not being advertised in OSPF yet. And if I go onto another router and do a Show IP route, you’ll see there’s no route there for the 203 network. So I want R One and my other internal routers to learn this. So on R Four, I’ll go to Global Configuration Router OSPF One, and I will say, let me just do a Do Show IP interface brief just to double check what the interface was. Okay? It was an interface. Fast 30. So still in the SPF config, I’ll say Passive Interface Fast Ethernet 30, and then I need to put in the network command so that it will be advertised internally.

 So it’s network 203 one one three, or the World Card mask of 0255 and area zero. And if I now go back into another router and do a Show IP route, if it’s converged yet, yes, there it is. I can see that that is now being learned by my other internal routers, but it’s not going to send any information out. Okay, last thing is I want to do static default route injection into OSPF. So it’s back on R Four again, it’s connected out to that service provider. So on R four, I will do an IP route. So a static route for everything that doesn’t have a more specific route.

 So the next top address is 203 1132, and I don’t want to have to configure a static route and all my other routers. I want them to learn it dynamically. So under router Westpf One, I’ll say defaultinformation originate and that will inject that default static route into Westpf. So if I now go on to R One and do a Show IP route here, you’ll see the routing table was updated. It’s got that default route which was learned from OSPF. Okay, so that was our Westpf Advanced Topics in the lab. See you in the next lecture.

Leave a Reply

How It Works

Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!