Configuring OSPFv2

Submitted by rayc on Wed, 12/01/2021 - 21:07

Okay, so now let's talk about how to configure OSPF. Configuring OSPF is just like configuring any other dynamic routing protocol. You first need to enable OSPF by configuring the OSPF process ID by using the global configuration command router ospf <process-id>. Once you have configured the OSPF Process ID, it is best practice to manually configure the OSPF Router ID using the router ospf configuration subcommand router-id <id>. For this I will be configuring each device in the topology to use their Loopback IP's for the OSPF Router ID. Below is the topology example I will be configuring. 

Topology to show OSPF Configuration

In this design, we have 4 OSPF Areas, Area 0, 10, 20 and 30. OSPF Area 30 will be configured as a Stub Area and use a GRE tunnel between R5 and R7 to connect to Area 0. I will not be going through the EIGRP Configuration here for the link between R3 and R9. Let's get started by configuring the OSPF Process on each router. For this example, I will be configuring the Process ID to match the router name so R1 will use OSPF process if 1, R2 will use ID 2 and so on. I will also not show each step of each routers OSPF Configuration as that would be redundant.

Configuring the OSPF Process ID and Router ID on R1

Just to show that you can use any process ID I will also show R2's OSPF Process ID and Router ID configuration.

Configuring the OSPF Process ID and Router ID on R2

Once we have configured the OSPF Process and Router ID's, the next step is to enable OSPF on the required Interfaces. To enable OSPF on interfaces, you specify the network command and the area that the interface is assigned to. There are again multiple ways to enable OSPF on a router.

  • Use a network command that encompasses all IPv4 interfaces on the router.
  • Use a network and mask that includes 1 or more than 1 interface on the router.
  • Use specific network statements that include a single interface IP.

 

The command to enable an interface for OSPF is network <network> <wilcard mask> area <ID>.  Because R1 is in a single Area, I will use a network command that encompasses all interfaces on R1 and assign them all to Area 10. The command is network 0.0.0.0 255.255.255.255 area 10. This tells the router to enable OSPF on all interfaces with an IP between 0.0.0.0 and 255.255.255.255 and assign them to the OSPF Area 10. If I wanted to then configure a specific interface for a different area, I could use a more specific network statement and that would take precedence over the less specific command. 

Configuring the network statement on R1

Let's now look at R2 as it has interfaces in multiple Areas. To show that the more specific network statements take precedence, I will use a less specific 0.0.0.0 255.255.255.255 network command on R2 for Area 0, and configure a more specific Area command for the G1/0 interface to be in Area 10.

Configuring network statements on R2

I'm not going to show the network statements of the other routers but I used tje very specific network statements that included the Interface IP only on all of the others. Because Area 30 is a Stub area, we also need to configure R5, R7 and R8 to have area 30 as a stub area. To configure the Stub area, we use the ospf router configuration subcommand area <id> stub

Configuring R7 Area 30 as a stub area

Notice that as soon as the Stub area was configured, the neighbour relationships were dropped? This is a requirement for OSPF neigbhour adjacency that all areas be configured as the same type of area. 

Configure R5 Area 30 as a stub Area

As you can see , once Area 30 on R5 was configured as a stub area, the neighbour adjacency was formed with R7 over the Tunnel0 interface. With R8 configured as a stub area, we can check the route table and we should only see the OSPF IA routes, with a default route being sent into the Area by R5.

Route table of R8 and LSDB showing Type 5 default Route LSA

That's about it for configuration here as i have gone through other configuration features of OSPF in other articles such as reference bandwidth configuration and route summarisation.