OSPF, How to Configure OSPF in the Cisco IOS?

OSPF is an interior gateway protocol that routes Internet Protocol (IP) packets solely within a single routing domain (autonomous system). It gathers link state information from available routers and constructs a topology map of the network. The topology determines the routing table presented to the Internet Layer which makes routing decisions based solely on the destination IP address found in IP packets. OSPF was designed to support variable-length subnet masking (VLSM) or Classless Inter-Domain Routing (CIDR) addressing models.How to Configure OSPF in the Cisco IOS

OSPF detects changes in the topology, such as link failures, very quickly and converges on a new loop-free routing structure within seconds. It computes the shortest path tree for each route using a method based on Dijkstra’s algorithm, a shortest path first algorithm.

The OSPF dynamic routing protocol is probably the most popular LAN routing protocol today. OSPF can scale to the largest LANs but can also start out small. While OSPF can be complex to configure, its basic configuration isn’t difficult. How to configure OSPF in the Cisco IOS? Do the steps as follows

What do You Need to Know about OSPF?

Before you configure OSPF, there are three things you should know about it first. Here they are:

OSPF stands for open shortest path first. It also uses the SPF (shortest path first) algorithm to determine the best route to its neighbors.

OSPF is a standard routing protocol, as defined by RFC2328 and RFC1247. This means that OSPF can run on just about any company’s’ routers and OSPF routes from a non-Cisco router can be exchanged with Cisco routers.

The administrative distance for OSPF is 110.

The entire network that OSPF routes for is called an “Autonomous System”, or “AS”.

All OSPF routing updates must traverse area 0. Because of this, you should carefully design your network before you begin deploying OSPF.

With OSPF, every router has its own unique “picture” (topology map) of the network. Routers use “HELLO” packets to periodically check with routers to ensure they are still there. Every router in OSPF is identified with a “router ID”. The router ID can be manually entered or OSPF will automatically choose the IP address with the highest number.

What Features does OSPF Offer?

OSPF offers the following features that are found in a number of routing protocols:

  • A standards-based routing protocol that works is very interoperable between different vendors routers and firewalls
  • Supports variable length subnet masks (VLSM), making it a classless routing protocols
  • Authentication of routing updates are supported
  • Route redistribution is supported between different routing protocols
  • OSPF works well in point to point and point to multipoint, broadcast or non-broadcast configurations
  • OSPF also offers a number of OSPF-specific features such as stub areas, virtual links, and OSPF on demand circuits.

How do You Configure OSPF in the Cisco IOS?

To configure OSPF in the Cisco IOS, just follow these steps:

Set the bandwidth on your interfaces using the bandwidth command Router (config-if)#bandwidth XX (where XX signifies the bandwidth of the WAN connection)

Start the OSPF routing process and specify your process number. The process number is an arbitrary number. It is recommended that the number match on all routers but it is not required. The process ID number does not have to be the AS number, although many people confuse that it is.

Router (config)# router ospf {process-ID#}

Next, instruct the router to advertise the networks that are directly linked to it by entering network statments with the area ID number for that network, like this:

Router (config-router)# network {X.X.X.X} {Y.Y.Y.Y} area {z}

In this example, the X.X.X.X is the network id of a network that is linked directly to the router. The Y.Y.Y.Y is the wildcard mask for that network. The wildcard mask is the inverse mask of the subnet mask. The “z” parameter is the area id number. For small networks, this can always be zero (0) but for larger networks, the area IDs need to be properly planned as all routing updates must traverse area 0.

You should enter a network statement for every network directly attached to the router.

Once OSPF is configured, you can check the status using the show ip route and show ip ospf commands.

For more information on configuring OSPF, see the official Cisco OSPF documentation.

Configuration Examples

Here is an example of a router configured with the OSPF routing protocol:

Interface Gigabit Ethernet 0/0 ip address

Interface Serial 3/0 ip address

router(config)# router ospf 1 router(config-router)# network area 0 router(config-router)# network area 0

NOTE: OSPF is the most popular Interior Routing Protocol (IGP) in use today. For that reason alone, it is a dynamic routing protocol that you should be familiar with.


More Cisco Network Tips

Configuring Local Username Database in Cisco IOS

Cisco WebEx is Changing the Meeting Experience

Share This Post

Post Comment