This is the first section of 1.10 for the CCNP Enarsi – OSPF. Before we actually get into troubleshooting OSPF it is a good idea for us all to be on the same page on what OSPF actually is. Especially if you need a refresher. For the CCNP OSPF is essential.
What is OSPF?
OSPF (Open Shortest Path First) is a link state routing protocol. What exactly is a Link State Routing Protocol? The main goal of LSRP is to ensure that every router (such as OSPF/IS-IS) builds a topology of the whole network.
- OSPF uses neighbour discovery – Every router participating in OSPF will send to eachother a ‘hello’ packet to eachother. These hello packets are used to dynamically discover eachother, exchange information on their connected neighbours and can also be used as a keepalive mechamism.
- OSPF Topology Database Exchanges – OSPF uses five different types of packets to exchange their topology databases to eachother.
- Dijkstra’s Shortest Path First Algorithm – This is an algorithm used to calculate the shortest path towards a route advertised by OSPF. SPF builds a comprehensive tree of all available links, ensuring efficient routing by determining the optimal path from a given root node to all other nodes in the network. Every OSPF router believe’s itself to be the root when it calculates the shortest path.
Example of OSPF initial Neighbour Discovery:
OSPF High Level Operation:
Link State Routing Protocols will advertise out routes to their neighbours but once they have been installed into the routing table, hello packets will be exchanged between both routers. Why? Because there is a specific HelloInterval timer that refreshes the route. We will discuss hello packet in extensive detail in another post.
- OSPF packets are sent to the Multicast 224.0.0.5 – This is the all OSPF multicast address, also known as the ‘AllSPFRouters’. A multicast address is where router’s who are interested in this specific multicast group (OSPF in this case) join the group and receieve OSPF messages. In reality, this membership join will happen once OSPF is enabled on the router. Once its enabled a hello packet will be sent out.
- OSPF can also receives packets on 224.0.0.6 – This is for ‘AllDRouters’ multicast group. This is dependant on the network type. In essence both the DR/BDR (Designated/Backup Designated Routers) must be prepared to respond to packets recieved on this multicast address. Certain messages in OSPF is sent to this address.
- OSPF does NOT use TCP/UDP port numbers. It uses an IP Protocol number 89.
- OSPF uses a concept called ‘Areas‘. Areas are critical to understand in OSPF. These are logical areas configured on OSPF router’s in which you decide which of their link’s are in which area, which is great for scalability reasons. In CCNA you should (probably) have studied single-area OSPF. This is where there is no logical subdivision configured and all links/router’s are in one area known as Area 0. You wont encounter any configuration issues doing this…but there are downsides to single-area OSPF.
- Area 0 – This is a special area known as the backbone. All router’s that have links in one or more areas must connect to this backbone area. These router’s are known as Area Border Router’s(ABR) and are used to facilitate communication between areas.
- Inter-Area Routes – These are routes that are shared between different areas.
- Intra-Area Routes – These are routes that are only within that specific area.
Link State Advertisement (LSA):
A link state advertisement (LSA) happens when a full OSPF adjacency is reached. A Type 1 Router LSA is flooded out WITHIN an area and cannot be flooded to separate areas. For example, we cannot have a Type 1 LSA flooded from Area 1 into Area 2. An ABR will not allow this.
A Type 1 Router LSA includes information such as:
- Router ID: Identifies the router that generated the LSA.
- Links: Lists all directly connected links (interfaces) of the router and who their neighbour is.
- IP/Subnet Mask: Includes information on the IP/Subnet of the router & neighbours.
- Link States: Includes the type of each link (e.g., point-to-point, broadcast, etc.).
- Costs: Specifies the cost (metric) associated with each link.
- Area Scope: Flooded within a single OSPF area.
We will discuss LSA’s and full OSPF adjacency in more detail later on.
Link State DataBase (LSDB):
A Link State Database is a database that contains all the LSA’s received within that area. All routers within an Area MUST have the same LSDB. If they dont have the same LSDB then an OSPF Adjacency wont form.
Rules of OSPF:
Inter-Area Routing Communication

- Inter-Area Routes – Whenever we want to share routes between different areas like in the example above, we MUST have an Area Border Router that connects that area to area 0.
- An ABR can connect to one or more areas as long as it also connects to Area 0.
- It is upto up to decide how many area’s we use. However, it is standard practice to have around 30-40 router links within an area.
- Also, technically OSPF does not consider a router as within an area, it considers the interface upon which OSPF has been enabled on (either via interface command or under the network command) as a link within that area.
Direct Links between Areas:

- We cannot have two routers in different areas directly connected and sharing routes.
- Why? Because, all inter-area routing communication MUST go through the ABR before reaching the intended area.
- Even if we configured the link connecting both routers to be in the same area, this will not allow them to share routes. Why? because their other link is connected to a different area and not connected to the ABR.
- The same restriction applies if we connect two routers but put them in different areas.
- The golden rule is all inter-area route communication must go through the ABR.
Why use Areas?
Technically, there is no restriction on putting all router links in area 0. OSPF will still work fine. There would not be any ABR as there is no need for inter-area routes to be exchanged.
However, there are reasons as to why we should have OSPF designed and router links to be segmented into different areas. Primarily:
- LSA Flooding – When OSPF is enabled on a link, and an adjacency is formed, a Type 1 Router LSA is flooded out within the area. This is how all routers within an area have the same LSDB. Without having the same LSDB, an Adjacency will not be formed. This is normal operation.
- SPF Calculation – The issue arises that whenever a new link comes up, the Shortest Path First Algorithm is run in order for a router to calculate its best path to a destination advertised in the LSA. But it also does the same when an LSA has been poisoned or a link has gone down. it will run through the WHOLE SPF calculation, because the LSDB has changed and it needs to recalculate its best path to each destination.
- Link Flaps – If we have a link flap within an single-area setup, a new Type 1 Router LSA will be flooded out within area 0, the SPF tree for EVERY router within this area will be torn down and rebuilt, this will cause significant CPU usage as it is intensive to tear and rebuild an SPF tree. If we have 500+ routers in a single area, and a link flap happens, this will cause sigificant issues.
Benefit of Areas:
- LSA Flooding – Type 1 Router LSA’s-and Type 2 LSA’s- cannot leave an area. The topology of one area is independant of another area. An ABR also cannot inject a Type 1/2 LSA into another area. This means, if a link flap happens in Area 1, it wont affect area 2, because the topology change happening in area 1 is not relevant to area 2. However, the ABR may indirectly update this change with a summary LSA. Type 2/3 LSA’s will be discussed later.
- Scalability – Areas also are good for scalability. It allows us to place a set number-usually 30/40-of routers within an area without facing extensive link/SPF flaps.
Area 0 & ABR’s:
- As mentioned, an ABR is used to connect non-backbone areas (anything 1+) to the backbone area (Area 0).
- An ABR does not advertise type 1/2 LSA’s into different areas. Instead it summarises subnets between areas.
- Remember, that an ABR must have a link within its internal area, and its LSDB must match all the routers within its area.
- An ABR can have more than one LSDB. One of them will be area 0, but it can have two or more other. By definition as long as it has two LSDB’s it is an ABR.
- A type 1 LSA includes information of essentially routes to subnets of connected routers/neighbours within that area. So how do we inject this into other area’s if type 1 LSA’s are blocked by the ABR? An ABR does this by generating something called a Type 3 Summary LSA.
Type 3 Summary LSA:
- A router within an area (such as area 1) will flood a type 1/2 LSA to every router within that area including the ABR. Once they all have the same LSDB -> The ABR will create a type 3 Summary LSA and inject this into area 0.
- The other ABR’s within area 0 will receive this type 3 LSA – because once again, all routers within an area must have the same LSDB – and the receving ABR’s will strip off the network information from the summary LSA and inject/advetise its own Type 3 LSA into its area. This will be flooded within that internal area and all routers within the area should have the same LSDB.
- We will discuss type 3 LSA’s in more detail later.
OSPF Configuration & Verification:
There are two ways to configure OSPF on a router. These are:
Command | Explanation |
router ospf <process-id> | •This is done in global configuration mode. •The process-ID is locally significant. •When it comes to configuring an ABR DO NOT create two separate processes! It must be done under aingle process-id and we then specify the area afterwards. |
Network [IP Subnet] [Wildcard Mask] area <area-number> | •This is done under the Process-ID specified above. •To make a device an ABR, it is here where we would specify two network statements with two different area numbers for its different links. Example: Network x.x.x.x x.x.x.x area 0 Network x.x.x.x x.x.x.x area 1 •It is very easy to forget this and do it in two separate process-ID’s, something that caused me a massive issue as it doesnt generate type 3 LSA’s. |
IP ospf <process-ID> area <area-number> | •This is configured under the interface. Example: •conf t > interface GigabitEthernetX/X > ip ospf x area x |
Router-ID <ip address> | •This is configured under the OSPF process, even if OSPf is configured under interface like above. Example: •conf t > router ospf x > router-ID x.x.x.x |
(Verification) Show run | section ospf | •This command verifies the OSPF configuration. |
(verification) Show run interface | •This is just an overall useful command not just for OSPF. This will display the interface configuration. |
- OSPF works on a most specific use case, so if we have multiple network commands which match the same interface (e.g. 10.0.0.0 0.0.255.255, 10.0.0.0 0.0.0.255) the OSPF process will pick the most specific one with the more specific wildcard mask.
- OSPF also uses router-ID’s to identify itself. Manually specified cost is most preferred > Then Loopback > Then highest IP address on the physical interface.
Summary:
Below is a summary of all the important points:
- OSPF is a link state routing protocol. It is used to dynamically discover neighbours and dynamically share routes between eachother.
- OSPF sends hello messages first to dynamically discover neighbours and also uses it as a keepalive mechamism. Router-ID’s are used for these routers to identify themselves.
- OSPF uses LSA’s (Link State Advertisements) to advertise information about itself and its connected neighbours and floods this out within that area. This is known as a Type 1 LSA.
- Within an area, ALL routers must have the same LSDB. Without this, an OSPF adjacency will not form.
- OSPF uses the concept of an ABR (Area Border Router) which is a router that is connected to area 0 and connected to a different area. It is primarily used to exchange inter-area routes.
- OSPF can be configured under the OSPF process via the network command, or it can be configured under an interface.
Additional Resources:
I am massively in favour of learning from different resoruces. Here are my favourite for OSPF:
https://www.ietf.org/rfc/rfc2328.txt – RFC 2328 OSPF Version 2. Or you can download/view below: