You are on page 1of 12

Vision Infosystems (VIS)

``
Chapter 11

OSPF
Topics Covered
Basics of OSPF
Configuration of OSPF
Troubleshooting OSPF

Copyright ® 2004-2005 VISION INFOSYSTEMS


visioninfosystems@vsnl.net
Vision Infosystems (VIS)

Open Shortest Path First (OSPF)


The Open Shortest Path First (OSPF) version 2 protocols were defined in RFC 2328 as an Interior
Gateway Protocol for routing information within a single Autonomous System. OSPF protocol was
developed in order to solve the problem of large scale routing and to introduce a high functionality non-
proprietary Internal Gateway Protocol (IGP) for the TCP/IP protocol family. The OSPF protocol is a link-
state routing protocol removed the Bellman-Ford vector based algorithms used in traditional Internet
routing protocols such as RIP. OSPF has introduced new concepts such as authentication of routing
updates, Variable Length Subnet Masks (VLSM), route summarization, etc.

Features of OSPF
• Industry standard routing protocol.
• Support only for Internet Protocol (IP).
• AS is divided into multiple areas for easy and efficient routing.
• Fast convergence using link state routing method.
• Does not send period and full update.
• Uses bandwidth i.e. cost as metric.
• Used in large enterprise network environment.

OSPF versus RIP


OSPF has various advantages over RIP

• RIP has a limit of 15 hops. A RIP network that spans more than 15 hops (15 routers) is considered
unreachable where as OSPF does not have hop limit
• RIP V1 cannot handle Variable Length Subnet Masks (VLSM) whereas OSPF supports VLSM.
• Periodic broadcasts of the full routing table will consume a large amount of bandwidth which
creates congestion and traffic problem for large network and slow WAN links. This issue is
resolved by OSPF using trigger update technology.
• RIP converges slower than OSPF. In large networks convergence gets to be in the order of
minutes. RIP routers will go through a period of a hold-down and garbage collection and will
slowly time-out information that has not been received recently. This is inappropriate in large
environments and could cause routing inconsistencies.
• RIP has no concept of network delays and link costs. Routing decisions are based on hop counts.
The path with the lowest hop count to the destination is always preferred even if the longer path
has a better aggregate link bandwidth and slower delays.
• RIP networks are flat networks. There is no concept of areas or boundaries. With the introduction
of classless routing and the intelligent use of aggregation and summarization, RIP networks seem
to have fallen behind.
• Some enhancements were introduced in a new version of RIP called RIP2. RIP2 addresses the
issues of VLSM, authentication, and multicast routing updates. RIP2 is not a big improvement
over RIP (now called RIP 1) because it still has the limitations of hop counts and slow
convergence which are essential in todays large networks.
Vision Infosystems (VIS)

• OSPF allows for a logical definition of networks where routers can be divided into areas. This will
limit the explosion of link state updates over the whole network. This also provides a mechanism
for aggregating routes and cutting down on the unnecessary propagation of subnet information.
• OSPF allows for routing authentication by using different methods of password authentication.

How OSPF works

Before understanding how OSPF works lets under what does link state means to OSPF. Link can be
defined as an interface of the router. The state of the link is a description of that interface and of its
relationship to its neighboring routers. A description of the interface would include, for example, the IP
address of the interface, the mask, the type of network it is connected to, the routers connected to that
network and so on. The collection of all these link-states would form a link-state database. So the method
of collecting link state information and find the appropriate path to destination network is called as link-
state algorithm. The algorithm of link-state routing is called as Dijkstra.

Short summary of how OSPF works


• When a new router is added to a network or if there is any change in network topology a OSPF
enabled router will generate a link-state advertisement. This advertisement will represent the
collection of all link-states on that router.
• When other OSPF router receives this update they too exchange link-states by means of flooding.
Each router that receives a link-state update should store a copy in its link-state database and then
propagate the update to other routers.
• After completing the update process each router will calculate a Shortest Path Tree to all
destinations. The router uses the Dijkstra algorithm to calculate the shortest path tree.
• Based on shortest path calculation each OSPF router creates is own routing table for packet
forward.
• When routing table is created OSPF becomes silent until a new update is received or there is
change in network topology.

OSPF Metric

In OSPF metric is called as Cost. The cost is calculated cost of interface is inversely proportional to the
bandwidth of that interface. A higher bandwidth indicates a lower cost.

Formula for cost

cost= 100000000/bandwith in bps

For example,

Cost of 10MB Ethernet Network is 100000000/10000000 = 10 cost


Cost of T1 link is 100000000/1544000 = 64 cost
Vision Infosystems (VIS)

Why Areas in OSPF


OSPF uses flooding to exchange link-state updates between routers. Any change in routing information is
flooded to all routers in the network. Areas are introduced in OSPF to define a boundary for flooding of
link-state updates. Flooding and calculation of the Dijkstra algorithm on a router is limited to changes
within an area. Dividing a routing domain into multiple areas helps OSPF to minimize routing table in
each Area. All routers within an area have the exact link-state database. Routers that belong to multiple
areas, and connect these areas to the backbone area are called area border routers (ABR). ABRs must
therefore maintain information describing the backbone areas and other attached areas.

How OSPF is designed


OSPF uses a concept of areas for managing routing tables and flooding of routing information. In OSPF
areas are divided into multiple categories and to connect each are ABR are used and to tie up all OSPF
areas under one roof a special area is called as backbone area or Area 0. All OSPF areas must be
connected to area0.

In OSPF each area is given a number called as area ID or area number. The area ID can be decimal
number between 1 to 4,294,967,296 or an IP address like format. The backbone area is always identified
as area 0 or area 0.0.0.0. All areas must be connected to area 0. We can create up 232 areas in an OSPF
network.

Types of Areas in OSPF

Ordinary/Standard Area : Ordinary or standard area are areas that connects to the backbone. In ordinary
area every router knows about every network in the area, and each router has the same topological
database. However, the routing tables will be unique from the perspective of the router and its position
within the area.
Vision Infosystems (VIS)

Stub Area : This is an area that will not accept external summary routes. This area prevents or blocks
LSA type 4 and 5. This area has only default route to connect to router areas or external network. Every
router within the area can see every network within the area and the networks within other areas. Stub
area is normally used in hub and spoke topology.

Totally Stubby Area : Totally stubby area is a special type of stub area which does not accept LSA type
3, 4, and 5. This area communicate with other areas via default route i.e. 0.0.0.0. This area is normally
used for small branches or network area or isolated area with few routers and routes.

Not So Stubby Area (NSSA) : This is also a special type of area which is connected to OSPF area and
also to external network via redistribution. This area is a type of stub area but accept external router. This
area does not accept LSA type 4 and 5.

The Backbone Area : This area is called to as Area 0 or Area 0.0.0.0, and it connects all the other areas.
This area accepts all types of LSA and helps to connect each areas. This area can be called as heart or
center point of OSPF network topology.

OSPF in a single Area Network


Before understanding how OSPF works in a multi area network we will go through how OSPF works for
a single area and how each router works in an area to create a routing domain or network. When a OSPF
process is configured on router each router in an area goes through various process to build up the routing
table.

The process including


Finding neighbors using hello packets to create Neighbor table.
Exchanging Link state tables to create topology table.
Based on topology table each router creates its own routing table for packet forwarding.

So we can conclude that OSPF uses 3 types of table in the entire routing process.
Neighbor table : This table maintains information about neighboring routers. This table is created with
the help of hello protocol. This table is the building block of OSPF routing process.

Topology or link state table : Topology table or link state table is exchange of link states, networks,
address, etc to each other by neighboring routers which helps every OSPF router to create a network
diagram called as link state table.

Routing Table : After creating link state table each OSPF router creates a routing table based on SPF
algorithm for path determination and packet forwarding.

How OSPF Neighbor table is created


The building block of neighbor table is the hello protocol or hello packet. Each OSFP router on initialized
sends hello packets to each other to find information about neighboring routers. This feature is somewhat
similar to CDP protocol used by Cisco routers and switches.

Every OSPF router send hello packet periodically (10 seconds is the default on broadcast multi-access
media) to neighboring routers. It has a source address of the sending router and a multicast destination
address set to AllSPFRouters (224.0.0.5). All routers running OSPF listen to the protocol and send their
Vision Infosystems (VIS)

own hello packets periodically. Hello protocol works different based on network type. Hello packet helps
to establish neighbor relationship between OSPF routers.

Contents of Hello Packet

Router ID
Hello and Dead interval
Area ID
DR and BDR IP address
Authentication
Stub flag, etc

Each OSPF router sends hello packets every 10 sends on multi-access broadcast network with dead
interval of 40 seconds. Based on hello packet each OSPF router maintains and Neighbor table. If no hello
packets are received within 40 seconds the neighbor is declared as dead and according changes are made
in topology table and routing table. So we can conclude that if there is any change in network topology
the first thing to effect is neighbor table then comes topology and routing table. After hello packets are
send, each OSPF router exchange link state table. When both neighbors are synchronized they are called
as adjacent.

The entire process of hello packet to adjancy is explained as below

The down state : Every new router added to an OSPF network is in down state at the beginning. The
router transmits its own hello packets to introduce itself to the segment and to find any other OSPF
enabled routers. The hello packets are send to multicast address 224.0.0.5 (AllSPFRouters).

The init state : The new router waits for a reply from other OSPF configured routers. The router is in the
init state. When other router hears about the hello packets, they too start sending hello packet. Based on
this hello packet a election is done and an DR and BDR is elected.

The two-way state : The two-way is state in which the new router find its own router ID neighbor list of
other router. Two-way state represent two way synchronization of hello packet.

The exstart state : In this state one of the routers will take seniority, becoming the master router. The two
neighbors determine a master/slave relationship based on highest IP interface address. This master/slave
relationship is only used to determine who starts the communication.

The exchange state : After the exstart state both routers sends out database description packets(DDP)
(i.e. the DDP contains a summary of links rather the entire link state table), changing the state to the
exchange state.

The loading state : If the receiving router, requires more information, it will request that particular link in
more detail using the link-state request packet (LSR). The LSR will prompt the master router to send the
link-state update packet (LSU). This is the same as a link-state advertisement (LSA) used to flood the
network with routing information. While the router is awaiting the LSUs from its neighbor, it is in the
loading state.
Vision Infosystems (VIS)

The full state : When these LSRs are received and the databases are updated and synchronized, the
neighbors are fully adjacent.

OSPF network topologies


OSPF has categories network in 5 types based on architecture of the topology. In each topology OSPF has
different behavior. So before understanding how OSPF works in different topology we will know what
the different types of topology are.

• Broadcast Multi-access network : All types of LAN based network are covered under this
category. Like Ethernet, Fast Ethernet, Token Ring, FDDI, etc. This type of network have
broadcast and multicast capabilities. All devices or physical media uses in this topology has
broadcast and multicast feature. OSPF uses multicast to send packets on this network type.
Designated routers (DR) and Backup Designated routers (BDR) are elected in order to avoid
flooding of LSAs. The DR and BDR are elected based on various criteria.

• Point-to-point : This topology is used where there are two devices connected to each other in
point to point fashion. There is only one sending and one receiving router. A typical example of
this is a serial line. PPP and HDLC is the most widely protocol used in such topology. Such point
to point topology usually does not requires layer 2 addressing so this type of network also support
broadcast and multicast traffic. OSPF does not require designated or backup designated router in
this scenario. Network traffic is send using the multicast address for OSPF AllSPFRouters,
224.0.0.5.

• Point-to-Multipoint : This topology is used when a single device is connected to multiple devices
or networks. There is no requirement for DR or BDR election. This technology uses one IP subnet.
Physically, some point-to-multipoint networks cannot support multicast or broadcast traffic. In
Vision Infosystems (VIS)

these cases, special configuration is required. This type of network is called as NBMA (Non
Broadcast Multi-Access network).

• Nonbroadcast multiaccess (NBMA) : This topology creates multiple point-to-point line with
many destinations networks. Topologies like X.25, ATM, Frame Relay, are examples of this
technology. NBMA uses a fully meshed or partially meshed network OSPF sees it as a broadcast
network, and it will be represented by one IP subnet. This technology requires manual
configuration of the neighbors and the DR and BDR selection. DR and BDR routers are elected.
The DR and BDR must be directly connected to their neighbors. All network traffic sent between
neighbors will be replicated for each physical circuit using Unicast addresses because multicast
and broadcast addresses are not supported by NBMA network.

Designated Router
The designated router is used multi-access broadcast network to avoid flooding of LSA in a physical
segment. If multiple routers is available in a multi-access network then there will be a mesh of neighbor
relationship and flooding of LSA between each neighbors. The designated router is responsible for
Vision Infosystems (VIS)

maintaining the topology table for the segment. If routers are connected to a broadcast segment, one
router on the segment is assigned the duty of maintaining adjacencies with all the routers on the segment.
This router is known as the designated router and is elected by the use of the Hello protocol. The election
is determined by either the highest IP address or this command:
ip ospf priority number (the priority number can be between 0 to 255)

By default each router interface has priority of 1. If we set the priority to 0 then that router will not
participate in DR election. The router highest IP address is called as Router-ID or router identification
address. The highest IP of loopback interface is first preferred. If no loopback interface is configured the
highest IP of any interface is selected.

Backup Designated Routers


Backup Designated Router (BDR) act as a redundancy to DR. if DR is down or fails the BDR takes over
it position. So each OSPF router must form and adjancy with DR and also BDR. Both DR and BDR are
essential requirement in multi-access broadcast network. The rule for election of BDR is same as DR but
the next highest IP after DR is elected as BDR.

Basic OSPF configuration

Configuration of R1 router
Router ospf 10
Network 10.1.1.0 0.0.0.255 area 0
Network 20.0.0.1 0.0.0.0 area 0

Configuration of R2 router
Router ospf 20
Network 10.2.2.0 0.0.0.255 area 0
Network 20.0.0.2 0.0.0.0 area 0

Explanation to above configuration


In the above configuration both router R1 and R2 are in same Area 0 i.e. both the routers are acting as
backbone or internal router to Area0.
• OSPF process and process ID : The first step in configuration of OSPF on each router is to
enable OSPF routing process with a process ID. Remember that process ID is not area ID, its just
process number assigned manually for OSPF. This process ID is local to each router. The process
ID is used when you want to configure multiple OSPF instance on a single router. The process ID
is between 1 to 65536.
Vision Infosystems (VIS)

• Networks to publish and Area configuration : After configuration of process ID the next step is
configuration interface or network that should be included in OSPF process using network
command and define the network to be included in an area.
• Router ID : The optional part of configuration of RouterID which act as router Identification
number. This routerID is used for many reasons in OSPF like master/slave relationship, DR and
BDR election, etc.
• Optional Parameters : The other parameters depends on configuration of your OSPF and
topology type.

Assigning metric or COST to OSPF


This command manually overrides the default cost that the router assigns to the interface. The default cost
is calculated based on the speed of the outgoing interface. The cost command syntax is as follows:

ip ospf cost <cost>

A lower cost increases the likelihood that the interface will be selected as the best or shortest
path. The range of values configurable for the cost of a link is 1 to 65535. In general, the path cost in
Cisco routers is calculated using the formula 108/ bandwidth. 5

Type of link Default Cost value


56-kbps serial link 1785
T1 (1.544-Mbps serial link) 64
Ethernet 10
Fast Ethernet 1
16-Mbps Token Ring 6
2 Mbps (Serial Link) 48

A sample configuration of OSPF with Area 0


Vision Infosystems (VIS)

Configuration of R1 router
Router ospf 10
Network 10.1.1.0 0.0.0.255 area 0
Network 20.1.1.1 0.0.0.7 area 0

Configuration of R2 router
Router ospf 10
Network 10.1.2.0 0.0.0.255 area 0
Network 20.1.1.2 0.0.0.7 area 0

Configuration of R3 router
Router ospf 10
Network 10.1.1.0 0.0.0.255 area 0
Network 20.1.1.9 0.0.0.3 area 0
Network 20.1.1.3 0.0.0.7 area 0

Configuration of R4 router
Router ospf 10
Network 10.1.3.0 0.0.0.255 area 0
Network 20.1.1.14 0.0.0.3 area 0

Configuration of R5 router
Router ospf 10
Network 10.1.4.0 0.0.0.255 area 0
Network 20.1.1.10 0.0.0.3 area 0
Network 20.1.1.17 0.0.0.3 area 0

Configuration of R6 router
Router ospf 10
Network 10.1.5.0 0.0.0.255 area 0
Network 20.1.1.18 0.0.0.3 area 0

In the above scenario router R3 is elected as DR and router R2 is elected as BDR based on highest router
ID (highest IP of any interface) on a single broadcast network i.e. Ethernet. The router R4, R5 and R6
does not required DR and BDR election as they form a point to point network topology.

Basic OSPF show commands


• Show ip route : Shows detailed information on the networks that the router is aware of and the
preferred paths to those networks.
• Show ip ospf interface [int. type] : Gives information on how OSPF has been configured on each
interface. Typing errors are easily seen with this command.
• Show ip ospf [process-id] : Display information of OSPF routing process on a router.
• Show ip ospf database : Shows the contents of the topological database
• Show ip ospf neighbors [neighbor-id]: Displays all the information about the relationship that
the router has with its neighbors—for example, the status of communication and whether it is
initializing or transferring DDP packets.
Vision Infosystems (VIS)

• Show ip protocols : Enables you to view the IP configuration on the router. This command is
useful because it shows not only the interfaces, but the configuration of the IP routing protocols as
well.

You might also like