OSPF (Open Shortest Path First) is an IGP (internal gateway protocol), and OSPF is an open standard protocol originally defined in RFC 2328. Since then OSPF has been updated numerous times including functionality to support IPv6 and Address Families.
OSPF is supported on every major routing platform as well as Windows Server 2003 and Linux Operating Systems.
The main purpose of OSPF is for network devices to exchange reachability and metric information so that routing tables can be built and selection of best possible paths across the network analyzed.
OSPF is a link-state routing protocol that runs Dijkstra’s algorithm to calculate the shortest path to destination networks using the cost scalar metric. This is accomplished by first establishing neighbor adjacencies by using multicast hello messages and then flooding reachable networks and network topology changes to neighbors when a link’s status changes. OSPF also sends “paranoia updates” to neighbors of all recent link state changes every 30 minutes.
Here are some of OSPF’s features:
- Fast convergence compared to a distance-vector protocol like RIP.
- Routing update packets (Link State Advertisements) are small, as it doesn’t send the entire routing table.
- Avoids routing loops.
- It scales very well for large networks by using a two tier ‘area’ concept
- It recognizes the bandwidth of a link and takes this into account in link selection.
- It supports variable-length subnet masks (VLSM) or CIDR.
- It supports a long list of optional features that many other protocols don’t.
Configuring OSPF
Some may find OSPF configuration intimidating, so let’s look at how to make it easy. Let’s start with a basic network:
Our network example has two routers-one in San Diego (192.168.1.0 /24) and one in Dallas (192.168.2.0 /24). Between these two routers, there’s a point-to-point T1 circuit with IP network address 10.10.10.0/30. The San Diego router’s WAN interface is 10.10.10.1, and the Dallas router’s WAN interface is 10.10.10.2.
We’ll begin by configuring the router in San Diego.
The first step to configuring OSPF is to use the router ospf command when in Global Configuration Mode. Here’s an example:
cell_router(config)# router ospf {process number}
cell_router(config-router)#
While it doesn’t matter which process number you use, I recommend keeping it the same on all OSPF routers on your network. We usually use 1 to keep everything simple. However, if you use different process numbers, OSPF will still work and exchange all routes-unlike EIGRP.
After entering OSPF Configuration Mode, the most common next step is to specify which networks OSPF will advertise, which you can do using the network command. Here’s an example:
cell_router(config-router)# network 192.168.1.0 0.0.0.255 area 0
cell_router(config-router)# network 10.10.10.0 0.0.0.3 area 0
The first parameter is the network ID, and the second parameter is the inverse mask. The inverse mask-or wildcard mask-is the inverse of the subnet mask. It tells OSPF what range of interfaces the IP addresses given will apply to. Therefore, you can have one network statement that covers multiple interfaces.
You also need to specify the area, which is how OSPF organizes networks. All traffic must flow through area 0. In a small network, it’s logical to put all networks in area 0, as we did in the example.
After you’ve configured each side of the network, the routers will exchange routes and form adjacencies. You should see a statement in the log file or console that looks something like the following:
*Mar 1 02:53:33.370: %OSPF-5-ADJCHG: Process 100, Nbr 10.10.10.1
on Ethernet0/0 from LOADING to FULL, Loading Done
To make sure you see these types of messages, use the log-adjacency-changes command in your OSPF router configuration. This command causes OSPF to enter information into the router’s log file whenever it loses or regains connectivity with its neighbors. Here’s an example:
cell_router(config-router)# log-adjacency-changes
Check the status of OSPF
After you’ve configured OSPF, you need to know how to check its status. Here are some common OSPF commands:
show ip ospf
show ip ospf neighbor
show ip ospf interface
show ip route ospf
For more information on OSPF, see Cisco’s OSPF Design Guide.
We hope this helps get you started with OSPF.