Configuring simple OSPF

The purpose of this short tutorial is to show you how to configure simple OSPF routing between two Cisco routers. For the purposes of the article the hardware used was two Cisco 3600 (12.3(14)) routers.

Initial setup

I am starting from the point where I already have a two working routers that can ping each other. R1 has an IP address of 192.168.1.1/24 and R2 has an IP address of 192.168.1.2/24. R1 can ping R2 and vice versa. R1 has a loopback interface with IP address 10.10.10.1/24 and R2 has a loopback interface with IP address 20.20.20.1/24 This is our base starting point.

Network Setup

Initial routing tables

The first thing we are going to do is check the routing tables of R1 and R2. On R1 we have -:

R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0

And on R2 we have -:

R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     20.0.0.0/24 is subnetted, 1 subnets
C       20.20.20.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0

Not that the routing tables only contain directly connected subnets as we have not yet configured a routing procotol

Configure OSPF

Now to configure OSPF on both routers, we need the same config on both, this is -:

router ospf 100 log-adjacency-changes network 192.168.1.0 0.0.0.255 area 0 

Now we have OSPF configured, you should see the OSPF adjacency come up on both routers -:

*Mar 1 00:25:41.531: %OSPF-5-ADJCHG: Process 100, Nbr 20.20.20.1 on
fastEthernet0/0 fromĀ  LOADING to FULL, Loading Done

Now that we have OSPF up and running, you will notice that the routes for the loopback interfaces are not being sent to the other router. So we to fix this we need to add some config to the OSPF configuration on both routers -:

router ospf 100 redistribute connected subnets 

This command will tell the routers to redistribute connected subnets into OSPF, so if we examine the routing tables now you should see -:

R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     20.0.0.0/24 is subnetted, 1 subnets
O E2    20.20.20.0 [110/20] via 192.168.1.2, 00:20:51, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0

Note we now have an OSPF route to R2′s loopback subnet on R1.

Thats it for this tutorial, further tutorials will explore more advanced options of OSPF

Tagged with: , , ,
Posted in Cisco

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>