Open shortest path first is a routing protocol that determines the shortest distance between two routers in an autonomous system. The OSPF protocol is developed on the basis of link-state routing that we discussed in our previous content. In this section, we will discuss the working of OSPF. We will also discuss the types of links in OSPF and also the types of OSPF packets.
Content: Open Shortest Path First
How Open Shortest Path First Works?
Open shortest path first (OSPF) is a dynamic routing protocol that is developed on the basis of a link-state routing protocol. Being an intradomain routing protocol it helps the routers inside an autonomous system to propagate the routing information to other routers in the domain.
When a router is initialized in the domain, it first determines the cost of the link at each of its interfaces. The router then advertises this information to each and every router in the domain by flooding. So, each router in the domain develops the topology of the entire autonomous system.
To make routing more efficient the OSPF divides the autonomous system into multiple areas. The area can be referred to as a group of networks, hosts, and routers. The routers present in the particular area flood routing information to all other routers of that area. Each area has a distinct identification number.
Among these multiple areas, there is a distinct area which is termed as backbone area whose area identification is zero. Each area in the AS must be connected to this backbone area.
The router connecting the area to the backbone area is referred to as the area border router as you can see in the figure below. An area border router can connect multiple areas to the backbone area, for this one of the interfaces of the area border router must be in the backbone area other interfaces must be in another area.
The routers in the backbone area are referred to as backbone routers. There is also an AS boundary router that propagates routing information of an OSPF network with routers in a non-OSPF network. Due to some reason if the link between an area and a backbone area is broken it is the responsibility of the administrator to establish a virtual link between them.
Types of Links
Administrators of an autonomous system assign a cost to each route or link (connection) to which we refer as a metric. This metric depends on the kind of service the link is providing. So, a router can have multiple routing tables each based on a different kind of service.
The point-to-point link connects two routers directly. There is no router or host in between the two routers connected by a point-to-point link. That means at each end of the point-to-point link there is only one router.
The transient link connects multiple routers to a particular network. LANs and some kind of WANs that have two or more routers are of this kind. The transient link is neither realistic nor it is efficient. As in the OSPF, each router has to advertise its neighborhood to every other router which increases the traffic in the network making it inefficient.
There is no direct link between the pair of routers instead it has a network in between which acts as a crossroad between the pair of routers. Now a network can’t function as a router that supports routing. So, a router is assigned to perform this function and we refer to it as a designated router.
In this scenario, each router has only one neighbor i.e., the designated router, and the designated router has several neighbors.
Stub link connects only one router to the network which is a special kind of transient link. Here the router has only one neighbor (designated router) and even the designated router has only one neighbor (the single router connected to it).
The virtual link is established between the pair of routers if the link between them is broken for any reason. The administrator establishes this virtual link between the pair of routers through a longer path which may include several routers.
The figure below shows an AS in Open Shortest Path First. The pair of routers AD and BE are connected through point-to-point links. The network N1 represents a transient network as it has three neighbors C, A, and B. The network N2 is a stub network that has only one neighbor i.e., router C. We have three stub networks N2, N4, and N5.
The graphical representation of the above AS is shown below. Here the routers are represented using the colored node and the networks are represented using shaded nodes. In the graphical representation, the router and network both are considered nodes.
Types of OSPF Packets
When a router is initialized in the OSPF network it addresses its neighboring router by Hello packet using which it can test the reachability of the neighboring router. Before flooding the routers in the area with the routing information it must address all the routers in the area.
2. Database Description
Whenever a router is introduced in the network for the first time or if it resumes after its failure, it has to gain information about all link-state databases. It cannot just wait for all the other routers to send links state update packets.
So, we have seen above that whenever a router is connected to a domain it sends a Hello packet to all the neighbors. In response to the Hello packet, the neighbor sends the database description packet.
The database description packet doe not contain a detailed description of all the links instead it has an outline of all links.
The newly connected router then checkouts, about which link it does not have any information. The newly connected router then sends one or if required multiple link-state requests to gain a detailed description of that link or links.
3. Link State Request
The link-state request packet is sent by the router which requires information about the particular route. This link-state request packet is then responded with the link-state update packet.
After receiving the database description message the newly connected router sends one or several link-state request messages depending on the number of links about which it has to gain information.
4. Link State Update
The link-state update packets contain a detailed description of the status links of a router generating this packet. A router uses a link-state update packet to advertise the states of links at each of its interfaces. The update packet may contain five different types of link state advertisement (LSA).
a) Router Link LSA
A router uses the router link LSA to advertise the status of all of its links and also about the router’s neighbor connected to the other end of the link.
b) Network Link LSA
This packet is used to inform about the routers connected to the network. usually used by the designated router of the transient network.
c) Summary Link to Network LSA
The area border router uses the summary link to network LSA to advertise the information of the networks outside an area. The area border router is present at the boundary of an area and may have each of its interfaces in a different area i.e., it may be active in more than one area.
The area border router also receives all the router link LSAs and network link LSAs so it creates a routing table for each area it is active in. So, it uses the summary link to the network to inform routers of an area about the existence of other networks outside the area.
d) Summary Link to AS Boundary Router
The AS boundary router uses the summary link to AS boundary router LSA to advertise the route to the AS boundary router. This information is flooded by each area border router into the area in which they are active.
e) External Link
The AS boundary router uses the external link LSA to announce the routers inside an autonomous system about the network available outside the autonomous system.
5. Link State Acknowledgement
The link-state acknowledge packet is sent by the router in response to the link-state update packet. This makes the OSPF protocol more reliable.
So this is all about the Open Shortest Path First protocol which is used to determine the shortest path from a router to other routers in an autonomous system.