OSPF relies on five distinct packet types to establish and maintain routing information between neighboring routers. This content covers the structure of the OSPF header, each packet type, and the Link State Advertisements that carry detailed topology data.
OSPF Packets
One of the critical components to these dynamic routing protocols is the packets, the communication between the routers.
When it comes to OSPF there are quite a few different packet types. The different packet types are the hello packets, the database packets, the link state request packets, the link state update packets, and the link state acknowledgments. Then we will wrap this up by talking about link state advertisements, which is a component of several of these packets.
What we are talking about is the payload here, but we still have to remember the rest of the ethernet frame. We have got the layer 2 header and layer 2 trailer on it, we have got the IP header, and we will also be taking a look at the OSPF header. So let's start out by taking a look at the OSPF header, and then we will get into what is going to be found in the OSPF payload, and that is the different packet types.
The OSPF header looks like this, and just as a refresher, each one of these is a byte, so there are one, two, three, four bytes. If you want to count the individual bits, there are eight bits for each one of those bytes. These are the labels, so this is byte zero through three, this is byte four through seven, byte 8 through 11, 12 through 15, and so on and so forth, so we can see how this packet is formed.
What does the OSPF header look like? First of all we have the version. With OSPF we are going to be using version 2 for right now, so if we were to switch it to version three then we would find a three in that top part right there.
Then we have the type. The OSPF type defines what the payload is going to be. If it is the hello packet then it is going to be a type 1. If it is the database packet then it is going to be a type 2. If it is a link state request then a type 3, if it is a link state update then a type 4, or if it is a link state acknowledgment then it is a type 5. We would find whichever one it is in this type field right here.
Next we have the packet length, and that is the total length of the packet, so that can vary quite a bit depending on what kind of payload is in here, and we will be talking much more about that as we progress through these slides.
Then we have the router ID. The router ID is the ID of the router that is advertising and sending out this OSPF packet that is being sent out. Then we have the area ID. As mentioned, we are not going to get real in depth into areas right now; this is going to be area 0 for our network. However, this will change if we had multiple areas, and then this would identify the area that it is part of.
We have a checksum just to make sure that when it arrives where it is trying to go that it is accurate. It does the checksum to make sure that nothing has changed. Here we have the authentication type, and that is a zero, one or two. Zero means that there is no authentication, one means that there is just a password, and two means that it is using authentication. What is happening in this field right here is much more in depth: they have a key ID, MD5, authentication data length, and a sequence number, so there is some extra information that falls into this authentication part. And then the size of this payload right here is going to vary quite a bit, once again depending on what is being carried on this packet.
So what are these different packet types? We just looked at the OSPF header and it showed us a type field that defined what is going to be in the payload of this, and we said that is going to be hello, the database description, the link state request, the link state update and the link state acknowledgment. What does that look like when it comes to our topology?
OSPF keeps track of quite a bit of data. It has a bunch of data on the neighbors that it has, and it also has information on all of the links, so it actually goes through and labels each one of these links so that it can track those links.
One thing that it needs to do is establish this neighborship between two devices, so it will send those hello packets back and forth so it can populate its neighbors table. Let's use an example. Say we are starting up router 3, and router 3 starts sending out hello packets out to R2, R2 starts sending hello packets out to R3, and then their neighbor tables get populated with that information.
Then what happens is router 2 is going to send a database packet to router 3, and router 3 is going to see all of the information that router 2 has been keeping track of. Router 3 says, well, mine is not populated because we just turned this on, so it is not filled in yet. So what it is going to do is send a request to router 2. It is going to do a link state request and say, I want that information, can you give me that information. Router 2 will then send a link state update back and say, okay, here is the information that you requested, and then finally router 3 will send an acknowledgment.
So what is a link state advertisement? This link state advertisement is the details of that. We see these different links, and we are going to have a link state advertisement for each one of those links. That is why we also need the link state ID, so it can actually figure out what I am requesting, what do you have, and what am I requesting for each one of those links that are in there.
Here is another diagram that displays that information a little differently, and I think it will help drive home this point. What we have here is the ethernet frame. The ethernet frame has a header on it, the layer 2 header, and I have also included the layer 3 header, so that is going to be just the standard layer 2 and layer 3 information that we have already been talking about throughout this whole course, and the layer 2 trailer, same thing right there.
But what we have here is the OSPF header, and the fields of the OSPF header are going to remain the same throughout this communication. The information in the fields will change depending on which router is talking to which router, so that information will change a little bit within those fields, but the fields themselves are all going to be the same fields.
Now we have a hello packet right here, which is a type 1. What does the hello packet look like? It starts out by having some information and then it will list out all of the neighbors that it has. I have given an example of five here; maybe it just has two, maybe it has more than five. It will vary in size depending on how many neighbors it needs to list and send with this hello packet.
Then we have the database packet, which is a type 2. The database packet has information in it that is being passed back and forth, and then it also has an LSA header, so all of the LSA headers. Once again there would be a lot of different link state advertisement headers in here, and this passes link state header information from router to router so the router can see if it needs to get an update to any one of these link states and get information on any one of these link states.
Then we have the link state request, which is a type 3. The link state request has many different requests in it. It is a very simplistic packet, and we will see that here in a little bit, but it just requests, hey, I would like to get an update to this link state.
Then the response to that is a type 4, and there is its sequence, so it will have some numbers in there, and then the link state advertisements will consist of a header and some information, so this is really the full link state here.
And then the acknowledgment that is sent back is a type 5. It has some information here and it will send back the link state advertisement headers.
If we have two routers that are talking back and forth to each other, the first thing they are going to do is establish an adjacency, and they are going to do that with hello packets.
The hello packet starts out with the network mask, so what is the network. It is going to give the hello interval, which is how often they are going to chat back and forth, how often they are going to send hello packets back and forth. That acts as what is called a keep alive, just making sure, hey, are you still out there, this is my information, I am still up. So it is just a reminder, I am still up, I am still up, and it is sent out every 10 seconds or every 30 seconds.
Then we have some options that we can configure on here, and we also have the priority: what is the priority of the router. We are going to get into priority in a little bit. It has the router dead interval, which we will get into as well; it is similar to the hello interval right there.
And then we have the designated router. As I mentioned, we will talk more about the designated router and the backup designated router, but essentially this is just one router telling the other router who it deems as being the designated router and the backup designated router.
And then it lists all of the neighbor router IDs. The RID is the router ID, so if router 2 is talking to router 1 and sending this information to router 1, then it is giving it all of its neighbors that it sees, so router one, two, three, four, five. Or maybe it just has a couple, then it would only send a couple over there. However many neighbors it has, it will send over.
The database packet first of all has some information in the first eight bytes up here. One of the things it has is the interface MTU. This just allows the other router to know what is the maximum amount of data that it can send over to this device without fragmenting the data, so that is the interface MTU. We have got some options that we can set in here, we have got some flags that are in here, and we have a sequence number, and the sequence number is to track which database packets are which database packets. We do not need to go in great detail about this, just know that those fields are in there.
And then it has all of the high level link state advertisement header that is in here, so things like the link state age, options, types, link state ID. Each of your links is going to get an ID, so this is the link state ID, which router is advertising that particular link, the link state sequence number, a checksum and a length. I am not going to go real in depth into all of these, but just know that this is the link state header, and then you would have another link state header down here. We would have multiple link state headers attached to this, and it is just information about each one of those links, describing those links and giving some detail about those links.
The link state request packet here has much more simplistic information. It just really needs to pass over the link state ID and a couple other pieces of information that say, hey, I would like to find out more information about that header. You sent me a header, I do not know the rest of the information.
In response to that request, a link state update will be sent out, and it will have all of the information for each of the link state advertisements that were requested. It is the complete link state advertisement, so it includes the header part of this, which is something that we have seen a few times already.
One of the things that is in this is the link state type, and the link state type will determine what is down here in this payload right here. So the link state advertisement information, this size, is going to depend on what type it is, and there are a lot of different types, and we will discuss some of those types here. Essentially all of the link state information is being sent over in this link state update.
Of course there can be multiple updates to this, and since there can be multiple updates it needs to know how many updates there are, so here we have the number of link state advertisements that are in this update.
And then that information is acknowledged with the link state acknowledgment. The link state acknowledgment just has the LSA headers of each of the link states that was sent to that router.
Here is the link state advertisement by itself. We see quite a bit of information in each one of these advertisements. Each one of these link state advertisements would represent one of the links, and each one of those links would have a link ID.
We have already talked about how I am calling this top part the header right here, and the header can be found in both the database packets that are sent out and also in the link state acknowledgments that are sent out. There is a section of the header here, the link state ID, the link state type and the advertising router, so these three components right here can be found in the link state request. And then all of this link state is found in the link state update; in fact the link state update can have multiples of these, to include whatever information is in here.
We have already said the LS type is going to determine what information is down here in this LSA information.
So what are the different LSA types? There are a lot of different types of networks out there and we need to represent what these different types of networks are, and OSPF will treat those different types of networks a little differently. I am not going to get into a huge definition, just know that they are different, and depending on which LSA type it is we will have different information in there.
It is interesting how OSPF goes and defines all these different scenarios so it can treat each one of those areas a little differently. There are actually a few others that I have seen out there, but for the most part this is the high level of what the different LSA types are out there.
I would really get back to this slide, which we have already looked at. This slide really outlines the whole summary of everything that we talked about, to include the OSPF header right here, which has certain information that is being passed back and forth between two routers. It lets them know, hey, I am talking to you and I am talking this OSPF language, and some details about those routers.
And then it gets into the different types. We have a type one through five with each one of these. The hello type is information to set up these neighborships, these adjacencies. It has got some information, and then it has got the different neighbors, all the neighbors that are attached to that router. We have got the database type, which has some information like the sequence number, and then it has these LSA headers involved in it. We have got the link state request, where it takes some of the information from those link state headers and says, I want to find out more information about that. And then what is sent back is a link state update that says, oh, you wanted to find out more information, so here is the information, the full link state advertisement of the link states you requested. And then it gives a number, the number of link state advertisements.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →