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.
2
After configuring first step, which router is DR and which router is BDR in Area 0 ?
3
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 ?
4
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 ?

OSPF CONFIGURATION EXAMPLE

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

 

Router – id value should be configured first when we configure OSPF . If we configure router-id after neighborship established, router-id is determined as “172.30.0.1” 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 172.30.0.2  0.0.0.0 area 0

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

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

We can set the router-id to 2.2.2.2 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 172.30.10.2 0.0.0.0 area 10

After (A) and (B) steps :

R1#show ip route
S 172.16.0.0 directly connected null 0
S 172.16.1.0 directly connected null 0
S 172.16.2.0 directly connected null 0
S 172.16.3.0 directly connected null 0
C 172.30.0.0 is directly connected f 0/0
O IA 172.30.10.0 via 172.30.0.2   // IA is interarea route, which means the route learnt from another area. //
R2#show ip route
O E2 172.16.0.0  [110/200]  via 172.30.0.1  // Type E2 route with cost of 200
O E2 172.16.1.0 via 172.30.0.1
O E2 172.16.2.0 via 172.30.0.1
O E2 172.16.3.0 via 172.30.0.1
C 172.30.0.0 directly connected
C 172.30.10.0. directly connected
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 172.30.0.3  0.0.0.0 area 0
R3(config-router)#network 172.30.20.3  0.0.0.0 area 2
R4(config)# router ospf 1                      
R4(config-router)#router-id 4.4.4.4              (C)
R4(config-router)#network 172.30.20.4  0.0.0.0 area 20
R4(config-router)#network 10.0.0.0  0.255.255.255 area 20                                       

R5(config)#router ospf 1
R5(config-router)#router-id 5.5.5.5
R5(config-router)#network 10.10.0.0  0.0.255.255 area 10
R5(config-router)#network 172.30.10.5  0.0.0.0 area 10

 

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

R5#show ip route
…
O IA 10.20.3.1/32  via 172.30.10.2        
     10.20.2.1/32 ….                              
     10.20.1.1/32 ….
     10.20.0.1/32

Even if loopbacks of router 4 is configured as 10.20.3.1 255.255.255.0 , 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
2.2.2.2             FULL/DROTHER
3.3.3.3            FULL/DROTHER
R2 # sh ip ospf neigh
1.1.1.1     FULL/DR
3.3.3.3    2WAY/DROTHER
5.5.5.5      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 10.10.0.0  255.255.252.0

After this configuration:

R1#sh ip route
  10.10.0.0/22 via 172.30.0.2
R3(config)# router ospf 1
R3(config-router)#area 20 range 10.20.0.0  255.255.252.0     // Auto summarization on ABR routers are made with "range" commands as you can see above. //
R1(config) # router ospf 1
R1(config-router)#summary-adress 172.16.0.0  255.255.252.0
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 *