Configure OSPF

The OSPF basic configuration is very simple and requires only two steps:

  • enable OSPF on a router using the router ospf PROCESS-ID global configuration command.
  • define on which interfaces OSPF will run and what networks will be advertised with the network IP_ADDRESS WILDCARD_MASK AREA command in the OSPF configuration mode.


The OSPF process number doesn’t have to be the same on all routers in order for routers to establish a neighbor relationship, but the area parameter has to be the same on all neighboring routers in order for routers to become neighbors.


Let’s get started with some basic OSPF configuration. Here is our example network:

ospf example network

We have a network of two routers and two hosts. To configure routers to use OSPF and exchange topology information, we first need to enable OSPF on both routers. We then need to define which networks will be advertised into OSPF. This can be done by using the following set of commands on R1 and R2:

ospf configuration 1

ospf configuration 2

The network commands entered on two routers include their directly connected subnets. We can verify that the routers have have established a neighbor relationship by typing the show ip ospf neighbor command on R1:

show ip ospf neighbor

To verify that the topology information were exchanged, we can use the show ip route ospf command on R1:

show ip route ospf

Note that the OSPF routes are marked with the O character. In the output above you can see that R1 has learned about the network

Geek University 2022