OSPF Synchronization: Expert Reference Series of White Papers

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Expert Reference Series of White Papers

OSPF Synchronization

1-800-COURSES www.globalknowledge.com
OSPF Synchronization
Al Friebe, CCDA, CCDP, CCNA, CCNP, A+, CCSI

Open Shortest Path First (OSPF) Protocols


With IP there are two Link-State protocols in use, OSPF and IS-IS (Intermediate System to Intermediate System).
Both work in pretty much the same way, but OSPF is more commonly used.

In an OSPF router, the topology database is referred to as the Link State Database (LSDB). The LSDB contains
the detailed information that a router has regarding the topology of the internetwork. Each entry in the LSDB is
called a Link State Advertisement (LSA). In OSPF, there are five packet types used.
• Hello: Used to build and maintain neighbor relationships
• DBD: Database Description, a summary of the LSDB
• LSR: Link State Request, used to request one or more missing LSAs
• LSU: Link State Update, used to send one or more LSAs
• LSAck: Link State Acknowledgement, used to acknowledge receipt of a LSU

When a new neighbor is found, an OSPF router’s goal is to synchronize its LSDB with that of the neighbor. By
synchronize, we mean make the LSDBs consistent, so that they contain the same LSAs. To accomplish this, the
routers compare LSDBs and any LSA that a router is missing, it requests from the neighbor. During this process,
the neighbors proceed through the following OSPF states.
• Down: The start of the neighbor process
• Init: The neighbor relationship is being initialized
• Two-Way: The neighbor relationship has been confirmed
• Exstart: The routers negotiate which sends its DBD first
• Exchange: The DBDs are being exchanged
• Loading: The LSRs and LSUs are being exchanged
• Full: The LSDBs are synchronized

Two OSPF neighbors-to-be begin in the Down state. Once one of the potential neighbors has sent a hello, the
neighbors move to Init state. To go further, the routers must agree on the following items with regard to the
link that connects them.
• The subnet of the link
• The OSPF Hello and Dead intervals for the link

Copyright ©2010 Global Knowledge Training LLC. All rights reserved. 2


• The OSPF area within which the link resides
• Whether or not that area is an OSPF “stub” area
• Authentication type and keystring (if configured)

Assuming that the conditions are met, the neighbors proceed to Two-Way, which means that the neighbor
relationship has been confirmed.

In the case of a point-to-point link (such as a serial link running HDLC or PPP), once the routers are Two-Way,
they immediately proceed through Exstart, Exchange, and Loading, to Full state. Once they’ve reached Full
state, their LSDBs are synchronized.

Once the LSDB synch is complete, a router runs the Shortest Path First (SPF) algorithm, generating its routing
table. In OSPF the metric is cost, and SPF finds the lowest cost path to each destination prefix. After the routing
tables have been generated, the network is converged. The goal is to maintain full state (LSDB synchronization)
with the neighbors.

Note that SPF is where OSPF gets its name: it’s an Open (non-proprietary) protocol that uses SPF.
The SPF algorithm is commonly referred to as Dijkstra’s Algorithm, after Edsger Dijkstra (pronounced
Dike-stra), the computer scientist who developed it.

Let’s say that router R1 senses a topology change, such as gaining or losing a link. It will then update the R1
LSA in its LSDB, flood a copy of the revised R1 LSA to its neighbors, and run SPF to regenerate its routing table.
R1’s neighbors will acknowledge receipt of R1’s revised LSA, replace the old R1 LSA in their LSDBs with the new
R1 LSA, flood the new R1 LSA to their neighbors, and run SPF.

In this manner, the new R1 LSA propagates throughout the internetwork and, as it does, it updates the LSDB,
triggers SPF, and regenerates the routing table of each router. Once this process is complete (and it typically
takes only seconds), routing is again converged.

LSUs are sent only when changes occur (that is, they’re triggered updates), so in between LSUs a router sends
periodic Hellos to reassure its neighbors of its continued presence. Since Hellos are small, they don’t take
much bandwidth or CPU power to process, and can be sent relatively frequently (every few seconds is typical).
Because changes are only being advertised when they occur, the result is that Link-State protocols such as OSPF
scale better than Distance-Vector protocols like RIP, which periodically flood the entire routing table even in the
absence of any changes.

So that all routers know which router originated which LSA, each LSA is uniquely identified by the originating
router’s OSPF router ID. Like an IP address, an OSPF router ID is a 32-bit binary value that is commonly repre-
sented in dotted-decimal format. An OSPF router ID is assigned or selected as follows.
• If a “router-id” command appears under the OSPF process, that’s it.
Copyright ©2010 Global Knowledge Training LLC. All rights reserved. 3
• If not, it’s the highest IP address amongst the active loopback interfaces.
• If there are no active loopbacks; it’s the highest IP address amongst the active physical interfaces.

By active we mean not Administratively Down. In other words, a physical interface that’s Up/Down or
Down/Down is still a candidate for OSPF router ID.

Note that although an OSPF router ID looks like an IP address, and may have been derived from an IP
address, it is not an IP address. Instead, the router ID is used to uniquely identify the originator of a
particular LSA within the LSDBs.

Key point: If you’re setting the OSPF router IDs manually using either router-id commands or loopbacks, they
had better be unique! If not, corruption of the LSDBs and of the resulting routing tables can occur.

Multi Access Media


On multi-access media such as an Ethernet LAN or a Frame Relay WAN, however, things are more complicated.
Let’s look at an Ethernet LAN as an example. A typical topology is several routers are connected by a switch. As-
suming that the switch ports connected to the routers lie within a common VLAN, the routers are within a com-
mon broadcast domain (an IP subnet). If every router on the subnet directly compares its LSDB to that of each of
its neighbors on that subnet, the number of comparisons is governed by the “full mesh” equation.
• c = n * (n – 1) / 2

Where:
• c = The number of comparisons
• n = The number of routers on the subnet

If we crank through the numbers, we obtain:


• n = 2: c = 1 (two routers on a point-to-point link)
• n = 3: c = 3
• n = 4: c = 6
• n = 5; c = 10
• n = 6: c = 15
• n = 10: c = 45
• n = 20: c = 190

If there are two routers on the subnet (n = 2), only one comparison is required to ensure LSDB synchronization.
In the case of five routers on the subnet (n = 5), ten comparisons are required. If the number of routers on the

Copyright ©2010 Global Knowledge Training LLC. All rights reserved. 4


subnet doubles to ten (n = 10), the number of comparisons increases to 45. Doubling it again (n = 20) results in
190 comparisons. Thus, as the number of routers doubles, the number of comparisons approximately quadruples,
which is what computer scientists would call O(n2) (order n-squared), an exponential increase.

Also, once Full state is achieved, maintaining it requires that any router that detects a change to its LSDB will
send an update to each of the other routers on the subnet, each of which will then inform every other router on
the subnet, etc. When many routers are involved, the large number of LSUs and LSAcks will consume excessive
link bandwidth and router CPU cycles.

To solve this scalability problem, once the neighbors have reached Two-Way, multi-access media can elect a
Designated Router (DR). The DR’s job is to maintain synchronization of the LSDBs for all routers within a subnet.

To elect the DR, the routers compare their DR election priorities, which are contained within the Hello packets.
The DR priority is set per interface (or subinterface), and ranges from zero to 255, with a default value of 1. High
priority wins, and the tie-breaker is highest OSPF router ID. The first runner-up is elected Backup DR (BDR). If the
DR ever becomes unavailable, the BDR is promoted to DR, and a new BDR is elected.

Once the DR and BDR for the subnet have been elected, all other routers in the subnet will synchronize their
LSDBs (go to Full state) with the DR. This has the effect of synchronizing all LSDBs on the subnet. Because all
routers on the subnet directly synchronize with the DR, they become synchronized with each other without hav-
ing to directly compare their LSDBs. The equation controlling the number of comparison is now:
• c = n – 1

The number of comparisons now increases linearly with the number of routers on the subnet, and we have:
• n = 2: c = 1 (two routers on a point-to-point link)
• n = 3: c = 2
• n = 4: c = 3
• n = 5; c = 4
• n = 6: c = 5
• n = 10: c = 9
• n = 20: c = 19

Whenever a change to the topology occurs, the router detecting the change will inform the DR, which will
inform the other routers on the subnet. Those routers will then flood the LSA to other subnets to which they are
attached. In this manner, LSDB synchronization is maintained between the routers within the subnet.

Copyright ©2010 Global Knowledge Training LLC. All rights reserved. 5


Learn More
Learn more about how you can improve productivity, enhance efficiency, and sharpen your competitive edge.
Check out the following Global Knowledge courses:
ROUTE - Implementing Cisco IP Routing v1.0
ICND2 - Interconnecting Cisco Network Devices 2

For more information or to register, visit www.globalknowledge.com or call 1-800-COURSES to speak with a
sales representative.

Our courses and enhanced, hands-on labs and exercises offer practical skills and tips that you can immediately
put to use. Our expert instructors draw upon their experiences to help you understand key concepts and how to
apply them to your specific work situation. Choose from our more than 1,200 courses, delivered through Class-
rooms, e-Learning, and On-site sessions, to meet your IT and business training needs.

About the Author


Al Friebe (CCDA, CCDP, CCNA, CCNP, A+, CCSI) has taught networking classes since 1995. He previously served
as Global Knowledge’s Course Director for BGP and BSCI, and he is the author of our current ICND2 labs. His
previous experience includes instructor duty in the U.S. Navy’s Nuclear Power School, radio-chemistry, software
engineering, and network management.

Copyright ©2010 Global Knowledge Training LLC. All rights reserved. 6

You might also like