OSPF stands for open shortest path first. OSPF is a dynamic routing protocol that comes under IGP(interior gateway protocol). It is also known as link state protocol. It works on shortest path first algorithm (SPF). To advertise routes information OSPF running routers send LSAs to exchange information with neighbors.
This picture is showing how LSA flooding takes place whenever a change occurs in network. You can see, at router 8, a new interface with IP address 172.16.3.1 is added and to notify other routers about this change R8 sent LSAs to their neighbors and neighbors will send to their neighbors and process will go on until all routers don’t get LSA updates.
It is open standard protocol.
In OSPF, no router limit like EIGRP, it supports unlimited routers.
It uses 2 multicast address 220.127.116.11 and 18.104.22.168.
IP protocol = 89, AD value = 110
It supports subnetting.
Wildcard Mask: It is inverted form of subnet mask (1 is replace by 0 and 0 is replaced by 1). Learn step-by-step process to calculate wildcard mask.
For class A subnet mask is 255.0.0.0 and wild card mask is 0.0.0.255.
For class B subnet is 255.255.0.0 and wild card mask is 0.0.255.255.
For class C subnet is 255.255.255.0 and wild card mask is 0.0.0.255.
RID: RID stands for router identity. RID is an unique identity of a router. It is a 32 bit number. OSPF used RID to uniquely identify the router. By default, IOS selects one of its interface IP address as a RID. You can also configure it manually.
Backbone Router: A router that belongs to area 0 is known as backbone router. All routers inside area 0 including ABRs come under backbone routers.
Internal Routers: Routers that lie inside a single area (all interfaces of router should be in same area) are called as internal routers.
ABR (Area Border Router): An OSPF router that belongs to area 0 and at least one other area is called as ABR.
ASBR (Autonomous System Boundary Router): A router that belongs to area 0 and one other area. It is similar definition as ABR, yes it is similar, only one difference, on both interfaces different protocols are running.
OSPF Area Design Conditions
- Area 0 is mandatory.
- All areas should be connected to area 0.
- All areas should be continuous.
Why we use area concept in OSPF?
The straight forward answer for this question is to reduce LSA flooding, we make areas in OSPF. For smaller network single area will not impact the performance. But for larger network, single area is not a good choice. Why?
Here are 3 reasons
1) SPF algorithm takes more time to calculate routes.
2) To manage large database routers require more processing power and memory.
3) If any small changes occurs in the network, LSAs (link state advertisements) are generated and every router flood the LSA to their neighbours and after this again SPF algorithm runs to update their routes.
Case 1: For example in a network, total 100 routers (all are in one area) so when change will occur in the topology, all routers receive LSA updates.
Case 2: Same topology, a network has 100 routers, but this time we divided whole network into areas, so whenever change will occur, routers which reside in the same area where change occurred, only receive the LSA updates.
So, in short you can say to reduce LSA flooding, to reduce processing power and memory we use area concept in OSPF.
- Neighbour Table: Neighbor table contains information about the directly connected ospf neighbors.
- Database Table: Database table contains information about the entire topology with respect to each router.
- Routing Table: Routing table contains a list of the best paths
calculated by the shortest path first(SPF) algorithm.
- DBD (database description)
- LSR (Link State Request)
- LSU (Link State Update)
- LSACK (Link State Acknowledment)
Hello Message: OSPF use hello packets to discover neighbors. The routers which are connected on same link can become neighbors. Hello packets are sent to multicast IP address 22.214.171.124. Inside hello packets, router ID (RID) is exchanged. After exchanging hello packets, neighborship is formed.
Database description (DBD) : After becoming neighbors, both routers exchange DBD summary to each other to synchronise their database.
LSR (Link State Request): After receiving DBD from neighbors, router matches it’s own database with DBD. And if router doesn’t have any route that neighbors have, router send LSR message to ask missing routes information.
LSU (Link State Update): In the response of LSR, neighbor send LSU. Neighbor put all the missing route information in LSU and send to the router.
LSAK (Link State Acknowledge): After receiving LSU, router send a acknowledge message that I have received the LSU message properly.
After, all this process, now both routers have same link state database (LSDB) and now they will form adjacency.
OSPF DR/BDR Election:
DR (Designated Router): DR is like a head of a network whenever a change occurs, routers will send the LSA to DR and BDR only. DR sends LSA to other routers (DRothers).
- DR listens LSAs on multicast address 126.96.36.199.
- DR transmits LSAs to other routers on 188.8.131.52.
- DR ensures that all routers have same synchronised LSDB.
BDR (Backup designated router): BDR takes the responsibility of DR when DR goes down because of any technical issue.
It listens LSAs on 184.108.40.206 and 220.127.116.11.
DRothers: In a network, all routers other than DR and BDR are known as DRothers.
- DRother routers transmit LSAs to DR on 18.104.22.168.
- Listens network LSAs on 22.214.171.124.
OSPF have 2 types of network.
- Point-to-point network
- Broadcast or multiaccess network.
In point-to point network there is no need of DR/BDR election. But in broadcast network DR/BDR election helps in reducing LSA flooding. In broadcast network whenever changes occur (like a link fails or any new link adds) LSAs are generated and flooded throughout the network so that all routers in the topology can update their LSDB (link state database).
Why we need DR/BDR?
To reduce LSA flooding and to improve network performance DR/BDR election is done. Once DR is selected then there is no more LSA flooding in the network, whenever there is any change in topology, instead of sending LSAs to their neighbor, router will only inform to DR on 126.96.36.199 multicast address. And then DR takes care of other routers LSDB, it informs other routers by sending LSAs on 188.8.131.52, so that they can update their LSDB.
Selection criteria for DR (Designated router)
- It checks interface priority. The router which has highest priority is selected as DR. By default, all OSPF interface priority is 1.
- If all routers have same priority then it checks highest RID. The router which has highest RID is selected as DR, and router which has second highest RID is selected as BDR.
By default, IOS select highest IP address as router RID.
In order to select RID, OSPF gives priority to loopback interface over physical interfaces. Reason is loopback are virtual interface, never goes down.