Network Kings

LIMITED TIME OFFER

$999 $499 only For All Access Pass Today! USE PROMO CODE : LIMITED

d :
h :
m

Single Area OSPF Lab

Single Area OSPF Lab Open Shortest Path First

In this lesson we will perform a single area OSPF lab.

Before starting lab, first we discuss a quick review of OSPF. It is a dynamic routing protocol and used inside a LAN network (single autonomous system) that’s why it is also called IGP (interior gateway protocol). In IGP, we have RIP, EIGRP and OSPF, but mostly OSPF is used. Reason, RIP protocol algorithm is not good, it uses hop count to select best path irrespective of bandwidth. Now come to the EIGRP, before 2013 EIGRP was Cisco proprietary, now it is open to all, but still some features are only for Cisco devices not for other vendor devices. Cisco products are expensive, all  organisation can’t afford. But in case of OSPF nothing is like that, it is open to all from starting and supports all vendor devices.

What is wildcard mask?

Before perform this lab, you have to understand what is wildcard mask and how it is calculated? This is very simple concept, wildcard mask is inverted form of subnet mask (1 is replace by 0 and 0 is replaced by 1).

For class A subnet mask is 255.0.0.0 and wild card mask is 0.0.0.255.
For class B subnet is 255.255.0.0 and wild card mask is 0.0.255.255.
For class C subnet is 255.255.255.0 and wild card mask is 0.0.0.255.

Steps to calculate wildcard mask:

  1. convert decimal form of subnet mask into binary form.
    for example : 255.0.0.0 (decimal Form)
    Binary form: 11111111.00000000.00000000.00000000
  2. Now, perform inversion (1 is replace by 0 and 0 is replaced by 1)
    00000000.11111111.11111111.11111111.
  3. Convert binary to decimal
    0.255.255.255—– wildcard mask.

This is the traditional approach to calculate wildcard mask. Many people don’t like decimal-binary conversion and all these things, so don’t worry here is one another shortcut method that my trainer Atul Sharma taught me.

For example we have a subnet mask 255.255.255.0

Now subtract each octet from 255. And in result, you will get wildcard mask.

255-255, = 0 and 255-0 = 255.

So, 0.0.0.255.

Here, I am taking one more example, we have subnet mask 255.255.255.128

Now, subtract each octet from 255. First 3 octets are 255, so after subtracting from 255 result is 0,similar way after subtracting 128 from 255, you will get 127.

And result is 0.0.0.127(wildcard mask).

How to configure OSPF protocol?

There are 2 ways to configure ospf protocol.

Ist method

router ospf

network area

Second method

router ospf

interface

ip ospf area

          ### OSPF Single Area Lab ###

To perform this lab, I used Cisco packet tracer (free software), 4 routers (each router has 2 loopback interface to check connectivity), bold dotted line showing physical connection between routers and light black lines are representing loopback interfaces.

This is a single area ospf lab. This is area 0 (backbone area), area 0 is must in ospf. So, keep in mind when you perform this lab, area should be area 0 only.

OSPF Single Area Lab

 

OSPF single area (area 0)

Configurations: I know this configuration is lengthy but trust me this is very simple, first configure router interfaces and loopback interfaces and then configure ospf. Same steps are repeated in all routers, only some values are changed.

To configure router interface, use below commands.

interface

ip address

no shutdown

To configure loopback interface, use below commands.

interface loopback

ip address

To configure OSPF:

router ospf

network area

## R1 configuration ##

enable
configure terminal
hostname R1
interface fa0/0
ip address 192.168.40.1 255.255.255.0
no shutdown
interface fa0/1
ip address 192.168.10.1 255.255.255.0
no shutdown
interface loopback 0
ip address 192.168.1.1 255.255.255.0
interface loopback 1
ip address 192.168.2.1 255.255.255.0
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 0
network 192.168.10.0 0.0.0.255 area 0
network 192.168.40.0 0.0.0.255 area 0

## R2 Configuration ##

enable
configure terminal
hostname R2
interface fa0/1
ip address 192.168.20.1 255.255.255.0
no shutdown
interface fa0/0
ip address 192.168.10.2 255.255.255.0
no shutdown
interface loopback 0
ip address 192.168.7.1 255.255.255.0
interface loopback 1
ip address 192.168.8.1 255.255.255.0
router ospf 1
network 192.168.8.0 0.0.0.255 area 0
network 192.168.7.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0
network 192.168.10.0 0.0.0.255 area 0

## R3 Configuration ##

enable
configure terminal
hostname R3
interface fa0/1
ip address 192.168.30.1 255.255.255.0
no shutdown
interface fa0/0
ip address 192.168. 40.2 255.255.255.0
no shutdown
int loopback 0
ip address 192.168.3.1 255.255.255.0
int loopback 1
ip address 192.168.4.1 255.255.255.0
router ospf 1
network 192.168.30.0 0.0.0.255 area 0
network 192.168.40.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 0
network 192.168.4.0 0.0.0.255 area 0

## R4 Configuration ##

enable
configure terminal
hostname R4
interface fa0/1
ip address 192.168.30.2 255.255.255.0
no shutdown
interface fa0/0
ip address 192.168.20.2 255.255.255.0
no shutdown
interface loopback 0
ip address 192.168.6.1 255.255.255.0
interface loopback 1
ip address 192.168.5.1 255.255.255.0
router ospf 1
network 192.168.6.0 0.0.0.255 area 0
network 192.168.5.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0
network 192.168.30.0 0.0.0.255 area 0

Result: After performing all the configurations, to verify connectivity, use ping command. Below, I put a screenshot of my lab result. You can see from router R4, I ping 192.168.1.1 and 192.168.2.1 loopback interfaces.

OSPF Single Area Lab

 

Lab Successful!- got ping reply

Show ip route and show ip interface brief commands are very helpful in troubleshooting. Both will run in enable mode. In below routing table O in front of route is showing this path is learned by OSPF protocol.

Output of show ip route command

OSPF Single Area Lab

Output of show ip interface brief command

OSPF Single Area Lab