In Network Basics, Network Planning, OSPF on May 31, 2011 by carlosfvc Tagged: , , , , , , , , , , , , , , , , , , , , , ,

– How is OSPF?

OSPF is a fairly complex protocol made up of several protocol handshakes, database advertisements, and packet types.

Link-State Routing Protocols

  • They respond quickly to network changes.
  • They send triggered updates when a network change occurs.
  • They send periodic updates, known as link-state refresh, at long time intervals, such as every 30 minutes.
  • Uses cost as metric.
  • Protocol identifier of 89 in the IP header indicates an OSPF packet
  • Each interface participating in OSPF uses the IP multicast address to periodically send hello packets

Link-state routing protocols generate routing updates only when a change occurs in the network topology.

  1. When a link changes state, the device that detected the change creates a link-state advertisement (LSA) concerning that link.
  2. The LSA propagates to all neighboring devices using a special multicast address.
  3. Each routing device stores the LSA, forwards the LSA to all neighboring devices (in same area).
  4. This flooding of the LSA ensures that all routing devices can update their databases and then update their routing tables to reflect the new topology.
  5. The LSDB is used to calculate the best paths through the network.
  6. Link-state routers find the best paths to a destination by applying Dijkstra’s algorithm, also known as SPF, against the LSDB to build the SPF tree.
  7. Each router selects the best paths from their SPF tree and places them in their routing table.

For all the routers in the network to make consistent routing decisions, each link-state router must keep a record of the following information:

  • Its immediate neighbor routers.
  • All the other routers in the network, or in its area of the network, and their attached networks.
  • The best paths to each destination.

OSPF neighbor table = adjacency database

OSPF topology table = OSPF topology database = LSDB

Routing table = forwarding database

OSPF Area Structure

If an area becomes too big, the following issues need to be addressed:

  • Frequent SPF algorithm calculations.
  • Large routing table— OSPF does not perform route summarization by default.
  • Large LSDB


  • Link-state routing protocols usually reduce the size of the Dijkstra calculations by partitioning the network into areas.

Advantages of OSPF areas

  • Reduced frequency of SPF calculations.
  • Smaller routing tables
  • Reduced LSU overhead

OSPF uses a two-layer area hierarchy:

  • Backbone area
  • Regular (nonbackbone) area – subtypes standard area, stub area, totally stubby area, not-so-stubby area (NSSA), and totally stubby NSSA

• An area should have no more than 50 routers.

• A router should not be in more than three areas.

Area Terminology

  • Internal router
  • Backbone router
  • Area Border Router (ABR)
  • Autonomous System Boundary Router (ASBR)

OSPF Adjacencies

  1. The router sends and receives hello packets to and from its neighboring routers. The destination address is typically a multicast address.
  2. The routers exchange hello packets subject to protocol-specific parameters, such as checkingwhether the neighbor is in the same area, using the same hello interval, and so on. Routers declare the neighbor up when the exchange is complete.
  3.  After two routers establish neighbor adjacency using hello packets, they synchronize their LSDBs by exchanging LSAs and confirming the receipt of LSAs from the adjacent router. The two neighbor routers now recognize that they have synchronized their LSDBs with each other. For OSPF, this means that the routers are now in full adjacency state with each other.
  4.  If necessary, the routers forward any new LSAs to other neighboring routers, ensuring complete synchronization of link-state information inside the area.

Notes: OSPF routers on broadcast networks, such as LAN links, elect one router as the designated router (DR) and another as the backup designated router (BDR). All other routers on the LAN form full adjacencies with these two routers and pass LSAs only to them. The DR forwards updates received from one neighbor on the LAN to all other neighbors on that same LAN. One of the main functions of a DR is to ensure that all the routers on the same LAN have an identical LSDB. Thus, on broadcast networks, an LSDB is synchronized between a DROTHER (a router that is not a DR or a BDR) and its DR and BDR.

The DR passes its LSDB to any new routers that join that LAN. Having all the routers on that LAN pass the same information to the new router is inefficient, so the one DR router represents the other routers to a new router on the LAN or to other routers in the area. Routers on the LAN also maintain a partial-neighbor relationship, called a two-way adjacency state, with the other routers on the LAN that are not the DR or BDR, the DROTHERs.

LSAs have the following characteristics:

  • LSAs are reliable. There is a method for acknowledging their delivery.
  • LSAs are flooded throughout the area (or throughout the domain if there is only one area).
  • LSAs have a sequence number and a set lifetime, so each router recognizes that it has the most current version of the LSA.
  • LSAs are periodically refreshed to confirm topology information before they age out of the LSDB.

OSPF Metric Calculation

For OSPF, the default behavior on Cisco routers is that the interface cost is calculated based on its configured bandwidth. The higher the bandwidth, the lower the cost. The default OSPF cost on Cisco routers is calculated using the formula (100) / (bandwidth in megabits per second [Mbps]).

So, a DS-3 interface, with a configured bandwidth of 45000 kbps, has a cost of:

100,000,000 / 45,000 = 2222

• 56-kbps serial link—Default cost is 1785.
• 64-kbps serial link—Default cost is 1562.
• T1 (1.544-Mbps serial link)—Default cost is 64.
• E1 (2.048-Mbps serial link)—Default cost is 48.
• Ethernet—Default cost is 10.
• Fast Ethernet—Default cost is 1.
• FDDI—Default cost is 1.
• ATM—Default cost is 1.

Link-State Data Structures

  • Each LSA entry has its own aging timer
  • After a default of 30 minutes the router that originated the entry resends the LSA, with a higher sequence number, in a link-state update (LSU), to verify that the link is still active.
  • If the LSA were to reach its maximum age (max age) of 60 minutes, it would be discarded.

Benefit: This LSA validation method saves on bandwidth compared to distance vector routers, which send their entire routing table at short, periodic intervals.

OSPF Packets

  • Neighbor discovery, to form adjacencies
  • Flooding link-state information, to facilitate LSDBs being built in each router
  • Running SPF to calculate the shortest path to all known destinations
  • Populating the routing table with the best routes to all known destinations

 Data— Contains different information, depending on the OSPF packet type:

  • For the hello packet—Contains a list of known neighbors.
  • For the DBD packet—Contains a summary of the LSDB, which includes all known router IDs and their last sequence number, among several other fields.
  • For the LSR packet—Contains the type of LSU needed and the router ID of the router tha thas the needed LSU.
  • For the LSU packet—Contains the full LSA entries. Multiple LSA entries can fit in one OSPFupdate packet.
  • For the LSAck packet—This data field is empty.

Establishing OSPF Neighbor Adjacencies: Hello

The Hello protocol establishes and maintains neighbor relationships by ensuring bidirectional (two-way) communication between neighbors and the package contain:

  • Router ID
  • Hello and dead intervals (must match between neighbors)
  • Area ID (must match between neighbors)
  • Router priority
  • DR and BDR IP addresses
  • Authentication password (if enabled)
  • Stub area flag (must match between neighbors)


For routers to establish an adjacency on an interface, the primary IP addresses on the routers’ interfaces  must also be on the same subnet with the same mask, and the interface maximum transmission unit (MTU) must match.

Exchange Process and OSPF Neighbor Adjacency States

  1. Down: It begins by sending a hello packet through each of its interfaces participating in OSPF, even though it does not know the identity of the DR or of any other routers. The hello packet is sent out using the multicast address
  2. Init: All directly connected routers running OSPF receive the hello packet from Router  and add Router to their list of neighbors.
  3. All routers that received the hello packet send a unicast reply packet to Router with their corresponding information. The Neighbor field in the hello packet includes all other neighboring routers, including Router .
  4. Two-way: When Router receives these hello packets, it adds all the routers that have its router ID in their hello packets to its own neighbor relationship database.

If a router joins a broadcast network in which there is already a DR and BDR, it will get to the neighbor two-way state with all routers, including the DR and BDR, and those that are DROTHER (not DR or BDR). The joining router will continue to form full bidirectional adjacencies only with the DR and BDR.

OSPF Neighbor StatesThe following is a brief summary of the states OSPF may pass through before becoming adjacent to (neighbors with) another router:

• Down: No active neighbor detected.

• Init: Hello packet received.

• Two-way: Router sees its own router ID in a received hello packet.

• ExStart: Master/slave roles determined.

• Exchange: DBDs (summary of LSDB) sent.

• Loading: Exchange of LSRs and LSUs, to populate LSDBs.

• Full: Neighbors fully adjacent.

Network instability SPF calculation

The timers throttle spf router configuration command, introduced in Cisco IOS Software Release 12.2(14)S, enables the OSPF throttling feature so that the SPF calculations can be potentially delayed during network instability.

LSA Sequence number:

show ip ospf database

debug ip ospf packet

Configuring and Verifying Basic OSPF Routing

Considerations for OSPF include the following:

IP addressing plan— The IP addressing plan governs how OSPF can be deployed and how well the OSPF deployment will scale. A detailed hierarchical IP subnet and addressing plan must be produced, to enable OSPF summarization, allow the network to scale more easily, and to optimize OSPF behavior.

Network topology— The topology consists of the devices (routers, switches, and so on) and the links connecting them. A detailed network topology should be created to assess OSPF scalability requirements and to determine which OSPF features might be required (for example, multiple areas, OSPF summarization, stub areas, and redistribution). The topology should include backup links where necessary.

OSPF areas— Dividing an OSPF network into areas decreases the LSDB size and limits the propagation of link-state updates when the topology changes. The routers that are to be ABRs and ASBRs must be identified, as are those that are to perform any summarization or redistribution.

After the requirements have been assessed, the implementation plan can be created. The implementation plan should include the following steps:

• Define the network requirements

• Gather the required parameters

• Define the OSPF routing parameters

• Configure OSPF

• Verify the OSPF configuration

Basic configuration:

router process-id

network ip-address wildcard-mask area area-id  example network area 0 or

ip ospf process-id area area-id  interface configuration command

OSPF Router ID

An OSPF router ID uniquely identifies each OSPF router in the network. The OSPF routing process chooses a router ID for itself when it starts up. The router ID is a unique number in IP address format that can be assigned in the following ways:

  1. By default, the highest IP address of any active physical interface when OSPF starts is chosen as the router ID. The interface does not have to be part of the OSPF process, but it has to be up. There must be at least one “up” IP interface on the router for OSPF to use as the router ID. If no up interface with an IP address is available when the OSPF process starts, the following error message occurs:R1(config)#router ospf 12w1d: %OSPF-4-NORTRID: OSPF process 1 cannot start.
  2. Alternatively, if a loopback interface exists, its IP address will always be preferred as the router ID instead of the IP address of a physical interface, because a loopback interface never goes down. If there is more than one loopback interface, the highest IP address on any active loopback interface becomes the router ID.
  3. Alternatively, if the router-id ip-address OSPF router configuration command is used, it will override the use of the address of a physical or loopback interface as the router ID. Using the router-id command is the preferred procedure for setting the router ID.

The OSPF database uses the router ID to uniquely describe each router in the network.


Router(config)#router ospf  1


Router#clear ip ospf process


show ip ospf

Loopback interfaces

first define a loopback interface with the interface loopback number global configuration command, and then configure an IP address on the loopback interface.

To verify that OSPF has been properly configured, use the following show commands:

  •  show ip ospf
  •  show ip ospf interface [type number] [brief]
  • show ip ospf neighbor [type number] [neighbor-id] [detail]
  •  show ip route ospf
  • show ip protocols
  • debug ip ospf events
  • debug ip ospf adj
  • debug ip ospf packet

Types of OSPF Networks

• Point-to-point— A network that joins a single pair of routers.

• Broadcast— A multiaccess broadcast network, such as Ethernet.

• Nonbroadcast multiaccess (NBMA)— A network that interconnects more than two routers but that has no broadcast capability.

Electing a DR and BDR and Setting Priority

To elect a DR and BDR, the routers view the OSPF priority value of the other routers during the hello packet exchange process and then use the following conditions to determine which router to select:

  • The router with the highest priority value is the DR
  • The router with the second-highest priority value is the BDR.
  • The default for the interface OSPF priority is 1. In case of a tie, the router ID is used.
  • A router with a priority of 0 cannot become the DR or BDR. A router that is not the DR or BDR is a DROTHER.
  • If a router with a higher priority value gets added to the network, it does not preempt the DR and BDR. The only time a DR or BDR changes is if one of them goes out of service. If the DR is out of service, the BDR becomes the DR, and a new BDR is selected. If the BDR is out of service, a new BDR is elected.


Use the ip ospf priority number interface configuration command

Adjacency Behavior for a Point-to-Point Link

The default OSPF hello and dead intervals on point-to-point links are 10 seconds and 40 seconds, respectively. (The hello and dead timers can be changed with the ip ospf hello-interval seconds and ip ospf dead-interval seconds interface configuration commands.)

OSPF Nonbroadcast Mode Configuration

After you enable the OSPF process for specific interfaces, you configure nonbroadcast mode by
• Manually configuring OSPF neighbors
• Defining the OSPF network type as nonbroadcast (unless it is the default)

Use the neighbor ip-address [priority number] [poll-interval number] [cost number] [database-filter all] router configuration command to statically define adjacent relationships in NBMA networks using the nonbroadcast mode.

Configuring hub:

router ospf 10
network area 0
neighbor priority 0
neighbor priority 0

interface s1/0
ip address
ip ospf priority 0

Verify neighborship status:

show ip ospf neighbor

Point-to-multipoint mode has the following properties:

  • Does not require a full-mesh network.
  • Does not require a static neighbor configuration
  • Duplicates LSA packets


RouterA(config)#interface Serial0/0/0
RouterA(config-if)#ip address
RouterA(config-if)#encapsulation frame-relay
RouterA(config-if)#ip ospf network point-to-multipoint

RouterA(config)#router ospf 100
RouterA(config-router)#network area 0
RouterA(config-router)#network area 0

RouterC(config)#interface Serial0/0/0
RouterC(config-if)#ip address
RouterC(config-if)#encapsulation frame-relay
RouterC(config-if)#ip ospf network point-to-multipoint

RouterC(config)#router ospf 100
RouterC(config-router)#network area 0

OSPF Configuration in Cisco Point-to-Multipoint Nonbroadcast Mode

  • Cisco extension
  • Statically define neighbors
  • Cost of the link to the neighboring router to reflect the different bandwidths of each link
  • DRs and BDRs are not elected.

Using Subinterfaces in OSPF over Frame Relay Configuration

  • A physical interface can be split into multiple logical interfaces called subinterfaces.
  • Subinterfaces were originally created to better handle issues caused by split horizon over NBMA for distance vector-based routing protocols.
  • Each subinterface requires an IP subnet
  • interface serial number.subinterface-number {multipoint | point-to-point}global configuration command.

interface Serial0/0/0
no ip address
encapsulation frame-relay
interface Serial0/0/0.1 point-to-point
ip address
frame-relay interface-dlci 121
interface Serial0/0/0.2 point-to-point
ip address
frame-relay interface-dlci 132
interface Serial0/0/0
no ip address
encapsulation frame-relay
interface Serial0/0/0.1 point-to-point
ip address
frame-relay interface-dlci 122


interface Serial0/0/0.2 multipoint
ip address
<output omitted>
router ospf 100
network area 0
neighbor priority 0
neighbor priority 0
interface Serial0/0/0
ip address
<output omitted>
interface Serial0/0/0
ip address
ip ospf priority 3

Recall that, by default, OSPF advertises loopback interface addresses as /32 host routes. If the ip ospf network point-to-point command is configured on a loopback interface, OSPF advertises the actual loopback subnet mask, instead of a /32 host route.

Displaying OSPF Adjacency Activity
Use the debug ip ospf adj command to track OSPF adjacencies as they go up or down

Understanding OSPF LSAs

  • LSA Type 1 – Router – contains router links and state and is flooded into the area of origin
  • LSA Type 2 – Network – generated by DR – lists all attached routers – flooded into the area of origin.
  • LSA Type 3 – Network Summary – generated by ABR’s sent into an area to advertise prefixes to other areas – flooded throughout the Autonomous System.
  • LSA Type 4 – ASBR Summary – generated by ABR’s – advertises the ASBR – flooded throughout the Autonomous System
  • LSA Type 5 – AS External – generated by ASBR – advertises external destination – flooded throughout the Autonomous System
  • LSA Type 7 – NSSA External – generated by the ASBR in a not so stubby area – advertises external destination.

– By default, OSPF does not automatically summarize groups of contiguous subnets, or even summarize a network to its classful boundary.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: