OSPF routers exchange LSAs by flooding them to all OSPF neighbors. This flooding results in creating the same Link-State Database (LSDB) on all routers in the area. LSDB is a topology database, (kind of a "road map"), shared by all routers in the area. Then, each router runs Dijkstra's SPF algorithm to choose the best path to each destination, placing itself as a the root (starting point). The product of SPF algorithm operation is the routing table. Recall that all OSPF packets are encapsulated in the OSPF header (loot at previous post). So, LSAs are signed with the Router ID when the router originates and floods them.
So what is this Router ID in the OSPF world?
Router ID is going to be chosen automatically unless configured manually, using the 'router-id A.B.C.D' command in OSPF configuration context. The A.B.C.D are four bytes just like an IP address representing the router ID. It can be changed at a later stage but this may require the process clearing (once the router had its ID chosen, changing it always requires this command):
R1#clear ip ospf process
Clearing the OSPF process is disruptive since the router will need to re-establish adjacency with its neighbors.
Initially, a router tries to choose its ID based on the following order of operation:
- Router chooses numerically the highest IP address off of the loopback interface.
- In case there is no loopback interface configured, the router is going to choose numerically the highest IP address off of the physical interface.
You can find in more in-depth information with regards to the applications of router ID in my Cisco Advanced Study Blog (short, practical posts geared for the CCNPs who want to refresh their skills and primarily for those who want to go beyond the CCNP level).
Another concept that requires some explanation is the election of Designated Router (DR) and Backup Designated Router (BDR) elected on Broadcast and NBMA networks (such as Frame-Relay, ATM, X.25). It is a role that is valid on per link basis (Broadcast and NBMA). This means that a router can be DR on F0/0 interface (segment of the network) but BDR or DRother on F0/1 interface.
As you recall, all routers need to establish adjacency (full state) with their neighbors. Only then, are their LSDBs synchronized. The process of sending updates to a great number of neighbors in Broadcast and NBMA networks would be very inefficient as their number can be significant. The routers would create the number of adjacencies according to the following (full mesh) formula:
Number_of_Adjacencies = n(n-1)/2
where the 'n' stands for the number of routers neighbored. In case an LSU (update) is sent, there would be a number of exchanges occurring between all neighbors according to the following formula:
Number_of_LSA_Exchanges = n raised to the power of 2.
Consider the following picture.
Pic. 1 - Broadcast Network with Four Routers.
The next picture shows in part the LSU propagation of the same failed network on R3. This is only a partial picture. This would have to be done 16 times.
Pic. 2 - Partial LSU Exchange with 4 Routers.
This situation would be very chaotic indeed. Instead, the system on Broadcast and NBMA networks elect one representative called Designated Router which is going to be responsible for propagation of all updates on this segment. In case of the failure of DR there is going to be a Backup Designated Router elected to assume the role of DR. These roles are initially based on the highest 'priority number' assigned on the interface. The default number is 1, so in case of a tie, the highest Router ID is becoming DR and the second highest becomes the BDR. If a router's interface is set to the priority value of 0, the router automatically becomes DRother and does not participate in the election process.
DR is the only router authorized to pass the updates on to other routers on Broadcast and NBMA networks. It must have FULL reachability to other routers on the segment.
This is the reason, there are two different addresses reserved for OSPF:
- 126.96.36.199 - All OSPF enabled routers listen to this address.
- 188.8.131.52 - DR/BDR router listen to this address.
Updates are sent 184.108.40.206 except Broadcast and NBMA network which use 220.127.116.11 address instead.
So, in our example (pic 1, and pic.2), if R3 loses its directly connected network, it sends the update towards 18.104.22.168 (to DR/BDR), and DR is sending this back to all other routers using 22.214.171.124 address. R3 is also going to receive it, but it will silently ignore it as it is the same update (sequence number). Consider the below picture.
Pic. 3 - DR/BDR Elected on Broadcast and NBMA Networks.
This post ends the theory aspects in relation to OSPF in one area as per CCNA requirements.
In the next post, I will finally put this OSPF knowledge into practice. Then, we will troubleshoot OSPF using the tools learned in the next one.