OSPF Configuration Example : Step By Step Guide

ospf example

It is time to take a look to configuring OSPF ( Open shortest path first ) with an OSPF configuration example. In this article we will see “how to configure OSPF” step by step. In our example, we will examine the figure below deeply.

ospf configuration example

1 Configure OSPF for the network above. Router 1 should be a ASBR which redistributes the static routes. These routes shouldn’t increase their metrics while they are passing over the network and should have a beginning OSPF cost of 200. All routers should have a router – id that is similar to their names and all router- id’s should be pinged from all over the OSPF network.
After configuring first step, which router is DR and which router is BDR in Area 0 ?
Define Router 1 DR in Area 0 and Router 2 and Router 3 is not a BDR .rea 0’da R1’i DR yapın. After this configuration, which kind of neighborship established between Router 1 – Router 2 and Router 2 – Router 3 ?
Configure summarization on ABR routers.
Configure summarization on ASBR routers. Summary route should have the same properties as its original and should redistribute the individual routes.

6 Which kind of configuration changes are made if you update the links as gigabitethernet in this network ?


R1(conf)#router ospf 1
R1(conf-router) # network area 0         (A)
R1(conf-router)# router-id


Router – id value should be configured first when we configure OSPF . If we configure router-id after neighborship established, router-id is determined as “” and this value can be changed by resetting all OSPF process” . OSPF configuration is not so hard as you can see

R1(conf)#redistribute static  subnets metric 200 metric-type 2

OSPF external routes are advertised inside as E1 or E2 type routes. E1 routes increase their metrics while E1 routes metrics are constant. So in the example metric-type 2 was used.

R2(conf)#router ospf 1
R2(config-router)#network area 0

Router – id value  is set to and neighborship is established if we configure like this.

R2(config-router)#router-id       (B)

We can set the router-id to after resetting all OSPF process by using the command “clear ip ospf process” . Or we should configure the router-id first as i mentioned before.

R2(config-router)#network area 10

After (A) and (B) steps :

R1#show ip route
S directly connected null 0
S directly connected null 0
S directly connected null 0
S directly connected null 0
C is directly connected f 0/0
O IA via   // IA is interarea route, which means the route learnt from another area. //
R2#show ip route
O E2  [110/200]  via  // Type E2 route with cost of 200
O E2 via
O E2 via
O E2 via
C directly connected
C directly connected
R3(config)#router ospf 1
R3(config-router)#network area 0
R3(config-router)#network area 2
R4(config)# router ospf 1                      
R4(config-router)#router-id              (C)
R4(config-router)#network area 20
R4(config-router)#network area 20                                       

R5(config)#router ospf 1
R5(config-router)#network area 10
R5(config-router)#network area 10


After (A) (B) and (C) configuration steps ;

R5#show ip route
O IA  via     ….                           ….

Even if loopbacks of router 4 is configured as , OSPF sets the mask to /32 because of this is a loopback interface. If we want to see as /24 in the routing table, we should make these config too :

R4(config)# interface loopback 1
R4(config-if)#ip ospf network point-to-point

This is not a well-known trick of configuring OSPF.

R1#show ip ospf interface

(*)state is seen as DR.

Router 1 is DR , Router 2 is BDR in this situation because we firstly configured Router 1 , then we configured Router 2. If we run the “R1(config)# clear ip ospf process” command then we can see the state as DR OTHER which means it is not a DR or BDR

R1(config)#int f 0/0
R1(config-router)#ip ospf priority 200
R2(config)#int f 0/0
R2(config-router)#ip ospf priority 0
R3(config)#int f 0/0
R3(config-router)#ip ospf priority 0

If we don’t want to make a router become a DR or a BDR , we change the priority value of that router’s interface to 0. Priority value is configured under the related interface. This is a very important point for this OSPF configuration example.

R1 # sh ip ospf neigh             FULL/DROTHER            FULL/DROTHER
R2 # sh ip ospf neigh     FULL/DR    2WAY/DROTHER      FULL/-      // No DR or BDR selection is made on the point-to point links. //

R2(config)# router ospf 1
R2(config-router)#area 10 range

After this configuration:

R1#sh ip route via
R3(config)# router ospf 1
R3(config-router)#area 20 range     // Auto summarization on ABR routers are made with "range" commands as you can see above. //
R1(config) # router ospf 1
R2(config)# auto-cost reference-bandwidth 1000

Auto summarization on ASBR routers are made with “summary-address” command as you can see above.
Same config should be made for R2# R3# R4# R5# too..

In this article we made an OSPF configuration example for a better understanding of OSPF protocol.

Leave a Reply

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