Friday, 30 May 2025

What is OSPFv2 (Open Shortest Path First version 2) subcommand?

 OSPFv2 (Open Shortest Path First version 2 is a link-state routing protocol designed for IPv4 networks. It is defined in RFC 2328 and is widely used in enterprise and service provider networks due to its efficiency and scalability.





Key Features of OSPFv2:

1. Link-State Protocol:

  • Maintains a complete topological map of the network (LSDB - Link-State Database).
  • Uses the Dijkstra (SPF) algorithm to compute the shortest path to all destinations.

2. Hierarchical Routing (Areas):

  • Divides networks into areas to reduce routing overhead.
  • Backbone Area (Area 0) is mandatory; all other areas must connect to it.

Types of areas:

  • Normal Areas (Standard areas)
  • Stub Areas (Block external routes)
  • Totally Stubby Areas (Block external and inter-area routes)
  • Not-So-Stubby Areas (NSSA) (Allows limited external routes)

Metric (Cost):

  • Calculated based on interface bandwidth (Cost = Reference BW / Interface BW, default Reference BW = 100 Mbps).

Packet Types:

  • Hello (Discover/maintain neighbors)
  • DBD (Database Description) (Exchange LSDB info)
  • LSR (Link-State Request) (Request specific LSA)
  • LSU (Link-State Update) (Send LSA updates)
  • LSAck (Link-State Acknowledgment) (Acknowledge LSUs)

LSA Types (Link-State Advertisements):

  • Type 1 (Router LSA) – Intra-area router info.
  • Type 2 (Network LSA) – Multi-access network info.
  • Type 3 (Summary LSA) – Inter-area routes (ABR-generated).
  • Type 4 (ASBR Summary LSA) – Location of ASBR.
  • Type 5 (External LSA) – Routes from other AS (redistributed).
  • Type 7 (NSSA External LSA) – External routes in NSSA.

Neighbor States:

  • Down → Init → 2-Way → ExStart → Exchange → Loading → Full

Authentication:

Supports plain-text, MD5, and SHA authentication for security.


Let's see the configuration of the OSPFv2 subcommand.


Topology:-



  • Configure the topology as per the diagram
  • Configure the IP addresses as per the topology 
  • Configure OSPFv2 with the subcommand 
  • advertise directly connected routes and loopbacks
  • Make sure all the routes are exchanged 
  • Verify with ping and show commands



router-1(config)#interface serial 5/0
router-1(config-if)#ip address 12.1.1.1 255.0.0.0
router-1(config-if)#no shutdown
router-1(config-if)#exit

router-1(config)#interface fastethernet 0/0
router-1(config-if)#ip address 13.1.1.1 255.0.0.0
router-1(config-if)#no shutdown
router-1(config-if)#exit

router-1(config)#interface gig 3/0
router-1(config-if)#ip address 14.1.1.1 255.0.0.0
router-1(config-if)#no shutdown
router-1(config-if)#exit


R2(config)#interface serial 5/0
R2(config-if)#ip address 12.1.1.2 255.0.0.0
R2(config-if)#no shutdown
R2(config-if)#exit

R2(config)#interface loopback 1
R2(config-if)#ip address 192.168.20.1 255.255.255.0
R2(config-if)#exit



R3(config)#interface fastethernet 0/0
R3(config-if)#ip address 13.1.1.2 255.0.0.0
R3(config-if)#no shutdown
R3(config-if)#exit

R3(config)#interface loopback 1
R3(config-if)#ip address 192.168.30.1 255.255.255.0
R3(config-if)#exit


router-1(config)#interface serial 5/0
router-1(config-if)#ip ospf 10 area 0
router-1(config-if)#exit
router-1(config)#interface fastethernet 0/0
router-1(config-if)#ip ospf 10 area 0
router-1(config-if)#exit
router-1(config)#interface gig 3/0
router-1(config-if)#ip ospf 10 area 0
router-1(config-if)#exit

*May 30 16:23:05.531: %OSPF-5-ADJCHG: Process 10, Nbr 192.168.20.1 on Serial5/0 from LOADING to FULL, Loading Done

*May 30 16:24:03.999: %OSPF-5-ADJCHG: Process 10, Nbr 192.168.30.1 on FastEthernet0/0 from LOADING to FULL, Loading Done

*May 30 16:25:00.667: %OSPF-5-ADJCHG: Process 10, Nbr 192.168.40.1 on GigabitEthernet3/0 from LOADING to FULL, Loading Done




R2(config)#interface serial 5/0
R2(config-if)#ip ospf 10 area 0
R2(config-if)#exit

*May 30 16:23:05.015: %OSPF-5-ADJCHG: Process 10, Nbr 14.1.1.1 on Serial5/0 from LOADING to FULL, Loading Done

R2(config)#interface loopback 1
R2(config-if)#ip ospf 10 area 1
R2(config-if)#exit



R3(config)#interface fastethernet 0/0
R3(config-if)#ip ospf 10 area 0
R3(config-if)#exit

*May 30 16:24:03.255: %OSPF-5-ADJCHG: Process 10, Nbr 14.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done

R3(config)#interface loopback 1
R3(config-if)#ip ospf 10 area 2
R3(config-if)#exit



R4(config)#interface gig 3/0
R4(config-if)#ip ospf 10 area 0
R4(config-if)#exit

*May 30 16:25:00.579: %OSPF-5-ADJCHG: Process 10, Nbr 14.1.1.1 on GigabitEthernet3/0 from LOADING to FULL, Loading Done

R4(config)#interface loopback 1
R4(config-if)#ip ospf 10 area 3
R4(config-if)#exit


router-1#show ip protocols
Routing Protocol is "ospf 10"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 14.1.1.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
  Routing on Interfaces Configured Explicitly (Area 0):
    GigabitEthernet3/0
    FastEthernet0/0
    Serial5/0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.40.1         110      00:06:36
    192.168.30.1         110      00:06:39
    192.168.20.1         110      00:06:39
  Distance: (default is 110)



router-1#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

     192.168.30.0/32 is subnetted, 1 subnets
O IA    192.168.30.1 [110/2] via 13.1.1.2, 00:07:05, FastEthernet0/0
     192.168.40.0/32 is subnetted, 1 subnets
O IA    192.168.40.1 [110/2] via 14.1.1.2, 00:07:02, GigabitEthernet3/0
     192.168.20.0/32 is subnetted, 1 subnets
O IA    192.168.20.1 [110/65] via 12.1.1.2, 00:07:05, Serial5/0
C    12.0.0.0/8 is directly connected, Serial5/0
C    13.0.0.0/8 is directly connected, FastEthernet0/0
C    14.0.0.0/8 is directly connected, GigabitEthernet3/0


router-1#show ip ospf interface gigabitEthernet 3/0
GigabitEthernet3/0 is up, line protocol is up
  Internet Address 14.1.1.1/8, Area 0
  Process ID 10, Router ID 14.1.1.1, Network Type BROADCAST, Cost: 1
  Enabled by interface config, including secondary ip addresses
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 14.1.1.1, Interface address 14.1.1.1
  Backup Designated router (ID) 192.168.40.1, Interface address 14.1.1.2
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:03
  Supports Link-local Signaling (LLS)
  Index 3/3, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 1
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 192.168.40.1  (Backup Designated Router)
  Suppress hello for 0 neighbor(s)
router-1#ping 192.168.20.1

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

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

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.40.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/40/48 ms

router-1#show ip ospf database

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
14.1.1.1        14.1.1.1        1097        0x80000006 0x002C55 4
192.168.20.1    192.168.20.1    1192        0x80000002 0x002C4C 2
192.168.30.1    192.168.30.1    1130        0x80000003 0x003AC3 1
192.168.40.1    192.168.40.1    1075        0x80000003 0x009750 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
13.1.1.1        14.1.1.1        1153        0x80000001 0x0084FA
14.1.1.1        14.1.1.1        1097        0x80000001 0x00F97A

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.20.1    192.168.20.1    1187        0x80000001 0x005CE2
192.168.30.1    192.168.30.1    1126        0x80000001 0x00A783
192.168.40.1    192.168.40.1    1071        0x80000001 0x00F224

No comments:

What is OSPFv2 (Open Shortest Path First version 2) subcommand?

  OSPFv2 (Open Shortest Path First version 2  is a link-state routing protocol designed for IPv4 networks. It is defined in RFC 2328 and is ...