OSPF Basic configuration Step by step on Cisco Routers

Today I am going to talk about the basic configurations of OSPF on Cisco routers step by step. OSPF is one of the link state routing protocol 

Below is the basic topology of the OSPF which has not any relevance with the configuration part. The topology is just to show you what kind of network you have in the OSPF separated in the areas but with have one process id.

Fig 1.1- Sample OSPF Topology

There is no relevance of the IP addresses uses here with any of the live networks or with any of the enterprise networks.

Lets talk step by step in OSPF

In Step 1, I am talking about how to enable the OSPF routing protocol on Cisco routers by putting the OSPF process id. Make sure you know about the process id, It is similar like AS number in the BGP but defines the OSPF instances, So if we have two process id's like OSPF 2 and OSPF 3, it clearly shows that these are two different networks.

Step -1 Enable OSPF
RouteXP(config)# router ospf 2
RouteXP(config-router)# network 10.0.0.0 255.0.0.0 area 0 

In Step 2, As i earlier said if there are two OSPF processes then the traffic flow will not be like the internal network and if you want to inject the traffic from one OSPF process id to another you need to re-distribute the routes similarly you redistributing the routes from IS-IS, BGP or EIGRP in OSPF domain.

Step -2 Redistribute routes from one OSPF process to another OSPF process
RouteXP(config)# route-map 1-to-2 permit 
RouteXP(config-route-map)# match metric 1 
RouteXP(config-route-map)# set metric 5 
RouteXP(config-route-map)# set metric-type type-1 
RouteXP(config-route-map)# router ospf 2 
RouteXP(config-router)# redistribute ospf 1 route-map 1-to-2 

In Step 3, I am explaining about the OSPF interfaces parameters where you can configure the cost, priority, hello and dead interval timers, Authentication. All these parameters can be set by administrator and is not compulsory. 

Step -3 Configure OSPF interface parameters 
RouteXP(config)# router ospf 2
RouteXP(config-router)# network 2.0.0.0 255.0.0.0 area 0 
RouteXP(config-router)# interface inside 
RouteXP(config-interface)# ospf cost 20 
RouteXP(config-interface)# ospf retransmit-interval 15 
RouteXP(config-interface)# ospf transmit-delay 10 
RouteXP(config-interface)# ospf priority 20 
RouteXP(config-interface)# ospf hello-interval 10 
RouteXP(config-interface)# ospf dead-interval 40 
RouteXP(config-interface)# ospf authentication-key cisco 
RouteXP(config-interface)# ospf message-digest-key 1 md5 cisco 
RouteXP(config-interface)# ospf authentication message-digest 

In Step 4, I am talking about the OSPF area parameters where i can define the authentication and area types like you can configure the area as Stub area, NSSA area, Totally stubby area and so on. The authentication per interface and the authentication for the area differs. I explained authentication on interface in Step 3 and here you can configure the authentication on the OSPF process.

Step -4 Configure OSPF area parameters 
RouteXP(config)# router ospf 2
RouteXP(config-router)# area 0 authentication 
RouteXP(config-router)# area 0 authentication message-digest 
RouteXP(config-router)# area 17 stub 
RouteXP(config-router)# area 17 default-cost 20 

In Step 5, It is just to configure the route calculation timers and show the log adjancey changes.

Step -5 Configure the route calculation timers and show the log neighbor up/down messages 
RouteXP(config-router)# timers spf 10 120 
RouteXP(config-router)# log-adj-changes [detail] 

Below is show OSPF commands will show you all the configuration you done with the OSPF process id.

RouteXP(config)# show ospf 
Routing Process "ospf 2" with ID 20.1.89.2 and Domain ID 0.0.0.2
Supports only single TOS(TOS0) routes
Supports opaque LSA
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 5. Checksum Sum 0x 26da6
Number of opaque AS LSA 0. Checksum Sum 0x     0
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
External flood list length 0
    Area BACKBONE(0)
        Number of interfaces in this area is 1
        Area has no authentication
        SPF algorithm executed 2 times
        Area ranges are
        Number of LSA 5. Checksum Sum 0x 209a3
        Number of opaque link LSA 0. Checksum Sum 0x     0
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0