Cisco® CCNP Route Exam Notes : OSPF For Ipv4

3. Layer3 Technologies

3.13 OSPF for IPv4

OSPF uses Dijkstra algorithm to calculate lowest cost route. The algorithm adds up the total costs between the local router and each destination network. The lowest cost route is always preferred when there are multiple paths to a given destination.

Note: By default, OSPF keeps 4 routes in routing table if there are 4 or more equal cost routes exist for the same subnet. However, OSPF can include up to 16 equal cost routes in the routing table and perform load balancing amongst them. In order to configure this feature, you need to use the OSPF sub command maximum-paths, i.e. maximum-paths 16.

To configure an area as totally stubby, use the command "area <area-id> no-summary"

The cost of the default route that is injected into the stub area is equal to 1 by default. To change this value, use the command "area <area-id> default-cost <cost>" command. For example, if you want to set a value of 5 for the default route, use the command "area 2 default-cost 5".

A default route can be advertised into OSPF domain by an ASBR router in one of two ways:
By using "default-information originate" command : This command can be used when there is a default route ( already existing. This command will advertise a default route into the OSPF domain.

The Hello and Dead timers must match for forming neighbour relationship.

In an OSPF network, when a packet need to traverse from one area to another area to reach its destination, it is routed as below:

Source Area -> Source ABR -> Backbone Area -> Destination ABR -> Destination Area Routers

The routers should be in the same Area to form neighbour relationship.

OSPF determines the router ID using the following criteria:

1. Use the address configured by the ospf router-id command

2. Use the highest numbered IP address of a loopback interface

3. Use the highest IP address of any physical interface

4. If no interface exists, set the router-ID to

If no OSPF router ID is explicitly configured, OSPF computes the router-ID based on the items 2, 3, and 4 and restarts OSPF (if the process is enabled and router-ID has changed).

A router with highest priority becomes the designated router and a router with priority 0 can never become designated router. If the priorities are the same, then the router with the highest router ID becomes the DR.

OSPF is a link state technology that uses Dijkstra algorithm to compute routing information.

It has the following advantages over Distance Vector protocols such as RIP:

1. Faster convergence: OSPF network converges faster because routing changes are flooded immediately and computer in parallel.

2. Support for VLSM: OSPF supports VLSM. However, please note that RIP version2 also supports VLSM.

3. Network Reachability: RIP networks are limited to 15 hops. Therefore, networks with more than 15 hops can not be reached by RIP by normal means. On the other hand, OSPF has practically no reachability limitation.

4. Metric: RIP uses only hop count for making routing decisions. This may lead to severe problems in some cases, for example, that a route is nearer but is very slow compared to another route with plenty of bandwidth available. OSPF uses "cost" metric to choose best path. Cisco uses "bandwidth" as metric to choose best route.

5. Efficiency: RIP uses routing updates every 30 seconds. OSPF multicasts link-state updates and sends the updates only when there is a change in the network.

  • The "hello" packets are sent periodically out of each interface using IP multicast addresses. The hello interval specifies the frequency in seconds that a router sends hellos. This is 10 seconds on multi access networks.
  • Open Shortest Path First (OSPF) uses "Cost" as the value of metric and uses a Reference Bandwidth of 100 Mbps for cost calculation.
  • The formula to calculate the cost is Reference Bandwidth divided by interface bandwidth. For example, in the case of 10 Mbps Ethernet , OSPF Metric Cost value is 100 Mbps / 10 Mbps = 10.
  • The default Reference Bandwidth of OSPF is 100 Mbps and the default OSPF cost formula doesn't differentiate between interfaces with bandwidth faster than 100 Mbps. These days, 1 Gbps and 10 Gbps links are also common.
  • According to the default OSPF metric Cost value calculation, the default OSPF Cost for Fast Ethernet interface (100 Mbps) and a Gigabit Ethernet interface (1 Gbps) are same.
  • If you want to change the default behavior, the cost formula can be adjusted using the "auto-cost" command under the OSPF routing process. If you are changing the default OSPF Reference Bandwidth, make sure that you have changed the OSPF Reference Bandwidth in all your OSPF Routers.

Default cost of essential interfaces.

Interface Type bandwidth Metric Calculation Cost

Ethernet Link 10Mbps 100Mbps/10Mbps 10

FastEthernet Link 100Mbps 100Mbps/100Mbps 1

Serial Link 1544Kbps(default) 100Mbps/1.544Mbps= 64.76 64

OSPF uses SPT tree to calculate the best route for routing table. A SPT tree cannot grow beyond the area. So if a router has interfaces in multiple areas, it needs to build separate tree for each area. SPF algorithm calculates all possible routes from source router to destination network.

  • Cumulative cost is the sum of the all costs of the outgoing OSPF interfaces in the path.
  • While calculating cumulative cost, OSPF consider only outgoing interfaces in path. It does not add the cost of incoming interfaces in cumulative cost.
  • If multiple routes exist, SPF compares the cumulative costs. Route which has the lowest cumulative cost will be chosen for routing table.
  • When a serial line is configured on a Cisco router, the default bandwidth is 1.544Mbps. If the line is slower speed, "bandwidth" command can be used to specify the real link speed. The cost of the link will then automatically correspond to the changed value.

In short:Cumulative cost = Sum of all outgoing interfaces cost in route

Best route for routing table = Route which has the lowest cumulative cost

1. LSA (Link State Advertisement): LSAs are included in the database description packets (DDPs or DBDs). LSA entries include link-state type, the address of the advertising router, the cost of the link, and the sequence number.

2. LSR ( Link State Request): When a slave router receives an DDP (Database Description Packet), it sends and LSAck packet. Then it compares the received information with the information it has. If the DDP has more recent information, the slave router sends a link-state request (LSR) to the master router.

3. LSU ( Link State Update): LSU packet is sent in response to LSR (Link-State Request) packet sent from a slave router to a master router. LSU contains complete information about the requested entry.

The major advantages of hierarchical nature of OSPF are:

1. Reduced frequency of SPF calculations: This is because the packets are flooded only within an area, and not to the other areas.

2. Smaller routing tables: Routes can be summarized when being advertised out side an area, thus reducing the routing table entries.

3. Reduced LSU overhead: Fewer number of LSUs can be sent with a single or fewer summarized routes between areas to reduce the overhead associated with link-state updates when they are crossing areas.

Important features of stub area are:

  • A stub area reduces the size of the link-state database to be maintained in an area, which in turn result in less overhead in terms of memory capacity, computational power, and convergence time.
  • The routing in Stub and totally Stubby areas is based on default gateway. A default route ( need to be configured to route traffic outside the area.
  • The stub areas suited for Hub-Spoke topology.
  • Area 0 is not configured as Stubby or totally Stubby. This is because stub areas are configured mainly to avoid carrying external routes, whereas Area 0 carries external routes.
  • When an area is configured as stub or totally stubby, a default route ( is injected into the area

Virtual-link in OSPF: Theoretically, all areas in an OSPF autonomous system must be physically connected to the backbone area (area 0). In some cases where this physical connection is not possible, you can use a virtual link to connect to the backbone through a non-backbone area. You can also use virtual links to connect two parts of a partitioned backbone through a non-backbone area. The area through which you configure the virtual link is known as a transit area.

Use the "area area-id virtual-link router-id" command in order to configure a virtual link, where the area-id is the area ID assigned to the transit area (this can be either a valid IP address or a decimal value), and where router-id is the router ID associated with the virtual link neighbor.

The command "show ip ospf virtual-links" will show up the status of virtual links of a router.

Sometimes when you issue a "show ip ospf virtual-link" the output shows that the Virtual-Link is UP, but you see no communication going on, neither a OSPF Relationship established. To make sure that the Virtual-Link is "really" working, issue a show ip ospf virtual-link command and see if the adcency state id FULL, and communication is there as given in the example below (typical output):

R(config-router)#do sh ip ospf virtual-link

Virtual Link OSPF_VL0 to router is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 1, via interface Serial1/0, Cost of using 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:08
Adjacency State FULL (Hello suppressed)
Index 2/3, retransmission queue length 1, number of retransmission 1
First 0x65593B80(11)/0x0(0) Next 0x65593B80(11)/0x0(0)
Last retransmission scan length is 1, maximum is 1
Last retransmission scan time is 0 msec, maximum is 0 msec
Link State retransmission due in 2986 msec

Yes, external and summary routes are not injected into a totally stubby area in an OSPF network. The advantages of totally stubby areas are reduced routing tables, faster convergence, and stability. and are the multicast addresses used by OSPFv2.

The command that is used for configuring OSPF in NBMA mode is : "ip ospf network non-broadcast". However, note that NBMA mode is used by default.

The statements identify that the process-id of the OSPF is 100, and the statement "area 1 stub no-summary" signifies totally stubby area. The router is connecting two area, and hence not a backbone router.

The following is true about OSPF area

  • An OSPF area is a collection of networks and routers that has the same area identification.
  • The command "show ip ospf database" displays the contents of the topological database maintained by the router. This command also displays router id and the ospf process id.
  • "show ip ospf interface" can be used to check whether the interfaces have been configured properly. The command also gives the timer intervals, including hello intervals as well as neighbor adjacencies.
  • OSPF keeps up to six equal-cost route entries in the routing table for load balancing.
  • Further, OSPF uses Dijkstra algorithm to calculate lowest cost route. The algorithm adds up the total costs between the local router and the each destination network. The lowest cost route is always preferred when there are multiple paths to a given destination.

The following are the types of OSPF routers:

1. Internal router: An internal router has all the interfaces in the same area. All internal routers have same link state databases.

2. Backbone router: Backbone routers sit on the perimeter of Area 0, with at least one interface connected to backbone (Area 0).

3. Area Border Router (ABR): ABRs are routers that have interfaces attached to multiple areas. It may be noted that these routers maintain separate link-state databases for each area that they are connected. They are capable of routing traffic destined for or arriving from other areas.

4. Autonomous System Boundary Router (ASBR): These are the routers that have at least one interface to the external network (another autonomous system). This autonomous network can be non-OSPF. ASBRs are capable of route redistribution, a term used to imply that the concerned router can import routing information from non-OSPF networks and distribute the same in OSPF network for which it is responsible and visa versa.


  • LSA Type 1: Router link entry, generated by all routers for each area to which it belongs. These are flooded within a particular area.
  • LSA Type 2: Network link entry, generated by designated router (DRs). Type 2 LSAs are advertised only to routers that are in the area containing the specific network. Type 2 LSAs describe the set of routers attached to a particular network and are flooded within the area that contain the network only.
  • LSA Type 3 and Type 4: Summary link entry, these LSAs are generated by area border routers (ABRs). These are sent to all routers within an area. These entries describe the links between the ABR and the internal routers of an area. These entries are flooded throughout the backbone area and to the other ABRs.
  • LSA Type 5: Autonomous System External Link Entry, These are originated by ASBR. These entries describe routes to destinations external to the autonomous system. These LSAs are flooded throughout the OSPF autonomous system except for stubby and totally stubby areas.
  • Area backbone LSAs: The LSAs generated by Area Backbone Routers are LSA1, LSA2, LSA3, LSA4, and LSA5. Note that LSA6 is not supported by Cisco, and LSA7 is generated by NSSA router.
  • Stub area LSAs: The Stub area router generates LSA types 1, 2, and 3. i.e. Router LSA, Network LSA, and Summary LSA.
  • Totally Stubby LSAs:The Totally Stubby area routers generate LSA types 1 and 2
  • NSSA LSAs: A NSSA (Not So Stubby Area) router generates LSA types 1, 2, and 7. . LSA 7 is translated into LSA 5 as it leaves the NSSA

Different LSA types are described below:

a. LSA 1 (Router LSA): Generated by all routers in an area to describe their directly attached links (Intra-area routes). These do not leave the area.

b. LSA 2 (Network LSA): Generated by the DR of a broadcast or Nonbroadcast segment to describe the neighbors connected to the segment. These do not leave the area.

c. LSA 3 (Summary LSA): Generated by the ABR to describe a route to neighbors outside the area. (Inter-area routes)

d. LSA 4 (Summary LSA): Generated by the ABR to describe a route to an ASBR to neighbors outside the area.

e. LSA 5 (External LSA): Generated by ASBR to describe routes redistributed into the area. These routes appear as E1 or E2 in the routing table. E2 (default) uses a static cost throughout the OSPF domain as it only takes the cost into account that is reported at redistribution. E1 uses a cumulative cost of the cost reported into the OSPF domain at redistribution plus the local cost to the ASBR.

f. LSA 6 (Multicast LSA): Not supported on Cisco routers.

g. LSA 7 (NSSA External LSA): Generated by an ASBR inside a NSSA to describe routes redistributed into the NSSA. LSA 7 is translated into LSA 5 as it leaves the NSSA. These routes appear as N1 or N2 in the ip routing table inside the NSSA. Much like LSA 5, N2 is a static cost while N1 is a cumulative cost that includes the cost upto the ASBR.


Note: In OSPF, lower the metric value higher the priority

To modify router priority in an OSPF ip network, issue the command : "ip ospf priority <number>" , where <number> is any number between 0 and 255. The default is 1.

The cost of external route depends on the configuration of ASBR. There are two external packet types possible.

1. Type 1 (E1) - Here the metric is calculated by adding the external cost to the internal cost of each link that the packet crosses.

2. Type 2 (E2) - This type of packet will only have the external cost assigned, irrespective of where in the area it crosses. Type 2 packets are preferred over Type 1 packets unless there are two same cost routes existing to the destination.

A default route can be advertised into OSPF domain by an ASBR router in one of two ways:

By using "default-information originate" command: This command can be used when there is a default route ( already existing. This command will advertise a default route into the OSPF domain.

By using "default-information originate always" command: This command can be used when there is a default route ( is present or not. This command is particularly useful when the default route is not consistent. An inconsistent default route may result in flipping of the route advertised into the OSPF domain, resulting in instability of the OSPF domain routing information. Therefore, it is recommended to use "always" keyword.

The sequence of steps followed in OSPF operation are as below:

1. Establish router adjacencies

2. Elect DR and BDR

3. Discover Routes

4. Choose appropriate routes for use

5. Maintain routing information.

In an OSPF environment

1. A DDP (Data Description Packet) is used during the exchange protocol and includes summary information about link-state entries.

2. A hello packet is used during the hello process and includes information that enables routers to establish neighbor relationship.

3. An internal router is a router that resides within an area.

Previous   Contents   Next

CCNP Route Cram Notes Contents
certexams ad

simulationexams ad