OSPF Explained

There are 5 types of internal gateway routing protocols and OSPF is one of them. But what makes it so special? One of the best things about OSPF is that it is open source in nature meaning, it can run on routers manufactured by different vendors. OSPF is a link-state internal gateway protocol that follows Dijkstra algorithm. It’s administrative distance is 110 and uses multicast addresses 224.0.0.5 and 224.0.0.6 for exchanging information between it’s neighbors. It uses cost as it’s metric and IP port 89 for packet transfer.

In this post you will learn about- OSPF tables, Types of routers, LSA types, OSPF packet types , OSPF states and OSPF areas

OSPF Tables

1. Neighbor Table- Stores information about neighboring OSPF routers.

Command- show ip ospf neighbor

2. Topology Table- Stores all possible routes learned from neighboring routers.

Command- show ip ospf database

3. Routing Table- Stores only best path to destination.

Command- show ip route ospf

OSPF Routers

1. Area Border Router (ABR)- Routers that are located on the borders of each OSPF area and are connected to multiple areas, are known as ABRs. In addition, ABRs summarize IP addresses of each OSPF area.

2. Autonomous System Border Router (ASBR)- Similar to ABRs, ASBRs are connected to different OSPF areas, however, they are also connected to routers with different routing protocols like EIGRP, EGP etc.

3. Designated Router (DR)- DR generates LSAs and exchange information with other routers in the same area. DR uses multicast address 224.0.0.5 to send updates to other routers and all routers except DR uses the multicast address 224.0.0.6 to send LSU and LSA packets to the DR.

DR Election- DR is elected by routers on the basis of router priority. The router with highest priority is elected as DR.

4. Backup Designated Router (BDR)- As you might have guessed by the name, BDR is a backup designated router in case the actual designated router fails. In case of a DR failure, BDR is will act as a DR and a new BDR will be elected.

BDR Election- BDR is elected by routers on the basis of router priority. The router with second highest priority is elected as BDR.

OSPF LSA Types

Before moving forward with this topic, let’s have a brief look at LSA. Link State Advertisements (LSAs) are information about routes that are transported inside Link State Updates (LSUs). Each LSU packet contains one or more LSAs, and when an LSU is sent between routers, it floods the LSA information through the network. This is also known as LSDB flooding. Receiving OSPF routers store LSAs inside Link State Database (LSDB). Once LSDBs between the routers sync, OSPF finds a best path using Spanning Tree Protocol (STP) algorithm for each network.

LSA header content- LS age (2 Bytes), Options (1 Byte), LS Type (1 Byte), LS ID (4 Bytes), Advertising router (4 Bytes), LS sequence number (4 Bytes), LS checksum (2 Bytes), Length (2 Bytes)

1. Router LSA- Also known as Type 1 LSAs, are sent between routers within the same area. These carries information about the interfaces of router and it’s adjacent neighbors.

2. Network LSA- Also known as Type 2 LSAs, are generated and flooded between the routers in the same area by the Designated Router (DR) in order to describe directly connected routers.

3. Summary LSA- These are generated by Area Border Routers (ABRs) to advertise directly connected areas to other areas.

4. ASBR Summary LSA- These are generated by ABRs in order to let other routers known where the Autonomous System Border Routers (ASBRs) are located.

5. External LSA- Also known as ASBR External LSAs, are generated by ASBR to advertise external redistribution routes into the OSPF’s autonomous system.

6. Multicast LSA- Supposedly supports multicast routing through OSPF, but is not used much and is anticipated to be outdated soon.

7. NSSA External LSA- Not-so-stubby-area packets are used for the areas which does not allow Type 5 LSA packet. NSSA External LSA acts as a mask to Type 5 LSA packets and help them move through these areas.

OSPF Packet Types

1. Hello– Hello packet is used for discovering, forming and maintaining OSPF neighborship

2. Database Description- DBD is a summary of LSDB, it’s responsibility is to check whether the LSDB between 2 routers is the same. LSDB contains updated link-state information exchanged among the network and all routers within the same area share the same LSDB. When 2 routers form new neighbor adjacencies, they sync their LSDBs to be fully adjacent.

3. Link State Requests- LSR is used for requesting missing LSDB information by OSPF routers.

4. Link State Updates- LSU is a packet in response to LSR. It carries the missing piece of information requested by the OSPF routers.

5. Link State Acknowledgement- Once the OSPF router receives missing LSDB information through LSU, it sends out an LSAck packet to acknowledge the transfer.

OSPF States

In order to become OSPF neighbors, routers need to go through the following states-

1. Down- This state indicates that no hello packets are received from neighbor as yet.

2. Attempt- This state is only valid for manually configured neighbors.

3. Init- This state specifies that the router has received a hello packet from its neighbor, but the receiving router’s ID was not included in the hello packet.

4. Two-way– This state specifies that both routers received hello packets and have each other’s router IDs and a two way communication is established. In the end of this state, DR and BDR are elected.

5. Exstart– Once the DR and BDR are elected, the actual process of exchanging link state information can start between the routers and their DR and BDR. In this state, the routers and their DR/BDR establish a master-slave relationship and choose the initial sequence number for adjacency formation. The router with the higher router ID becomes the master and starts the exchange.

6. Exchange– In this state, OSPF routers exchange Database Descriptor packets.

7. Loading- Based on the information provided by the DBDs, routers send Link State Request (LSR) packets. The neighbor then provides the requested information in Link State Update (LSU) packets. During the adjacency, if a router receives an outdated or missing LSA, it requests that LSA by sending a Link State Request (LSR) packet. After receiving the requested information, routers will send acknowledgement through LSAck packet.

8. Full– This state indicates that routers have completely formed adjacencies with one another and are now sharing synced databases.

OSPF Areas

OSPF implements a 2-layer area architecture- backbone area and non-backbone area. Backbone area is also commonly known as Area 0. This, as the name suggests is the spine of the OSPF network. Every non-backbone area is physically or virtually connected to the OSPF Area 0. Non-backbone areas are where the users are placed. Let’s have a brief look at all non-backbone areas-

1. Standard Area– As mentioned earlier, this area should be connected to the Area 0 of OSPF. This area allows intra-area, inter-area, external and a default routes.

2. Stub Area– Stub areas are typically implemented when routers with limited capacities are used in OSPF networks. These are typically used in hub-and-spoke network. Stub areas accept intra-area routes but do not allow external routes.

3. Totally Stubby Area– This area is Cisco proprietary and does not accept external AS routes or inter-area routes. It only recognizes intra-area routes and the default route.

4. Not So Stubby Area (NSSA)– NSSA allows intra-area, inter-area and the default route (0.0.0.0).

Hope you enjoyed this post, I will be back with another OSPF article soon. Until next time🍹

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s