How to configure OSPF(Open Shortest Path First) routing protocol on routers

In this article, we learn about how to configure OSPF(Open Shortest Path First) routing protocol on the routers. We generally use OSPF in large networking companies because EIGRP and RIP routing protocols having some limitations in it. Like RIP routing protocol only work on maximum 15 hop count. If hop count is more than 15 in that case RIP routing is useless to us. So generally we use RIP routing in small networking companies. In EIGRP routing protocol there are also some limitations are present like EIGRP support more than 15 hop count but EIGRP only works on cisco routers. So we use OSPF routing protocol on routers. So now let’s start here how to configure OSPF on routers.

Now to understand OSPF configuration on routers we take a lab in cisco packet tracer. In this lab, we take two routers and two PCs to configure OSPF routing protocol. We do this whole lab in three parts, In the first part we assign IP address on each and every interface of the router. In the second part, we configure OSPF routing on the routers to make communication between two different routers. In the third part, we use the ping command to check whether they are properly communicating with each other or not.

ospf configuration lab

Part 1: – Assign IP address on each and every interface of the router using given below command

For router R1

Router>enable

Router#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#hostname R1

R1(config)#interface FastEthernet0/0

R1(config-if)#ip address 172.16.1.1 255.255.0.0

R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R1(config-if)#exit

R1(config)#interface Serial0/0/0

R1(config-if)#ip address 172.17.1.1 255.255.0.0

R1(config-if)#clockrate 6400

R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down

R1(config-if)#exit

 

For router R2

Router>enable

Router#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#hostname R2

R2(config)#interface FastEthernet0/0

R2(config-if)#ip address 172.18.1.1 255.255.0.0

R2(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R2(config-if)#exit

 

R2(config)#interface Serial0/0/0

R2(config-if)#ip address 172.17.1.2 255.255.0.0

R2(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up

R2(config-if)#exit

 

Part 2: – Configure OSPF routing on routers using given below command

For router R1

R1(config)#router ospf 1

 

R1(config-router)#network 172.16.1.0 0.0.255.255 area 0

R1(config-router)#network 172.17.1.0 0.0.255.255 area 0

R1(config-router)#exit

 

For router R2

R2(config)#router ospf 1

R2(config-router)#network 172.17.1.0 0.0.255.255 area 0

01:32:53: %OSPF-5-ADJCHG: Process 1, Nbr 172.17.1.1 on Serial0/0/0 from LOADING to FULL, Loading Done

R2(config-router)#network 172.18.1.0 0.0.255.255 area 0

R2(config-router)#exit

 

Part 3: – Now use ping command on the PCs to check whether they are communicating with each other or not

PC>ping 172.16.1.2

Pinging 172.16.1.2 with 32 bytes of data:

Reply from 172.16.1.2: bytes=32 time=8ms TTL=126

Reply from 172.16.1.2: bytes=32 time=3ms TTL=126

Reply from 172.16.1.2: bytes=32 time=1ms TTL=126

Reply from 172.16.1.2: bytes=32 time=2ms TTL=126

Ping statistics for 172.16.1.2:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 1ms, Maximum = 8ms, Average = 3ms

 

Now to saw basic routing configuration on your router use given below command in privileged mode on the router.

For router R1

R1>enable

R1#show ip protocols

Routing Protocol is “ospf 1”

Outgoing update filter list for all interfaces is not set

Incoming update filter list for all interfaces is not set

Router ID 172.17.1.1

Number of areas in this router is 1. 1 normal 0 stub 0 nssa

Maximum path: 4

Routing for Networks:

172.16.0.0 0.0.255.255 area 0

172.17.0.0 0.0.255.255 area 0

Routing Information Sources:

Gateway Distance Last Update

172.17.1.1 110 00:10:58

172.18.1.1 110 00:10:45

Distance: (default is 110)

 

For router R2

R2>enable

R2#show ip protocols

Routing Protocol is “ospf 1”

Outgoing update filter list for all interfaces is not set

Incoming update filter list for all interfaces is not set

Router ID 172.18.1.1

Number of areas in this router is 1. 1 normal 0 stub 0 nssa

Maximum path: 4

Routing for Networks:

172.17.0.0 0.0.255.255 area 0

172.18.0.0 0.0.255.255 area 0

Routing Information Sources:

Gateway Distance Last Update

172.17.1.1 110 00:12:14

172.18.1.1 110 00:12:00

Distance: (default is 110)

This is the whole process by which we can easily understand OSPF routing protocol. If you have any queries regarding this then feel free to ask through the comment section and also provide feedback to us. Because your feedback is valuable for us.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s