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. Let’s learn how to configure OSPF in the Cisco IOS.
Before you configure OSPF, there are three things you should know about it first. Here they are:
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.
OSPF offers the following features, that are found in a number of routing protocols:
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.
Here is an example of a router configured with the OSPF routing protocol:
Interface Gigabit Ethernet 0/0 ip address 10.1.1.1 255.255.255.0
Interface Serial 3/0 ip address 10.2.1.1 255.255.255.0
router(config)# router ospf 1 router(config-router)# network 10.1.1.1 0.0.0.255 area 0 router(config-router)# network 10.2.1.1 0.0.0.255 area 0
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. I encourage you to spend some time configuring a basic OSPF network to get experience with OSPF. If you have questions about configuring OSPF, please post your question or comment in our Cisco Router discussion forums.
To learn more about Cisco networking, consider the Train Signal CCNA Video Training package!