Cisco® CCNA ICND2 Exam Cram Notes : OSPFv2 For Ipv4


Go to latest CCNA Exam Cram

2. Routing Technologies

2.5 OSPFv2 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.

Important characteristics of OSPF:

1. Route updates are only sent when routes change. Each router sends a link-state advertisement (LSA) whenever a change occurs in one of the routes known to the router.

2. LSAs contain information about the route that changed only.

3. Routers exchange "Hello" messages during the convergence process to build their neighbor tables.

4. OSPF, like RIP, is supported on non-Cisco routers.

5. OSPF, like RIPv2 supports variable-length subnet masking (VLSM).

6. OSPF supports an unlimited number of network hops. Compare it with only 15 hops supported by RIP.

7. OSPF scales out very well because

  • It divides the routing domain (autonomous system) into areas.
  • It classifies routers hierarchically.
  • It converges very quickly.

8. OSPF process identifier is locally significant. Two neighboring router interfaces can have same or different process ids. It is required to identify a unique instance of OSPF database

9. The Hello and Dead timers must match for forming neighbor relationship. Otherwise, adjacencies will not take place

10. The routers should be in the same Area to form neighbor relationship. By default Dead timer is configured as 4 times the Hello timer.

11. 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).

12. 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.

13. An OSPF area is a collection of networks and routers that has the same area identification.

14. 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

15. OSPF process identifier is locally significant. Two neighboring router interfaces can have same or different process ids. It is required to identify a unique instance of OSPF database.

16. OSPF determines the route by taking only bandwidth into account. Since AD, DC are configured with T3 links, it has the lowest path cost. In OSPF, the route entry used will always be the lowest cost path.

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.

OSPF must be configured with areas. The backbone area 0, or, must be configured if you use more than one area assignment. If you are configuring OSPF in a single area; you can choose any area number.

To enable OSPF on a Cisco router and advertise interfaces, the following tasks are required:

Step 1: Use the command "router ospf process ID" to start OSPF. Process ID is any number

Step 2: Use the network <ip-address> <wildcard-mask> area <area-id> command to enable

OSPF on specified networks

Step 3: Repeat for each area id.

Holddown timers prevent regular update messages from reinstating a route that has gone bad. Here, if a route fails, the router waits a certain amount of time before accepting any other routing information about that route. Holddowns tell routers to hold any changes that might affect routes for some period of time. The holddown period is usually calculated to be just greater than the period of time necessary to update the entire network with a routing change.

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

OSPF Path cost: The path cost in OSPF network is calculated using bandwidth only. The formula used is [10 ^8 divided by Bandwidth]. For example, the cost of a 56kbps serial link is 1785. The default cost of a 10mbps Ethernet is 10.


OSPF Path cost is the total of the costs assigned to all interfaces that forward traffic along the path to the destination.

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 hello's. This is 10 seconds on multi access networks.

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

Advantages of OSPF 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.

OSPF Configuration Example:

Router#configure terminal
Enter into global configuration mode
Router(config)#router ospf
router ospf 1 specified process id of 1 (process ids need not be unique between routers)
Router(config-router)#network area 200

In the above command:

Network IP address:
Wild card mask:
Area ID: 200

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 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) : E2 is the default route type for routes learned via redistribution.

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.

OSPF show commands :

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.

The following is sample output of the "show ip ospf database" command

show ip ospf database command output

The Link ID is actually the link-state ID. It is the ID of the router in the area. The ADV Router is the ID of the router that sent the LSA. As you can see, the router with the ID is advertising 5 links into the area. Router LSA are flooded to every other router in the area. So neighboring routers will send LSA about other routes they know about to their neighbors so everyone is "on the same page". so to speak.

A more specific command for showing the interfaces running OSPF is "show ip ospf interfaces". The command "show ip ospf interfaces" shows the summary information for OSPF interfaces. The information provided include autonomous system number, router id, designated router id, backup designated router id, hello time, and adjacent neighbors.

The following is sample output of the "show ip ospf interfaces" command

show ip ospf interfaces command output

The following describes filelds in the display

  • WAN Slot 1/Serial0 is up : indicates that the physical line is operational
  • Internet Address : The IP address and mask configured on the interface.
  • Area 200 : The OSPF area for which the interface is configured.
  • Process ID 1, Router ID : The autonomous system number, which is in fact the OSPF
  • Network type Point-to-point - The type of network that the interface is connected to, which
  • Cost :The metric cost of the link, which, although not stated, was

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

In an OSPF network, Type 2 LSAs are generated by a Designated Router (DR). Type 2 LSAs describe the set of routers attached to a particular network and are flooded within the area that contain the network only.

The following is sample output of the show ip ospf virtual-links command:

show ip ospf virtual-links command output

The following describes the fields in the display:

  • Interface address : The Internet address of the interface and the interface identifier as defined with the interface command.
  • cost :The cost associated with the virtual link.
  • state : The state of the interface. Possible states include: Down, Waiting, point-to-point (P To P)
  • transit area : The identifier of the area.
  • hello : The number of seconds to wait for a hello packet over this virtual link before declaring the adjacency down.
  • dead : The amount of time to wait for an advertisement on this link before declaring the adjacency down.
  • retrans : The retransmit interval. The amount of time to wait before resending an advertisement. This value is set with the "ip ospf retransmit-interval" command.
  • nbr id : The identifier of the neighbor.
  • nbr address : The address of the neighbor on the other end of this virtual link.
  • nbr state : The state of the neighbor. States include: Down, Init, 2 Way, Exch Start, Exchange, Loading, and Full.
  • nbr mode : The mode in which the neighbor operates. Modes can be: None, Slave, and Master.
  • last hello : The number of seconds since the last hello packet was received over this virtual link.

The major advantages of hierarchical nature of OSPF are:

  • Reduced frequency of SPF calculations: This is because the packets are flooded only within an area, and not to the other areas.
  • Smaller routing tables
  • Reduced LSU overhead.

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

The router is an ABR (Area Border Router) since it connects two OSPF areas. Area 2 is configured as stubby and not totally stubby. To configure an area as totally stubby, use the command "area 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".

Previous   Contents   Next

CCNA-ICND2 Cram Notes Contents
certexams ad

simulationexams ad