How to Configure OSPF on Cisco Router in GNS3? – OSPF (Open Shortest Path First) routing protocol is the Dynamic Routing protocol. OSPF uses the Dijkstra algorithm to recalculate routing roots on any network change.
How to Configure OSPF on Cisco Router in GNS3?

How to Configure OSPF on Cisco Router in GNS3?

How to Configure OSPF on Cisco Router in GNS3?

The OSPF routing protocol provides additional security on the network using Autonomous System (AS) numbers. Routers configured with the same AS number can communicate with each other. In addition, for example, Routers in the AS 1 field can communicate with Routers in the AS 2 field.

Each router in the AS has the entire network topology information. So the OSPF protocol can easily determine the best path to the target.

The biggest difference between OSPF and EIGRP protocol is that EIGRP is a routing protocol specific to Cisco devices only.

In the previous article, we have explained in detail the OSPF protocol. In this article, we will communicate two different networks by enabling the OSPF routing protocol on Cisco Routers in the GNS3 network simulator program.

Our Recommendation

You can purchase “Anatomy of OSPF” from Amazon.

How to Configure OSPF Between Two Routers in GNS3?

Before configuring OSPF on Cisco Router in GNS3, check out how to configure cloud in GNS3. Afterward, we will use VMware Workstation virtual machines for OSPF configuration.

   Step 1

First, run GNS3 program and create a new project.

How to Configure OSPF on Cisco Router in GNS3?

   Step 2

Create a network topology as shown in the following image for GNS3 OSPF configuration. By adding clarifications to the workspace, you can provide a more organized view.

How to Configure OSPF on Cisco Router in GNS3?

   Step 3

In the VMware Workstation virtualization program, create two virtual machines. Perform the VMnet settings of the virtual machine. Select VMnet1 as the Windows 8.1 virtual machine network card setting as follows and continue.

How to Configure OSPF on Cisco Router in GNS3?

   Step 4

Likewise, select VMnet2 as the Windows 10 virtual machine network card setting.

How to Configure OSPF on Cisco Router in GNS3?

   Step 5

Check the VMnet settings in the VMware Workstation Virtual Network Editor program.

How to Configure OSPF on Cisco Router in GNS3?

   Step 6

Afterward, run the VMware virtual machines and make TCP/IP settings based on the network addresses specified in the network topology.

How to Configure OSPF on Cisco Router in GNS3?

   Step 7

Windows 10 virtual machine TCP/IP settings are as follows.

How to Configure OSPF on Cisco Router in GNS3?

   Step 8

In the process to configure OSPF on Cisco Router in GNS3, first, configure the Cisco Router R1 interfaces.

[code] R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#
R1(config)#interface fastethernet 0/0
R1(config-if)#ip address 192.168.5.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
*Mar 1 00:10:50.427: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:10:51.427: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config)#
R1(config)#interface serial 0/0
R1(config-if)#ip address 10.1.1.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#end
R1#
[/code]

You can check the interface status by running show ip interface brief on Cisco Router R1.

[code] R1#show ip int br
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.5.1 YES manual up up
Serial0/0 10.1.1.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/1 unassigned YES unset administratively down down
R1#
[/code]

How to Configure OSPF on Cisco Router in GNS3?

   Step 9

You also configure the Cisco Router R2 interfaces.

[code] R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#
R2(config)#interface fastethernet 0/1
R2(config-if)#ip address 192.168.10.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#
*Mar 1 00:12:31.055: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar 1 00:12:32.055: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config)#
R2(config)#interface serial 0/1
R2(config-if)#ip address 10.1.1.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#end
R2#
[/code]

Also, configure the Cisco Router R2 interfaces.

[code] R2#show ip int br
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial0/0 unassigned YES unset administratively down down
FastEthernet0/1 192.168.10.1 YES manual up up
Serial0/1 10.1.1.2 YES manual up up
R2#
[/code]

How to Configure OSPF on Cisco Router in GNS3?

   Step 10

Before configuring OSPF on Cisco Router in GNS3, test the connection by pinging Router R1 and R2’s FastEthernet and Serial interfaces from the Windows 8.1 virtual machine.

How to Configure OSPF on Cisco Router in GNS3?

   Step 11

Do the same from the Windows 10 virtual machine. Pinging the opposite network will fail as follows.

How to Configure OSPF on Cisco Router in GNS3?

   Step 12

We can move on to configure OSPF in GNS3. Open the Cisco Router R1 CLI command prompt and run the following commands, respectively.

[code] R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#
R1(config)#router ospf 10
R1(config-router)#network 192.168.5.0 ?
A.B.C.D OSPF wild card bits

R1(config-router)#network 192.168.5.0 0.0.0.255 ?
area Set the OSPF area ID

R1(config-router)#network 192.168.5.0 0.0.0.255 area ?
<0-4294967295> OSPF area ID as a decimal value
A.B.C.D OSPF area ID in IP address format

R1(config-router)#network 192.168.5.0 0.0.0.255 area 0
R1(config-router)#network 10.1.1.0 0.0.0.3 area 0
R1(config-router)#end
R1#
[/code]

How to Configure OSPF on Cisco Router in GNS3?

   Step 13

To enable OSPF on the Cisco Router, perform the following commands.

[code] R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#
R2(config)#router ospf 10
R2(config-router)#network 192.168.10.0 0.0.0.255 area 0
R2(config-router)#network 10.1.1.0 0.0.0.3 area 0
R2(config-router)#
*Mar 1 00:18:09.227: %OSPF-5-ADJCHG: Process 10, Nbr 192.168.5.1 on Serial0/1 from LOADING to FULL, Loading Done
R2(config-router)#end
R2#
[/code]

How to Configure OSPF on Cisco Router in GNS3?

   Step 14

After OSPF configuration on Cisco routers, perform the show ip route command on Routers R1 and R2 and review the route entries.

Cisco Router R1 routing table;

[code] R1#show ip route
Codes: 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

Gateway of last resort is not set

O 192.168.10.0/24 [110/74] via 10.1.1.2, 00:01:02, Serial0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial0/0
R1#
[/code]

Cisco Router R2 routing table;

[code] R2#show ip route
Codes: 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

Gateway of last resort is not set

C 192.168.10.0/24 is directly connected, FastEthernet0/1
O 192.168.5.0/24 [110/74] via 10.1.1.1, 00:01:02, Serial0/1
10.0.0.0/30 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial0/1
R2#
[/code]

How to Configure OSPF on Cisco Router in GNS3?

   Step 15

We have completed the steps to configure OSPF on Cisco Router in GNS3. Now test the connection between VMware Virtual Machines.

Pinging from a Windows 8.1 virtual machine to a Windows 10 virtual machine will succeed as follows.

How to Configure OSPF on Cisco Router in GNS3?

   Step 16

Pinging from Windows 10 virtual machine to Windows 8.1 virtual machine will succeed as follows.

How to Configure OSPF on Cisco Router in GNS3?

   Step 17

Once we have completed the OSPF configuration process and tested the connection between the virtual machines, we will look at the OSPF show commands on the Routers.

The Cisco Router R1 show commands are as follows.

[code] R1#show ip ospf ?
<1-65535> Process ID number
border-routers Border and Boundary Router Information
database Database summary
flood-list Link state flood list
interface Interface information
max-metric Max-metric origination information
mpls MPLS related information
neighbor Neighbor list
request-list Link state request list
retransmission-list Link state retransmission list
sham-links Sham link information
statistics Various OSPF Statistics
summary-address Summary-address redistribution Information
timers OSPF timers information
traffic Traffic related statistics
virtual-links Virtual link information
| Output modifiers
<cr>
[/code]

For example, you can view the show ip ospf neighbor and show ip ospf database show commands.

How to Configure OSPF on Cisco Router in GNS3?

   Step 18

You can also check the show command output on Cisco Router R2.

How to Configure OSPF on Cisco Router in GNS3?

   Step 19

You can use the debug ip ospf hello command to verify the OSPF routing protocol on Cisco routers. You can examine the Cisco Router R1 debug ip ospf hello command output from the following display.

[code] R1#debug ip ospf ?
adj OSPF adjacency events
database-timer OSPF database timer
events OSPF events
flood OSPF flooding
hello OSPF hello events
lsa-generation OSPF lsa generation
mpls OSPF MPLS
nsf OSPF non-stop forwarding events
packet OSPF packets
retransmission OSPF retransmission events
spf OSPF spf
tree OSPF database tree
[/code]

The OSPF routing protocol sends hello packets to Multiprotocol (224.0.0.5).

How to Configure OSPF on Cisco Router in GNS3?

   Step 20

Also, apply the debug ip ospf hello command on Cisco Router R2. You can see the hello packages from the following display.

How to Configure OSPF on Cisco Router in GNS3?

   Step 21

Another way to verify OSPF configuration in GNS3 is to use Wireshark. On the serial cable between Cisco Routers, click the Right Button / Start Capture option.

How to Configure OSPF on Cisco Router in GNS3?

   Step 22

In the Packet Capture window, click OK to continue.

How to Configure OSPF on Cisco Router in GNS3?

   Step 23

The Wireshark program opened in GNS3 and you can see that Hello packages is being sent via Multicast (224.0.0.5) address as shown in the following image.

How to Configure OSPF on Cisco Router in GNS3?

Show Commands Related to How to Configure OSPF on Cisco Router in GNS3

Cisco Router R1 Show Commands

R1#show ip ospf neighborR1#debug ip ospf helloR1#show running-config
R1#show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
192.168.10.1 0 FULL/ – 00:00:32 10.1.1.2 Serial0/0
R1#
R1#show ip ospf database

OSPF Router with ID (192.168.5.1) (Process ID 10)

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
192.168.5.1 192.168.5.1 382 0x80000003 0x00832D 3
192.168.10.1 192.168.10.1 383 0x80000002 0x00B1F4 3
R1#

R1#debug ip ospf hello
OSPF hello events debugging is on
R1#
*Mar 1 00:26:47.011: OSPF: Send hello to 224.0.0.5 area 0 on Serial0/0 from 10.1.1.1
R1#
*Mar 1 00:26:48.939: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.5.1
*Mar 1 00:26:49.267: OSPF: Rcv hello from 192.168.10.1 area 0 from Serial0/0 10.1.1.2
*Mar 1 00:26:49.267: OSPF: End of hello processing
R1#
*Mar 1 00:26:56.151: OSPF: Rcv hello from 192.168.10.1 area 0 from Serial0/0 10.1.1.2
*Mar 1 00:26:56.151: OSPF: End of hello processing
*Mar 1 00:26:57.011: OSPF: Send hello to 224.0.0.5 area 0 on Serial0/0 from 10.1.1.1
R1#
*Mar 1 00:26:58.939: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.5.1
R1#
R1#show running-config
Building configuration…

Current configuration : 1152 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip cef
!
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
ip tcp synwait-time 5
!
!
!
interface FastEthernet0/0
ip address 192.168.5.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 10.1.1.1 255.255.255.252
clock rate 2000000
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
interface Serial0/1
no ip address
shutdown
clock rate 2000000
!
router ospf 10
log-adjacency-changes
network 10.1.1.0 0.0.0.3 area 0
network 192.168.5.0 0.0.0.255 area 0
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
no cdp log mismatch duplex
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
line vty 0 4
login
!
!
end
R1#

Cisco Router R2 Show Commands

R2#show ip ospf ?R2#show ip ospf neighborR2#debug ip ospf ?R2#debug ip ospf helloR2#show running-config
R2#show ip ospf ?
Process ID number
border-routers Border and Boundary Router Information
database Database summary
flood-list Link state flood list
interface Interface information
max-metric Max-metric origination information
mpls MPLS related information
neighbor Neighbor list
request-list Link state request list
retransmission-list Link state retransmission list
sham-links Sham link information
statistics Various OSPF Statistics
summary-address Summary-address redistribution Information
timers OSPF timers information
traffic Traffic related statistics
virtual-links Virtual link information
| Output modifiers

R2#

R2#show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
192.168.5.1 0 FULL/ – 00:00:32 10.1.1.1 Serial0/1
R2#
R2#show ip ospf database

OSPF Router with ID (192.168.10.1) (Process ID 10)

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
192.168.5.1 192.168.5.1 419 0x80000003 0x00832D 3
192.168.10.1 192.168.10.1 418 0x80000002 0x00B1F4 3
R2#

R2#debug ip ospf ?
adj OSPF adjacency events
database-timer OSPF database timer
events OSPF events
flood OSPF flooding
hello OSPF hello events
lsa-generation OSPF lsa generation
mpls OSPF MPLS
nsf OSPF non-stop forwarding events
packet OSPF packets
retransmission OSPF retransmission events
spf OSPF spf
tree OSPF database tree
R2#
R2#debug ip ospf hello
OSPF hello events debugging is on
R2#
*Mar 1 00:27:32.383: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/1 from 192.168.10.1
R2#
*Mar 1 00:27:36.975: OSPF: Rcv hello from 192.168.5.1 area 0 from Serial0/1 10.1.1.1
*Mar 1 00:27:36.975: OSPF: End of hello processing
R2#
*Mar 1 00:27:39.223: OSPF: Send hello to 224.0.0.5 area 0 on Serial0/1 from 10.1.1.2
R2#
*Mar 1 00:27:42.383: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/1 from 192.168.10.1
R2#
R2#show running-config
Building configuration…

Current configuration : 1154 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip cef
!
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
ip tcp synwait-time 5
!
!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface Serial0/0
no ip address
shutdown
clock rate 2000000
!
interface FastEthernet0/1
ip address 192.168.10.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/1
ip address 10.1.1.2 255.255.255.252
clock rate 2000000
!
router ospf 10
log-adjacency-changes
network 10.1.1.0 0.0.0.3 area 0
network 192.168.10.0 0.0.0.255 area 0
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
no cdp log mismatch duplex
!
!
!
control-plane
!
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
line vty 0 4
login
!
!
end
R2#

How to Configure OSPF on Cisco Router in GNS3? ⇒ Video

You can watch how to configure OSPF on Cisco Router in GNS3 and you can also subscribe to our YouTube channel…

  Final Word

How to Configure OSPF on Cisco Router in GNS3? – In this article, we have configured the OSPF Dynamic Routing protocol configuration in the GNS3 network simulator program. We basically have dealt with the OSPF routing protocol. We will also refer to more advanced topologies.

If this article is helpful, send me feedback by commenting! Thanks in advance, take care of yourself!

Also, you can add to browser bookmarks by pressing the CTRL+D to read this article later!

Articles Related to How to Configure OSPF on Cisco Router in GNS3

Products Related to How to Configure OSPF on Cisco Router in GNS3
Related Products

File Related to How to Configure OSPF on Cisco Router in GNS3
Related File

You can download the GNS3 OSPF project configured in this article from the button below to your computer…

 

Leave a Reply

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

13 − 11 =