RouterGod Celebrity Lecture Series.

"Seven of Nine" Lectures On OSPF Part 2

In the first part of this series Seven of Nine informed us of the origins of OSPF.  She invoked the name of John T. Moy, the crazed and misunderstood mathematical genius who discovered this menace.  Through a clerical error, Moy was put in charge of a powerful and clandestine branch of the Government known as the OSPF Task Force.  Soon Moy became mad with power and directed his evil minions to devise a link state protocol.  At the time the ARPANET used RIP, a distance vector protocol.  Distance vector protocols, while inefficient, had many fanatical and dangerous supporters, like Macintosh computers do today.  The Internet community laughed at Moy and his link state protocol.  But he was determined to perfect OSPF or destroy the planet trying.  Moy even went so far as to create an LSA packet so powerful, it could circulate through the Internet for years and never die.  When this killer LSA escaped his lab it crashed the Internet, requiring every router to be rebooted.  After this, the Internet community no longer laughed at the diabolical Moy, they feared him and his network killing LSA's.  Soon, those in authority realized that the IETF should adopt OSPF as a standard if for no other reason than to bring this renegade mathematician back into the fold.  Moy is currently working at Ascend Communications where he is attempting to determine the true value of Pi, to the last digit.  This serves as an abbreviated history of OSPF, and now, with part 2 of her lecture, Seven of Nine:

Half Babe, Half Borg

I bid you greetings.  In today's lecture we will discuss how OSPF enabled routers use the Hello protocol to establish adjacencies and how they elect their leaders.  

When an OSPF router starts it is first in the DOWN state because it has not exchanged information with any other routers.  The first thing it does is send Hello packets out it's interfaces to boast of it's existence.  These Hello packets are sent to a multicast address that OSPF routers are fond of.  The hello packet naturally contains the IP address of the sender so when a router sends a Hello packet in the other direction, it uses this unicast address.  On Broadcast Multi Access networks like Ethernet, Hello packets are sent every 10 seconds by default.  When a router is sending out these Hello Packets, it is in the INIT state.  They are waiting to hear from other OSPF routers.

Once the routers have exchanged Hello Packets, they add their neighbors to their Adjacencies Database.  Now that they know who their neighbors are and have established 2 way communication, they are in the TWO-WAY state.  In the TWO-WAY state, the routers are much like a gang of street thugs, they know who their immediate neighbors are and they want to start some trouble, but they have no leader.  The routers have gone from DOWN to INIT and entered the TWO-WAY state, now they will do something that no other routing protocol does.  The routers will actually elect a leader and a backup leader in case the leader dies.  The IETF didn't expect this from a protocol.  When Moy delivered a finished version of OSPF and it had this ability to create social classes they were both stunned and terrified.  They had simply asked Moy to create a routing protocol, they were unprepared for the pseudo life form that Moy had created.  

Only Known Photo of John T. Moy  

The leader is called the DESIGNATED ROUTER (DR) and the backup leader is the BACKUP DESIGNATED ROUTER (BDR).  If all the routers suddenly were powered up at the same time, they would go though an election process to decide the DR and BDR.  Let's say you have a subnet with 5 routers acting as gateways out of that subnet.  This is not as far out as it seems, you could have 5 Catalyst 6000s trunked together, each with an RSM, each RSM having a VLAN interface in a common subnet.  Anyway, you would have a DR, a BDR and 3 regular OSPF routers.  Routers straddle subnets so it's possible that a router could be a DR on one subnet but not on another.  Each OSPF router has two attributes, a priority and a router ID.  By default all OSPF routers have a priority of 1.  The OSPF specification says that each router will have a unique router ID and that it shall be a "32 bit number".   Everyone was afraid of Moy and no one wanted to ask him how this "32 bit number" was to be arrived at.  The engineers at Cisco decided that a Cisco router would use the highest IP address on any of it's active interfaces. 

When an election is held, the router with the highest priority becomes the DESIGNATED ROUTER.  The router that places second becomes the BDR. Since by default all Cisco routers have a priority of 1, then the router with the higher router ID wins.  If you have a router that you want to ensure has a higher router ID you could create a loop back interface with a high IP address.  Using a loop back address would conserve on your "real" IP addresses but the loop back address will not be seen in the OSPF table and you cannot Ping from it.  

The priority is configurable on a Cisco router as well, for example a router with a priority of 0 will never become a DR.  A router with a priority of 2 would become the DR assuming all the neighboring routers have the default priority of 1.  Here is the command for changing the priority to 3 on the Ethernet 0 interface:

ciscorouter(config)#int e0
ciscorouter(config-if)#ip ospf priority 3

Remember that DRs and BDRs are for multiaccess networks only.  Elections do not occur on Frame Relay links for example.  Once the DR and BDR has been determined, you can routers "till the cows come home" and that won't force a re-election.  OSPF is very stubborn.

We were unable to come up with a caption that wasn't vulgar and immature.


What You Have Learned:

  1. Routers begin in the DOWN state.

  2. They send hello packets in the INIT state.

  3. They create the adjacencies database in the TWO-WAY state.

  4. On Broadcast Multi access networks they elect a DESIGNATED ROUTER and a BACKUP DESIGNATED ROUTER.

  5. The highest priority wins the election.

  6. If 2 routers have the same priority, the highest router ID wins.

  7. The router ID is the highest active IP address on a Cisco router.

  8. You can rig elections by using loopback interfaces or changing the priority.

  9. There is no DR or BDR on non broadcast multi access networks.

  10. Since a router can have different interfaces on different networks, it can be a DR on one network but not another.

  11. Learning technical material is easy when it is being taught by a curvaceous blonde in a skin tight outfit.

Watch for Part III Coming Soon!

Back to main page

Copyright 1999 - 2005 RouterGod Online Magazine