Sharing Ilmu

Sharing for useful things

Basic Configuration OSPF (Open Shortest Path First) on Cisco Router

OSPF (Open Shortest Path First) is an interior gateway protocol (IGR) for routing ip that operationg with a single routing domain  or single autonomous system. this routing protocol uses a link state routing algorithm and uses Djikstra algorithm.

In this tutorial I’ll explain about basic configuration OSPF on router cisco.

The following is the topology :

Based on the topology above, there are 2 router that are connected and each router has an ip address behind that.

So we need to configure the routing so that network can be connected each other.

 

Configure IP Address on R1 :

R1(config)#int gig0/0 
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#int lo0
R1(config-if)#ip address 192.168.100.1 255.255.255.0
R1(config-if)#exit
R1(config)#

Show ip address configuration on R1 :

R1#show ip int brief
Interface                        IP-Address    OK?    Method     Status       Protocol
GigabitEthernet0/0     12.12.12.1       YES    manual        up                up 
GigabitEthernet0/1     unassigned.    YES    unset  administratively down  down 
GigabitEthernet0/2     unassigned     YES    unset  administratively down down 
GigabitEthernet0/3     unassigned     YES    unset administratively down down 
Loopback0              192.168.100.1 YES    manual   up up 
R1#

 

Configure IP Address on R2 :

R2(config)#int g0/0
R2(config-if)#ip address 12.12.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#int lo0
R2(config-if)#ip addres 192.168.200.1 255.255.255.0
R2(config-if)#exit

 

Show ip address configuration on R2 :

R2#show ip int brief
Interface            IP-Address    OK?     Method   Status    Protocol
GigabitEthernet0/0   12.12.12.2    YES manual up up 
GigabitEthernet0/1   unassigned    YES unset administratively down down 
GigabitEthernet0/2   unassigned    YES unset administratively down down 
GigabitEthernet0/3   unassigned    YES unset administratively down down 
Loopback0            192.168.200.1 YES manual up up 
R2#

 

Now Test ping from router R1 to R2

R1#ping 12.12.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

R1#ping 192.168.200.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.200.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R1#

ping test to ip R2 12.12.12.2 successfull because the ip is direct connect with the router R1. but fail to 192.168.200.1 because there is no available ip route on R1 towards network behind R2.

R1#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 12.12.12.0/24 is directly connected, GigabitEthernet0/0
L 12.12.12.1/32 is directly connected, GigabitEthernet0/0
192.168.100.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.100.0/24 is directly connected, Loopback0
L 192.168.100.1/32 is directly connected, Loopback0
R1#

Now lets configure the dynamic routing protocol OSPF on R1 and R2. To configure the ospf you can following the step on global configuration mode :

# router ospf  [ospfProccessID]
#network [ipnetwork] [wildcardmask] area [areaID]

Explain :

The Willcard mask is the Subnetmask – 255.255.255.255 

example if your network using the subnetmask /24 so : 255.255.255.0 – 255.255.255.255 = 0.0.0.255 for the wilcardmask

 

Configuration OSPF R1 :

R1(config)#router ospf 1
R1(config-router)#network 12.12.12.0 0.0.0.255 area 0
R1(config-router)#network 192.168.100.0 0.0.0.255 area 0
R1(config-router)#exit
R1(config)#

Configuration OSPF R2 :

R2(config)#router ospf 1
R2(config-router)#network 12.12.12.0 0.0.0.255 area 0
R2(config-router)#network 192.168.200.0 0.0.0.255 area 0
R2(config-router)#exit
R2(config)#

You can see this log if configuration ospf on routers are successfull

*Aug 14 17:00:13.304: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.200.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done

 

verify the connection with show ip ospf neighbor on each routers

R1#show ip ospf neighbor

Neighbor ID     Pri State Dead Time Address Interface
192.168.200.1   1   FULL/BDR 00:00:38 12.12.12.2 GigabitEthernet0/0
R1#
R2#show ip ospf neighbor

Neighbor ID    Pri State Dead Time Address Interface
192.168.100.1   1   FULL/DR 00:00:38 12.12.12.1 GigabitEthernet0/0
R2#

verify the ospf route on each routers

R1#show ip route ospf
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

192.168.200.0/32 is subnetted, 1 subnets
O 192.168.200.1 [110/2] via 12.12.12.2, 00:06:26, GigabitEthernet0/0
R1#

 

R2#show ip route ospf
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

192.168.100.0/32 is subnetted, 1 subnets
O 192.168.100.1 [110/2] via 12.12.12.1, 00:07:20, GigabitEthernet0/0
R2#

You can see for router R1 and R2 already has the route towards the each network behind with the flag which mean the OSPF route.

Now let’s test ping again on each router :

R1#ping 192.168.200.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.200.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
R1#

 

R2#ping 192.168.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
R2#

Test ping was successfull !!

 

 

z

2 thoughts on “Basic Configuration OSPF (Open Shortest Path First) on Cisco Router

  • alternatives to google adsense
    August 18, 2024 at 5:59 am

    I found this post to be very informative and well-organized. Your detailed analysis and clear explanations make it a pleasure to read. The practical examples you included were particularly helpful. Thank you for sharing your knowledge with us.

  • best ad networks
    August 21, 2024 at 11:53 pm

    The article is both interesting and well-written. You make the concepts easy to understand and use by providing clear explanations and practical examples. Thank you for taking the time to provide such detailed information. Your knowledge and insight are much appreciated.

Leave a Reply

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

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