What is Open Shortest Path First (OSPF)?

What is OSPF?

OSPF is a typical Link-state routing protocol, which is generally used in the same routing domain. Here, the routing domain refers to an Autonomous System (AS), which refers to a group of networks that exchange routing information with each other through a unified routing policy or protocol. In this AS, all OSPF routers maintain the same database describing the structure of this AS, which stores the state information of the corresponding links in the routing domain. It is through this database that OSPF routers calculate their OSPF routing tables.

As a link-state routing protocol, OSPF transmits the link-state multicast data LSA(Link State Advertisement) to all routers in a certain area, which is different from the distance vector routing protocol. Routers running distance vector routing protocol pass some or all routing tables to their neighbors.

On the security of information exchange, OSPF stipulates that any information exchange between routers can be Authentication when necessary, so as to ensure that only trusted routers can spread routing information. OSPF supports a variety of authentication mechanisms, and allows different authentication mechanisms to be adopted among different areas. The application of OSPF link state algorithm in broadcast network (such as Ethernet) is optimized to make the best use of hardware broadcast capability to deliver link state messages. Usually, a node in the topology diagram of link state algorithm represents a router. If all k routers are connected to Ethernet, when the link state is broadcast, the number of messages about these k routers will reach k square. Therefore, OSPF allows a node to represent a broadcast network in the topology diagram. All routers in each broadcast network send link status messages to report the link status of the routers in the network.

 

Principle of operation

To put it simply, OSPF means that two adjacent routers become neighbors by sending messages, and then neighbors send link state information to each other to form an adjacent relationship. After that, each router calculates a route according to the shortest path algorithm and puts it in the OSPF routing table. Compared with other routes, OSPF routes are better added to the global routing table. The whole process uses five kinds of messages, three stages and four tables.

Five kinds of messages

Hello message: Establish and maintain neighbor relationship.

DBD message: sends link state header information.

LSR message: Send the required link state header information found out from DBD to neighbors, and request complete information.

LSU message: send complete information corresponding to the header information of LSR request to neighbors.

LSACK: Confirm the LSU message after receiving it.

Three stages

Neighbor discovery: Neighbor relationship is formed by sending Hello message.

Route announcement: Neighbors send link state information to form an adjacency relationship.

Calculation: Calculate the routing table according to the shortest path algorithm.

Four tables

Neighbor table: mainly records the routers that form the neighbor relationship.

Link state database: records link state information.

Routing table: obtained from the link state database.

Global routing table: OSPF routing is compared with others.