Today I will be trying to set up a single-area OSPF network. I started by creating a simple topology with 3 routers:

First I will configure each interface with an IP address and put them in the up state. I will also assign each router a loopback interface.
To enable OSPF on a router we first have to use the router ospf process-id command on each router. For process-id I will just use 1 in this case. The process ID's on the routers do not have to match to form neighbor relationships but I will keep them all the same to avoid confusion.
Once OSPF is enabled we will use the network command to specify the allowed routes on the network. For this we will use the 0.0.0.3 wildcard mask to only allow the first couple of addresses on the network. All routes can be allowed with the network 0.0.0.0 255.255.255.255 command but it is not good practice.
We will also need to specify the OSPF area ID in the network command. Unlike the process-id, the area ID's must match to form neighbor relationships. For now I will put them all into area 0 as it is only a single-area network.

Once configured, the routing process can be verified with the show ip protocols command:

Looking at this output on R2 I immediately notice an error I made. I configured the network 10.0.20.0 rather than 10.20.1.0. To fix this I will have to go back into the OSPF process config and issue the no network 10.0.20.0 0.0.0.3 area 0 command to remove the mistake and reconfigure the correct network.
Once fixed, you can see the neighbor relationship has been formed as the CLI outputs the following:

OSPF neighbor relationships can also be verified with the show ip ospf neighbor command:

Further, we can use the show ip ospf interfaces briefcommand to see the configuration and router state:

One thing I had noticed from the outputs was that the neighbors were being formed with the router's loopback interfaces. This is because the router will use the highest loopback address as the router ID if one is not manually assigned. It is best practice to manually set the router ID to avoid problems with neighbor relationships, therefore I will go back and assign each router a router ID with the router-id command under the ospf process.

Once the router ID is changed, the CLI prompts to reload ospf with clear ip ospf process command. Issuing that command shuts down the neighbor relationships momentary while it re-initiates OSPF.

Once the neighbors have been re-established, I verified with the show ip ospf neighbor command once more. It now lists the manually set router ID's in favor of the loopback addresses.

Next I wanted to confirm routes learned via OSPF so I looked at the routing table with the show ip routes command. The output from R1 lists that it learned the route to network 10.20.1.0/24 from router 2 via OSPF as signified by the O designation.

Next I wanted to set up a default route to allow less specific routes pass through the network. This can be done by issuing the default-information originate command. First we'll have to set the default route to the loopback interface set up earlier.

Confirmation:

Next I am going to try out some of the optional optimization features available to OSPF. First I will look at passive interfaces. Passive interfaces are used to stop certain interfaces from participating in OSPF and will not send OSPF hellos. It is good practice to disable any unused and unwanted ports to avoid undesired topology changes. Ports can be set to passive by default by using the passive-interface default command or by interface with the passive-interfacecommand. For now I will just go by interface. To test I went on R3 and made its loopback interface passive.

Confirmation:

Next, I wanted to play around with link cost. The cost is one of the drawbacks of OSPF as it does not differentiate the higher speed links by default. This can be solved by changing the reference bandwidth for the cost calculation. The reference bandwidth can be changed with the auto-cost reference bandwidth command. The reference bandwidth must be the same on all routers to avoid problems. Since the maximum speed we are using in this topology is 1Gb I will set the bandwidth to 1000.

Finally, I will change the hello and dead intervals. By default these are 10s and 40s (4x hello) respectively.

These can be changed with the ip ospf hello-intervaland ip ospf dead-interval commands. I will reduce these by half. It is also important that these match on all routers in the area otherwise neighbor relationships will not form.

While these are being changed the neighbor states are automatically put in the down state:

Once all interface have been configured properly, the neighbor states are re-enabled. Here is the verification from the ip ospf interfaces command:

That is all I wanted to try out for now. In the next lab I want to try configuring a multi-area OSPF topology.
Created with © systeme.io