Outline
Open Shortest Path First Protocol (OSPF)
Bazen G.
Open Shortest Path First Protocol (OSPF) 1 / 15
Outline
1 Introduction
2 OSPF Basics
3 OSPF Operation
4 OSPF Configuration
Open Shortest Path First Protocol (OSPF) 1 / 15
Introduction
What is OSPF?
Open
Developed by IETF IGP working group, RFC2328.
SPF
Each router floods link-state information through its neighbors to other routers
Based on the flooded link-state information, each router maintains a complete
link-state database
Based on the link-state database, a routing table is constructed using SPF
(e.g., Dijkstra’s) algorithm.
Runs over IP directly.
Open Shortest Path First Protocol (OSPF) 2 / 15
OSPF Basics
Features of OSPF
Use flexible metrics instead of only hop count.
Supports variable-length subnetting.
Allows load balancing among equal-cost paths.
Supports multiple routes; one for each IP type of service (ToS).
Authenticates route exchanges.
Quick convergence.
Uses multicast rather than broadcast of its messages to reduce network load.
Open Shortest Path First Protocol (OSPF) 3 / 15
OSPF Basics
Hierarchical OSPF
AS is organized as two-level hierarchy
AS is partitioned into self-contained areas.
Areas are interconnected by a backbone area.
Areas are identified by a 32-bit area ID.
[Link] is reserved for the backbone area.
Four types of routers
Internal router, area border router, backbone router, autonomous system
boundary router (ASBR).
Open Shortest Path First Protocol (OSPF) 4 / 15
OSPF Basics
OSPF AS organized into a 2-level hierarchy
Within each area, border router responsible for routing outside the area
Backbone area contains all area border routers and possibly others
Exactly one area is backbone area
Open Shortest Path First Protocol (OSPF) 5 / 15
OSPF Operation
Router Identities
Each router in an OSPF network needs a unique ID.
The ID is included in any OSPF messages the router generates that other
OSPF routers will process.
The router ID is chosen according to one of the following criteria:
The highest IP address on the routers active loopback interfaces is used (this
is a logical interface on a router).
If no loopback interface exists with an IP address, the highest IP address on
its active interfaces is used when the router boots up.
Open Shortest Path First Protocol (OSPF) 6 / 15
OSPF Operation
Finding Neighbors
An OSPF router learns about its OSPF neighbors and builds its adjacency
and topology tables by sharing link state advertisements (LSAs).
Neighbor routers generate LSA hello messages every 10 seconds.
If a neighbor’s hello is not seen within the dead interval time, which
defaults to 40 seconds, the neighbor is declared dead.
Open Shortest Path First Protocol (OSPF) 7 / 15
OSPF Operation
In order for two routers to become neighbors, the following must match on each
router:
The area number
The hello and dead interval timers on their connected interfaces
The OSPF password (optional), if it is configured
The area stub flag, indicating the type of area; a stub is used to contain
OSPF messages and routing information
MTU sizes on the connected interfaces
Open Shortest Path First Protocol (OSPF) 8 / 15
OSPF Operation
OSPF routers will go through three states, called the exchange process, in
determining whether they will become neighbors:
1 Down state: The routers have not exchanged any OSPF information with any
other router.
2 Init state: A destination router has received a new router’s hello and adds it
to its neighbor list.
3 Two-way state: The new router receives a unidirectional reply (from the
destination router).
Open Shortest Path First Protocol (OSPF) 9 / 15
OSPF Operation
Designated and Backup Designated Routers
For each multi-access broadcast segment,there is a DR and a BDR as well as
other OSPF routers, called DROTHERs.
When an OSPF router comes up, it forms adjacencies with the DR and the
BDR.
Any exchange of routing information is between these DR/BDR routers and
the other OSPF neighbors on a segment (and vice versa).
An OSPF router talks to a DR using the IP multicast address of [Link].
The DR and the BDR talk to all OSPF routers using the [Link] multicast
IP address.
The OSPF router with the highest priority becomes the DR for the segment.
If there is a tie, the router with the highest router ID will become the DR.
Open Shortest Path First Protocol (OSPF) 10 / 15
OSPF Operation
Sharing Routing Information
After electing the DR/BDR pair, the routers continue to generate hellos to
maintain communication.
1 Exstart state: The DR and BDR form adjacencies with the other OSPF
routers on the segment.
2 Exchange state: The master starts sharing link state information first with
the slave. These are called database description packets (DBDs).
3 Loading state: If the master has more up-to-date information than the slave,
the slave will respond to the master’s original DBD with a link state request
(LSR).
4 Full state: Once the master and the slave are synchronized, they are
considered to be in a full state.
Open Shortest Path First Protocol (OSPF) 11 / 15
OSPF Configuration
OSPF Configuration
When configuring OSPF, use the following syntax:
Router(config)# router ospf process ID
Router(config-router)# network IP address wildcard mask area
area #
The process ID is locally significant and is used to differentiate between
OSPF processes running on the same router.
A wildcard mask is an inverted subnet mask, with the 1s and 0s switched.
Using a wildcard mask, you can be very specific about which interfaces belong
to which areas.
Open Shortest Path First Protocol (OSPF) 12 / 15
OSPF Configuration
Loopback Interfaces
A loopback interface is a logical, virtual interface on a router.
All IOS platforms support loopback interfaces, and you can create as many of
these interfaces as you need.
Here are some reasons you might want to create a loopback interface:
To assign a router ID to an OSPF router
To use for testing purposes, since this interface is always up
To terminate special connections, such as GRE tunnels or IPSec connections,
since this interface is always up
Open Shortest Path First Protocol (OSPF) 13 / 15
OSPF Configuration
Loopback Interfaces
A loopback interface is a logical, virtual interface on a router.
All IOS platforms support loopback interfaces, and you can create as many of
these interfaces as you need.
Here are some reasons you might want to create a loopback interface:
To assign a router ID to an OSPF router
To use for testing purposes, since this interface is always up
To terminate special connections, such as GRE tunnels or IPSec connections,
since this interface is always up
To create a loopback interface, use the following command:
Router(config)# interface loopback port #
Router(config-if)# ip address IP address subnet mask
Open Shortest Path First Protocol (OSPF) 13 / 15
OSPF Configuration
OSPF Metric Values
You can affect the cost metric that OSPF uses in picking the best-cost routes for
the routing table in two ways.
1 To change the cost of an interface manually, use the following configuration:
Router(config)# interface type [slot #/]port #
Router(config-if)# ip ospf cost cost value
Notice that the cost is assigned within an interface.
This value can range from 1 to 65,535 (108 ).
Open Shortest Path First Protocol (OSPF) 14 / 15
OSPF Configuration
OSPF Metric Values
You can affect the cost metric that OSPF uses in picking the best-cost routes for
the routing table in two ways.
1 To change the cost of an interface manually, use the following configuration:
Router(config)# interface type [slot #/]port #
Router(config-if)# ip ospf cost cost value
Notice that the cost is assigned within an interface.
This value can range from 1 to 65,535 (108 ).
2 To configure the bandwidth on your router’s interfaces, use the following
command:
Router(config)# interface type [slot #/]port #
Router(config-if)# bandwidth speed in Kbps
Open Shortest Path First Protocol (OSPF) 14 / 15
OSPF Configuration
Questions?
Open Shortest Path First Protocol (OSPF) 15 / 15