Open shortest path first (OSPF) is a link-state routing protocol which is used to find the best path between the source and the destination router using its own shortest path first (SPF) algorithm. A link-state routing protocol is a protocol which uses the concept of triggered updates, i.e., if there is a change observed in the learned routing table then the updates are triggered only, not like the distance-vector routing protocol where the routing table are exchanged at a period of time.
Open shortest path first (OSPF) is developed by Internet Engineering Task Force (IETF) as one of the Interior Gateway Protocol (IGP), i.e., the protocol which aims at moving the packet within a large autonomous system or routing domain. It is a network layer protocol which works on the protocol number 89 and uses AD value 110. OSPF uses multicast address 18.104.22.168 for normal communication and 22.214.171.124 for update to designated router(DR)/Backup Designated Router (BDR).
To form neighbourship in OSPF, there is a criteria for both the routers:
- It should be present in same area
- Router I’d must be unique
- Subnet mask should be same
- Hello and dead timer should be same
- Stub flag must match
- Authentication must match
OSPF supports NULL, plain text, MD5 authentication.
Note – Both the routers (neighbors) should have same type of authentication enabled. e.g- if one neighbor has MD5 authentication enabled then other should also have MD5 authentication enabled.
OSPF messages –
OSPF uses certain messages for the communication between the routers operating OSPF.
- Hello message – These are keep alive messages used for neighbor discovery /recovery. These are exchanged in every 10 seconds. This include following information : Router I’d, Hello/dead interval, Area I’d, Router priority, DR and BDR IP address, authentication data.
- Database Description (DBD) – It is the OSPF routes of the router. This contains topology of an AS or an area (routing domain).
- Link state request (LSR) – When a router receive DBD, it compares it with its own DBD. If the DBD received has some more updates than its own DBD then LSR is being sent to its neighbor.
- Link state update (LSU) – When a router receives LSR, it responds with LSU message containing the details requested.
- Link state acknowledgement – This provides reliability to the link state exchange process. It is sent as the acknowledgement of LSU.
- Link state advertisement (LSA) – It is an OSPF data packet that contains link-state routing information, shared only with the routers to which adjacency has been formed.
Note – Link State Advertisement and Link State Acknowledgement both are different messages.
- Hello timer – The interval in which OSPF router sends a hello message on an interface. It is 10 seconds by default.
- Dead timer – The interval in which the neighbor will be declared dead if it is not able to send the hello packet . It is 40 seconds by default.It is usually 4 times the hello interval but can be configured manually according to need.
OSPF supports/provides/advantages –
- Both IPv4 and IPv6 routed protocols
- Load balancing with equal cost routes for same destination
- VLSM and route summarization
- Unlimited hop counts
- Trigger updates for fast convergence
- A loop free topology using SPF algorithm
- Run on most routers
- Classless protocol
There are some disadvantages of OSPF like, it requires extra CPU process to run SPF algorithm, requires more RAM to store adjacency topology and more complex to setup and hard to troubleshoot.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Differences between TCP and UDP
- Asynchronous serial data transfer
- Computer Network | Bit Stuffing
- Bit stuffing using Java | Computer Networks
- Computer Network | Difference between layer-2 and layer-3 switches
- Computer Network | Challenge Handshake Authentication Protocol (CHAP)
- Recovering password in Cisco routers
- Computer Network | Algorithm for Dynamic Time out timer Calculation
- Ping in C
- Computer Network | Token Ring frame format