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

10. OSPF Adjacencies

This lecture, you’ll learn how OSPF routers form adjacencies with each other and build your link state databases. Let’s start with a recap of OSPF operations as you saw near the start of this section. So when you enable OSPF on a router, first off it will discover its OSPF neighbors, it will form adjacencies with them and it will then then build the link state database which contains all of the networks that it’s learned about from OSPF. It will compute the shortest path to each of those networks and install the best route in its routing table.

 And then if anything changes on the network, for example a link going down, then the router will respond to network changes and update its routing table accordingly. We are going to focus on the first three in this lecture, that’s discovering neighbors, forming adjacencies, and building the link state database. So let’s look at the OSPF packet types again as well, the different types of packets that can be sent in the OSPF messages. We have the hello packet. A router will send out and listen for hello packets when OSPF is enabled on an interface. So when you enable OSPF on the router globally, and then when you enable OSPF on interfaces with the network statements, then the router is going to start sending out and listening for hello packets and it will form adjacencies.

 With other OSPF routers on those links. DBD database description packets. Adjacent routers will tell each other the networks they know about with the DVD packet. And LSR is a link state request. If a router is missing information about any of the networks in the DVDs that it receives from its neighbors, it will send that neighbor and LSR a request for more information about it. LSA is a link state advertisement that’s a routing update. An LSU is a link state update that contains a list of LSAs which should be updated that is used during flooding. For example, if a link has gone down and LSAC receiving routers acknowledge LSAs, so when they receive a packet from OSPF with information form from, they will send an acknowledgement back to the router that sent it.

Okay, so now let’s have a look at how that all works in more detail. So starting off with the hello packets, OSPF routers discover each other and form adjacencies with each other via the hello packets. They send hello packets out each interface where OSPF is enabled, except passive interfaces. If you remember on passive interfaces, we don’t want to be sending information out there sharing updates about our internal networks. So on passive interfaces, whichever network is configured on those interfaces will be advertised internally. So our internal routers know about that network, but we’re not going to be giving out any of our internal information out on that link.

 So typically you’re going to have passive interfaces configured where you’re connected to a third party that you don’t want to be sharing your routing information with. We also enable passive interfaces on our loopback interfaces as well. So the way that we enable OSPF on an interface is by enabling OSPF globally and then we enter a network statement which includes the IP subnet that is on that particular link. When we do that, it turns on OSPF an interface, it’s going to start sending out and listening for hellos. When these hello packets are sent out, they’re multicast to the multicast address 2245, that is designated as the all OSPF routers multicast address. And hello packets are sent every 10 seconds by default. So even after a router has formed an adjacency with the router on the other side of the link, it will still keep sending hello packets every 10 seconds because as well as forming the adjacency and exchanging routes with each other, the routers want to make sure that the other router is still up.

 If that router goes down, then obviously we’re not going to be able to send any traffic through it. So the router is going to want to know about that. The way it finds out is that they keep sending each other hello packets. If a router sees that a neighbor has stopped sending hello packets to it, it will realize that that router must have gone down the contents of the hello packet we’ve got the router ID that’s a 32 bit number, looks just like an IPV four address that uniquely identifies each OSPF router. The hello interval is how often the router sends hello packets and this defaults to 10 seconds. The dead interval is how long a router waits to hear from a neighbor before declaring it out of service.

 So as I was just saying, another purpose of the hello packets other than discovering neighbors is to discover if they’re still there or not. If a router has not received a hello packet for the dead interval from a neighbor, it assumes that that neighbor has gone down and the default for the dead interval is four times the hello interval. So if you don’t change the timers, then the hello interval will be 10 seconds and the dead interval will be 40 seconds. If you change the hello interval to 20 seconds, that will automatically update the dead interval to 80 seconds because it’s default four times the hello interval. You can change these individually if you want to as well, though.

Okay, so let’s talk for a second about these timers. If you want your network to react more quickly, it changes, then you can turn these down. But be careful if you do that because that can then cause instabilities. If you have any kind of delay in the network, it can cause routers to think that links or other routers have gone down and that is obviously going to cause problems. So very often you will leave the timers at their defaults. If you do want to change them, be careful that you know what you’re doing before you do that.

Next thing in the hello packet is a list of neighbors. So a list of adjacent OSPF neighbors that this router has received a hello packet from. So this OSPF router, maybe it’s got multiple different interfaces, it’s got OSPF neighbors on each of those different interfaces. But when it sends a whole packet out each interface, it will include the list of all its neighbors into that hello packet. Still got more. We also have the area ID. You remember the OSPF routers. If it’s an ABR, it can have interfaces which are in multiple different areas. So the area is configured on the link on the interface level that information is sent in the hello packet that is sent out that particular link.

Also the router priority, this is an eight bit number used to select the Dr, the designated router, and the BDR, the backup designated router. I’ll speak about those more a little bit later in this lecture. If the Dr and BDR exist and the router knows about them, then the IPV four address is also going to be included in the hello packet authentication flag, if authentication is configured. So it’s best practice that you do do this. When you’re configuring OSPF in a real world enterprise environment, you want to include a password in your OSPF configuration. So then the routers on both sides need to have a matching password. This stops somebody either accidentally or maliciously joining a router to your network and advertising routes there. Because if you think about it, if you didn’t have authentication in OSPF, it would be very easy for an attacker if they had physical access to plug a router in and then start advertising bogus routes into your network, which could cause traffic to get black hole. So you want to make sure that that doesn’t happen.

 More likely it would happen accidentally by somebody taking an old router out of a cupboard and plugging it in, something like that. So make sure that doesn’t happen. Make sure that you do have authentication configured in OSPF for real world networks. You don’t need to know about it. For the CCNA exam, the last thing in the whole packet contents is the stub area flag. This indicates if the area is a stub area, stub areas have a default route to their ABR rather than learning routes outside of their area. So if a stub area was just one way in and out of it, which is the ABR, it puts less load on the routers in that stub area. Rather than learning all the routes everywhere in the network, they just know how to get to their ABR. So they know how to get to everywhere inside their own area to get out of their area, they just send traffic to the ABR via a default route. Means that the router has got less information, less load on that router. These particular settings in the whole packet must match for a pair of PF routers to form an adjacency with each other. So they must be in each other’s neighbor list. Now, when you first see this, you’re probably going to think, well, wait, when I first plug a router in, it’s going to send the hello packet out. It doesn’t have any neighbors yet, I’ve just plugged it in. So how is it going to be able to form any adjacencies? Well, you’ll see it in a second.

 It doesn’t just happen after one packet. The routers go through a little bit of a negotiation, discover each other, and then they’ll form an adjacency. I’ll show you in a second. The homo and dead intervals have to be the same. This is another reason why people will often leave the timers at the default. Because if you do change the timers, you have to make sure that you change them on every single router in your network. They all have to match or the routers are not going to form an adjacency with each other. The area ID has to be the same. Again, this is at the link level. So a router could have different links, different interfaces in different areas.

 But when a router sends a low pack out of a particular interface, if it’s going to appear for an adjacency with another OSPF router on that same link, they both need to be configured to be in the same area. The IP subnet has to be the same as well. And if you think about it, well, they definitely should be. If the IP subnets were different, there was definitely something wrong there. The authentication flag has to be the same. So if a password is configured on OSPF on one side, you have to have a matching password on the other side as well. And if the router on that particular interface is configured to be in a stub area, all other routers in that area must also be configured that it’s a stub area as well. If anything mismatches there, then the adjacency just will not come up.

 Okay, so let’s have a look at the neighbor states as the routers go through the process of forming an adjacency with each other. You can see I’ve got R one on the left. On this interface here, it’s got IP address 170, 216, 1124. And on this interface it’s got IP address 100, 130. Now for this example, we have not configured a loopback interface on the router, so it’s going to use the highest physical address for its router ID. 172 is higher than ten. So this is going to be the router ID here. In a real world environment, you would configure a loop back back address here, but just to save some space on the slide here, I don’t have a loop back. And over here on the right, the router is connected to R Two.

So this will have to be in the same subnet on this interface. Here it is it’s 100 230. And this router also has got an interface on the 170 216 2124 network. So we configure OSPF on our routers. We want R One to learn about the one 7216 200:24 network and we want R Two to learn about the 170 216 10 network. Okay? So we have enabled OSPF globally on our routers and we’ve configured a network statement which includes the ten 00:30 network on both R One and R Two. So R One and R Two will now start sending out hello packets on that interface, trying to discover OSPF routers and form an adjacency with them. So we’ve just done this on R One.

So it sends out a hello packet saying I am router ID 170 216 one one. I’ve just had OSPF enabled so I have no neighbors. Again, notice this packet is going out on the 100 One interface, but the router ID is one 7216 one one. But it does not have to match. The router ID is basically a number. It could be anything. It’s just an identifier. It’s not the same as the IP address on the interface. Okay? So it sends that out and it sends it with a source address of 100 One. The address on the interface, the destination address, is the multi cast address 2245. Any other OSPF routers on that link are listening for traffic that is going to that multicast address. So R Two is going to be listening for it.

So R Two sees the packet and then it sees that it came from the address 100 One. So it sends a reply back saying I’m router ID one 7216 two one and I see 170 216 one one. So if it had any other OSPF neighbors right now, it would include them in this information. So it tells R One about all of its neighbors, including R One that is unicast to ten or one where the first packet from R One came from. And it is sent from R Two’s address of 100 Two. Then R One sees this and then it sends a reply I am router ID one 7216 one one and I see one 7216 two one because it just learned about one 7216 two one. Again, that is unicast to ten or two.

So now we’ve fulfilled that requirement that the routers have to see each other in their neighbor list because you can see that that has been done here. Okay? And once that has been done, the routers are in a two way state. So they’ve established two way communication with each other for Westpf. They haven’t started exchanging any routes yet though. Next up, they move into the exchange state. So at this point, R One sends a database descriptor packet saying I will start exchange with my router ID one 7216 one.

This will come from one of the other routers. And then our two replies back with a database descriptor saying, no, I’m going to start exchange because I had the higher router ID on one 7216 Two One. So this is just a negotiation about who is going to start the exchange. Doesn’t really matter which one it is anyway, but it’s going to be the one with the highest router ID. Okay, then we’re going to start exchanging routing information with each other. So R Two sends a database descriptor. This is a summary of its link state database. So it doesn’t send full information because R One maybe already has the information it would be inefficient to send everything. So it just sends a summary about the networks that it knows about. That includes one 7216 224 that comes into R One, and then R One will send an Acknowledgment back. This traffic is, by the way, of course, all unicast being unicast from R Two to R One there. R One then sends a newcast back saying acknowledges that that packet was received. Then R One will also send its LSDB summary to R Two, again with a database descriptor. And R Two will send an acknowledgement back to R One so that R One knows that it did get there. Next up, we move into the loading state or the loading stage.

So R Two, it solved the summary from R One, saying that R One knows about 170 216 doesn’t know anything about that. So it will send a link state request back saying, please send me full info about the 170 216 124 network. And then R One will send an LSU a link state update reply with the full information about that link and how to get there. R One also sends a link state request to R Two asking for information about One 7216 20. And R Two will send a link to update back to R One with the fool information. So they’ve now exchanged information with each other.

R One will send an acknowledgement back to R Two saying it got the information. R Two will send acknowledgement back to R One, saying that it got its information. And at that stage, they’re in the full state because they’ve got an adjacency with each other and they’ve exchanged the routing information with each other as well. Okay, so that is how adjacencies are formed. That’s how it works. On a point to point link. There’s a little bit of a difference on multiax segments such as Ethernet, they use DRS and BDRs, the designated route. I’ll explain about that in the next.

11. OSPF DR and BDR Designated Routers

In this lecture you’ll learn about the OSPF, Dr and BDR designated routers. You saw in the last lecture that when you enable OSPF on a routers interface, the router will send hello packets out that interface, trying to discover other OSPF routers that it can form an adjacency with. When two OSPF, if routers on the same link send a low packets to each other, they will first off move into the two way state where they’ve discovered each other. They will then move into the exchange state where they will agree to exchange routing updates with each other.

 They’ll then move through loading where they’re exchanging the updates, and finally they’ll be at the fuel state where they are fully adjacent and they’ve shared all of their routing information with each other. And on point to point links, OSPF router pairs will always form a fuel adjacency. It’s a point to point link, so there can only be two routers there. So of course we’re going to want to share their fuel information with each other. But on multi access segments such as Ethernet, where there can be multiple routers, it’s inefficient for all routers to form a full OSPF adjacency with each other. If you look at the example here, you can see I’ve got an Ethernet segment. All four routers are plugged into the switch and on their interfaces connected to that switch, they’re all in the same IP subnet.

So I’ve got R one with 1024, R two with two, r three with three, and R four with four. So in the example, they’ve all got OSPF enabled on their interfaces. So we’re going to be sharing OSPF information out on this link here. And if you think about it, it would be inefficient if that was a fool mesh if they were all sharing the full information with each other, because there would be a lot of repetitive information there being sent out onto the same link. So a better idea would be if one of these routers could be elected as a type of master and then all the routers could share their information with the master and then it could reflect that information out to the other routers.

So rather than having a fool mesh, they just send information to the Master and it’s up to the Master to reflect out. And that is exactly what happens. And what the master is called is the Dr the designated router. Now, because we do have a master there, obviously that could cause a problem. If the master goes down, particularly if a router, say, has just sent an update to that master and then the Master goes down before it can send that update to the other routers, well, that information would be lost, that would be a problem.

So because of that, we want to have some redundancy here. So as well as having the Master, the Dr, the designated router, we’re also going to have a BDR that’s a backup designated router as well, just in case the Dr goes down. Okay, so let’s look and see how this works. So as I just said, a Dr designated router and a BDR backup designated router are elected on each multi axis segment. If I go back to the diagram again here you can see all my routers. We’ve got an interface connected to the same multiaxis segment. So the Dr and the BDR acts at the interface level, not at the entire router level. If, for example, R one had another interface which was also connected to an Ethernet segment, that separate segment would also have its own Dr and BDR elected as well. So the Dr and BDR it’s at the interface level.

 And it works like this on all multi access segments such as Ethernet, the router with the highest priority becomes the Dr, and router with the second highest priority, not surprisingly, becomes the BDR. The default priority on the routers is one, and the higher the number, the better, the more preferred. The possible values are zero to two five five, with two five five being the best possible value. If you configure a value of zero, that means that that router will never be the designated router and the highest router ID is used in the case of a tie. So if you don’t explicitly set the priority, all the routers on the link are all going to have the same priority as one. We still need to have a Dr selected.

The one that is going to be elected is the Dr is the one with the highest router ID. And in the real world, that is what will typically happen. Because if you’ve got routers that are connected to the same link, they’re probably going to be very similar model of routers anyway. This does really not put a lot of load on routers. Normally you’re not going to really care which one is the Dr. You just need to understand how this works so that if you do have problems, you can troubleshoot it. But as far as configuring anything typically real world, you’ll just leave the routers to figure it out themselves. As to which one is going to be the Dr. In the CCNA exam, you might be asked to configure one as the Dr flow.

So you need to understand how this works and you need to know how to configure priority as well. Okay, when this happens on multiaxis segments such as Ethernet, the routers elect the Dr and BDR. At the two way stage. If you remember the stages from the last lecture, when the routers have not discovered each other yet, the OSPF state is down, they then send Hellos. When they discover each other through the hello messages, then they move to the two way stage. So at the two way stage, they have not started exchanging any routing information yet. They then move through the exchange loading and the full states. So with the Dr and the BDR election that happens at the two way stage before routing information has been exchanged.

 And if you think about it, that makes sense because we don’t want all the routers exchanging the full information with each other, just with the Dr and the BDR. So we need to have this set up before routing information is exchanged between the routers. Now the election just happens on multi access segments on the router. It knows that that interface is an Ethernet interface, so it knows that there needs to be a Dr elected there. If there was another, say a serial interface with a point to point link, then the router knows that as a point to point link and there’s not going to be a Dr elected on that link.

There are a few types of connections which could be either point to point or multipoint. Like that can happen with Frame really, which is not covered in the CCNA anymore. Some of those older legacy interfaces you do need to specify whether it’s point to point or a multiaxis segment. But for the CCNA exam you don’t need to know that. Okay, so if we do want to manually set which of the routers is the Dr, we use the command again, this is at the interface level. So I’ve got interface fast, ethernet, zero, IP or SPF product a 100. As long as you set it more than one, that is going to be the preferred router. If you wanted to configure a Dr and a BDR, you could configure the Dr with 100, for example, and the BDR with 50, for example.

If you want to specify that a router will not become a designated router, then you can set IP OSPF Prod a zero on the interface. Now, after you’ve configured this command on the interface, it’s not going to actually make anything happen. It’s not going to take effect until OSPF has been restarted on that interface. So how could you do that? Well, you could reboot the router or you could shut down the interface and then bring it back up again. Or at the enable prompt you could use the clear IP OSPF command to restart the OSPF process. Obviously all of those would be disruptive. So be careful if you’re going to do it in a production environment.

The Dr and BDR establish full neighbor state with all routers on the network segment. The neighbor state of other routers remains in a two way state and they do not directly exchange routes with each other. So for example, on the example topology we had at the start of the lecture, where we had R one, R two, R three and R four, let’s say that R one is the Dr and R two is the BDR, but R one and R two will go to the full state with all of the other routers. On R three and R four they will go to the full state with R one and R Two because those are the Delta routers. But if you look at the state between R Three and R Four, because neither one of those is a designated router, they will just be in the two way state with each other.

So routers which are not a designated router will just have a two way relationship with each other. We’re not exchanging full routing information directly with each other. The R Three and R Four will still learn each other’s routes, though, because that will be reflected down from the designated router. So when a link state changes on a router for that new link comes up, or if a link goes down and that is connected to multiacs segment, it sends a multicast LSU link state update packet to two, Two, four, or Six, which is the multicast address for all designated routers. So it’s just the Dr and the BDR that are listening in for packets that is sent to that address. So again with our example, if any of the routers, R One, R Two, R three, or R four sees a link state change, it will send an update about that to 2246 and both the Dr and the BDR will learn about that change.

 Then just the Dr, not the BDR as well. The Dr multicast update to two, two, four or five all OSPF routers. So all OSPF routers on the link will learn about it. So that’s why when there is any changes, it’s just sent to the Dr and the BDR. The Dr then sends that out to the other routers on the link. So if there’s any change anywhere, all the routers on the link will still learn about it. Okay, so that’s how the Dr and the BDR work. In the next lecture, I’ll show you how to verify what’s happening, which routers are the Dr and the BDR. Also how to influence what one will be. If you want to do that with our lab demo.

Leave a Reply

How It Works

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