Routing Protocols
Interior Gateway Protocols (IGP)
Exterior Gateway Protocol
(EGP)
Distance Vector
Ripv1
Ripv2
Link State
OSPF
IS-IS
EIGRP
Hybrid
IGRP
Path Vector
BGP
OSPF Packets Types
States Of OSPF
Internal Router
A router with that has OSPF neighbor relationships only with devices in the same area.
Area Border Router (ABR)
A router that has OSPF neighbor relationships with devices in multiple OSPF areas. ABRs gather topology information from their connected areas and distribute it to the backbone area.
Backbone Router
A backbone router is a router that runs OSPF and has at least one interface connected to the OSPF backbone area. Since ABRs are always connected to the backbone, they are always classified as backbone routers.
Autonomous System Boundary Router (ASBR)
An ASBR is a router that attaches to more than one routing protocol and exchanges routing information between them
OSPF Router Type
calculated by the shortest path first algorithm in the database table.
OSPF maintains three tables
OSPF Advantages & Disadvantages
DR/BDR Selection
• First Router to Initialize
• Router with Highest Priority ID
• Router with Highest Router ID
• Set the Highest Router ID
• Highest Loopback Interface IP Address
• Highest Interface IP Address
DR + BDR
Figure 1 – The Network topology of our routing domain
Here are the links to download the initial configurations applied to the routers:
hostname R1
interface GigabitEthernet0/0
ip address 10.0.0.1 255.255.255.0
no shutdown
interface GigabitEthernet0/4
ip address 10.0.14.1 255.255.255.0
no shutdown
router ospf 1
router-id 1.1.1.1
network 10.0.14.1 0.0.0.0 area 0
network 10.0.0.1 0.0.0.0 area 0
hostname R2
interface GigabitEthernet0/0
ip address 10.0.0.2 255.255.255.0
no shutdown
interface GigabitEthernet0/3
ip address 10.0.23.2 255.255.255.0
no shutdown
router ospf 1
router-id 2.2.2.2
network 10.0.23.2 0.0.0.0 area 0
network 10.0.0.2 0.0.0.0 area 0
hostname R3
interface GigabitEthernet0/0
ip address 10.0.0.3 255.255.255.0
no shutdown
interface GigabitEthernet0/2
ip address 10.0.23.3 255.255.255.0
no shutdown
router ospf 1
router-id 3.3.3.3
network 10.0.23.3 0.0.0.0 area 0
network 10.0.0.3 0.0.0.0 area 0
hostname R4
interface GigabitEthernet0/0
ip address 10.0.0.4 255.255.255.0
no shutdown
interface GigabitEthernet0/1
ip address 10.0.14.4 255.255.255.0
no shutdown
router ospf 1
router-id 4.4.4.4
network 10.0.14.4 0.0.0.0 area 0
network 10.0.0.4 0.0.0.0 area 0
OSPF DR/BDR Election Process
Besides, the DR is responsible to generate the network LSA of the broadcast/NBMA data link.
Likewise, the Backup Designated Router decides to form full neighbor relationships with all OSPF neighbors using the DR’s procedure. Also, the BDR takes over as the DR if the current DR goes down.
Finally, note that OSPF neighbor relationships between DROther routers get stuck at the 2-WAY neighbor state.
In a broadcast/non-broadcast data link consisting of N routers, we would have N-2 DROthers, and each DROther forms 2 OSPF adjacencies one with the DR and another with the BDR.
When to Disable OSPF DR/BDR Election?
The OSPF DR/BDR election process can sometimes be useless. For example, when the multi-access network does not include more than two OSPF routers. In this case, one router gets selected DR, while the other gets chosen as the BDR, and thus selecting a DR and BDR won’t have any benefit.
In the network diagram (Figure 1), there is no need to elect a DR and a BDR in subnets 10.0.14.0/24 and 10.0.23.0/24, while a DR/BDR election must occur in subnet 10.0.0.0/24.
To disable this behavior, change the OSPF network type of the interfaces connecting the routers to the subnets in question to point-to-point, point-to-multipoint, or point-to-multipoint non-broadcast, as shown in these examples.
OSPF DR/BDR Election Tuning
The Hello protocol relies on interface priority and router ID to select the DR and BDR among eligible OSPF nodes (nodes with OSPF priority greater than zero). To influence the network to choose a particular router as the DR, we can configure its priority to be the highest among all DR-eligible routers, or increase its router ID if many routers share the highest priority value in the current network segment.
Using The ip ospf priority Command
In Figure 1, router R4 is the DR and R3 is the BDR. Using the ip ospf priority command, we set R1’s G0/0 interface’s OSPF priority to 200 so that R1 has the highest priority in subnet 10.0.0.0/24.
Some Features of OSPF Routing Protocol
OSPF Lab
Router R1
hostname R1
no ip domain lookup
banner motd # This is R1, Implement Multi-Area OSPFv2 Lab#
interface gi0/0
ip add 172.16.0.2 255.255.255.252
no shut
Ip ospf 1 area 0
exit
interface GigabitEthernet0/1
ip address 192.10.0.1 255.255.255.252
no shut
Ip ospf 1 area 1
exit
Router R3
hostname R3
no ip domain lookup
banner motd # This is R3, Implement Multi-Area OSPFv2 Lab #
interface gi0/0
ip add 172.16.1.2 255.255.255.252
no shut
Ip ospf 1 area 0
exit
interface Gi0/1
ip address 192.10.4.1 255.255.255.252
no shut
Ip ospf 1 area 2
exit
hostname R2
no ip domain lookup
banner motd # This is R2, Implement Multi-Area OSPFv2 Lab #
interface gi0/0
ip add 172.16.0.1 255.255.255.252
no shut
exit
interface Gi0/1
ip address 172.16.1.1 255.255.255.252
no shut
exit
interface lo0
ip add 209.165.200.225 255.255.255.224
int gi0/2
ip address dhcp
no shutdown
…NAT_Configuration…
access-list 1 permit 192.10.1.0 0.0.0.255
access-list 1 permit 192.10.5.0 0.0.0.255
ip nat inside source list 1 interface gi0/2 overload
int gi0/2
ip nat outside
int gi0/0
ip nat inside
int gi0/1
ip nat inside
L3 Switch
------------
hostname D1
conf t
no ip domain lookup
banner motd # This is D1, Implement Multi-Area OSPFv2 Lab #
interface gi0/1
no switchport
ip address 192.10.0.2 255.255.255.252
no shut
Ip ospf 1 area 1
Exit
interface gi0/0
no switchport
ip address 192.10.1.1 255.255.255.0
no shut
exit
L3 Switch
------------
hostname D2
no ip domain looku
banner motd # This is D2, Implement Multi-Area OSPFv2 Lab #
interface gi0/0
no switchport
ip address 192.10.4.2 255.255.255.252
no shut
Ip ospf 1 area 2
exit
interface gi0/1
no switchport
ip address 192.10.5.1 255.255.255.0
no shut
exit
OSPF DR/BDR Election
�
Router RA
en
conf t
interface GigabitEthernet0/0
ip ospf hello-interval 5
ip ospf dead-interval 20
ip ospf priority 150
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 Area0pa55
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
area 0 authentication message-digest
End
Router RB
en
conf t
interface GigabitEthernet0/0
ip ospf hello-interval 5
ip ospf dead-interval 20
ip ospf priority 100
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 Area0pa55
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
area 0 authentication message-digest
end
Router RC ASBR
en
conf t
interface GigabitEthernet0/0
ip ospf hello-interval 5
ip ospf dead-interval 20
ip ospf priority 50
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 Area0pa55
router ospf 1
passive-interface default
no passive-interface GigabitEthernet0/0
network 192.168.1.0 0.0.0.255 area 0
default-information originate
area 0 authentication message-digest
ip route 0.0.0.0 0.0.0.0 Serial0/0/0 end
Understanding OSPF LSA types is necessary to master the OSPF routing protocol. In an OSPF routing domain, each node creates at least one type of LSA, which is the router LSA. A router may produce more LSAs depending on its functions (DR, BDR, ABR, or ASBR). The set of LSAs within an OSPF area constitutes the area’s link-state database, and it is consistent on all the area’s routers.
What is LSA in OSPF?
In an OSPF AS, a link statement advertisement (LSA) is a data format routers use to describe the links connected to them, OSPF adjacent neighbors, internal and external subnets, and ASBRs. Different OSPF LSA types are used by routers within an OSPF domain to build up the graph of the network for the sake of producing the SPF tree.
Each node in an OSPF autonomous system creates one or more LSAs based on its configuration and shares them with its adjacent neighbors. In addition, the router will also flood the latest version of any received LSA to its neighbors, except the sender and including the router that originated the LSA. This is if it is not the sender.
How Many OSPF LSA Types Do Exist?
There are 11 LSA types in OSPF, and each LSA type is handled differently, with the combined set of all received and sent LSAs establishing the router’s link state database (LSDB). Cisco, Juniper, and Huawei are implementing the following ten OSPF LSA types on their routers, whereas RFC 2328’s specification for OSPFv2 defines only five LSA types:
LSA Type 1 (Router LSA)
LSA Type 2 (Network LSA)
LSA Type 3 (Summary LSA)
LSA Type 4 (ASBR Summary LSA)
LSA Type 5 (Autonomous System LSA)
LSA Type 7 (NSSA external LSA)
LSA Type 8 (External-Attributes LSA)
LSA Type 9 (Link-local opaque LSA)
LSA Type 10 (Area-local opaque LSA)
LSA Type 11 (Autonomous System opaque LSA))
LSA – Link state advertisments.
OSPF LSA
The OSPF LSA contains a complete list of networks advertised from that router. OSPF uses six LSA types for IPv4 routing:
OSPF LSA
OSPF LSA
OSPF LSA
OSPF LSA
LSA TYPE 4 – ASBR SUMMARY LSA
LSA Type 4 (ASBR Summary LSA) packets are the LSAs that advertise the presence of an Autonomous System Border Router (ASBR) to other areas. LSA4 contains the ASBR Router-ID.
LSA type 7 –
OSPF NOT SO STUBBY AREA (NSSA) EXTERNAL LSA
1. OSPF Basics
2. OSPF Operation
3. Area Types:
OSPF Routing Protocol
OSPF Routers Types:
OSPF Packets
OSPF Neighbor Relationships
OSPF Routing Table
OSPF Routing Protocol
Commands:
It seems like you might be referring to an OSPF (Open Shortest Path First) routing table or a similar concept. In OSPF, the term “table” could refer to several different things, including the OSPF routing table the Link-State Database (LSDB), or even the OSPF topology table. Let me explain each one to give you a comprehensive overview:
1. OSPF Routing Table
The OSPF routing table contains the best routes for network destinations based on the OSPF routing protocol. It is used by the router to make forwarding decisions.
Components:
2. OSPF Link-State Database (LSDB)
The LSDB is a database that holds the network topology information. Each router in an OSPF network maintains an LSDB, which contains a list of all the link-state advertisements (LSAs) received from other OSPF routers.
Components:
OSPF Routing Protocol
OSPF Topology Table
The OSPF topology table is essentially the same as the LSDB. It represents the OSPF network topology as perceived by each router. It includes all routers and networks, as well as their states and relationships.
Viewing OSPF Tables
To view these tables on a router, you typically use specific commands depending on the router’s operating system:
Cisco IOS:
Juniper Junos:
Summary
These tables and databases are fundamental to how OSPF functions, allowing routers to make informed routing decisions based on the network’s topology and routing requirements. If you have more specific questions about OSPF or its tables, feel free to ask!
OSPF Features
OSPF Routing Protocol
1.Designated Router (DR)
Purpose: (LSA Floading)
Role:
Election:
The DR is elected based on the highest Router ID or, if Router IDs are equal, the highest interface IP address. The election process happens during the OSPF initialization phase when routers are in the Two-Way state.
2. Backup Designated Router (BDR)
Purpose
Role
OSPF Routing Protocol
Election:
DR/BDR Election Process
2. DR/BDR Election:
3. Role Assignment:
OSPF Network Types and DR/BDR Roles
Summary
OSPF Routing Protocol
OSPF messages
OSPF uses certain messages for the communication between the routers operating OSPF.
Hello message
Database Description (DBD)
Link state request (LSR)
Link state update (LSU)
Link state acknowledgement
Link state advertisement (LSA)
Note – Link State Advertisement and Link State Acknowledgement both are different messages.
Timers –
Hello timer –
Dead timer –
OSPF Routing Protocol
OSPF supports/provides/advantages
OSPF Routing Protocol
NBMA Network: Non-Broadcast Multiple Access (NBMA) networks are networks where broadcast is not supported. OSPF can be used in this type of network by using a hello message to discover and maintain connections with other routers in the network.
OSPF Configuration
OSPF Routing Protocol
Open Shortest Path First (OSPF) protocol States
Prerequisite – OSPF fundamentals
OSPF Terms
OSPF Routing Protocol
OSPF States
Note – The Downstate doesn’t mean that the interface is physically down. Here, it means that the OSPF adjacency process has not started yet.
Note – In between the 2WAY state and Exstart state, the DR and BDR election takes place.
Important – When a router receives DBD from other router, it compares its own DBD with the other router DBD. If the received DBD is more updated than its own DBD then the router will send LSR to the other router stating what links are needed. The other router replies with the LSU containing the updates that are needed. In return to this, the router replies with the Link State Acknowledgement.
OSPF Routing Protocol State
How OSPF Cost is Calculated?
interface fastEthernet 0/0
ip ospf cost 555
How to Configure OSPF Cost
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.15.5/24, Area 0
Process ID 1, Router ID 10.0.15.5, Network Type BROADCAST, Cost: 555
Enabled by interface config, including secondary ip addresses
If the ip ospf command is not applied to a particular interface, the cost gets calculated based on the OSPF reference bandwidth and the interface’s bandwidth. Therefore, you can change the cost of the interface by setting a new value for the bandwidth parameter using the bandwidth command.
The default OSPF cost of FastEthernet interfaces is 1. To change the cost to 10 using the bandwidth command, we have to set the interface’s bandwidth to 10Mbps. In this way, the resulting value of OSPF bandwidth/interface bandwidth equals 100Mbps/10Mbps=10.
In this example, we set the bandwidth of the F0/0 interface to 10 using the bandwidth 10000 statement. The command accepts one value in kbps.
Commnd
interface fastEthernet 0/0
bandwidth 10000
show ip ospf interface fastEthernet 0/0c
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.15.5/24, Area 0
Process ID 1, Router ID 10.0.15.5, Network Type BROADCAST, Cost: 10
Enabled by interface config, including secondary ip addresses
Auto-Cost Command
router ospf 1
auto-cost reference-bandwidth 100000
show ip ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.15.5/24, Area 0
Process ID 1, Router ID 10.0.15.5, Network Type BROADCAST, Cost: 1000
Enabled by interface config, including secondary ip addresses
How to Configure OSPF Cost
ip ospf network broadcast
ip ospf hello-interval 22
ip ospf dead-interval 33
ip ospf cost 100
ip ospf priority 255
passive-interface loopback 0
passive-interface loopback 1
OSPF Commnd
default-information originate always
conf t interface GigabitEthernet0/0
ip ospf hello-interval 5
ip ospf dead-interval 20
ip ospf priority 150
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 Area0pa55
conf t interface GigabitEthernet0/0
ip ospf hello-interval 5
ip ospf dead-interval 20
ip ospf priority 100
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 Area0pa55
hostname R1
router ospf 1
router-id 1.1.1.1
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
ip ospf 1 area 0
no shut
interface FastEthernet0/1
ip address 10.0.13.1 255.255.255.0
ip ospf 1 area 13
no shutdown
interface Serial1/0
ip address 10.0.12.1 255.255.255.0
ip ospf 1 area 12
no shut
interface Serial1/1
ip address 10.0.16.1 255.255.255.0
ip ospf 1 area 16
no shutdown
hostname R2
router ospf 1
router-id 2.2.2.2
interface FastEthernet0/0
ip address 10.0.0.2 255.255.255.0
ip ospf 1 area 0
no shut
interface FastEthernet0/1
ip address 10.0.2.2 255.255.255.0
ip ospf 1 area 12
no shut
interface Serial1/0
ip address 10.0.12.2 255.255.255.0
ip ospf 1 area 12
no shut
hostname R3
router ospf 1
router-id 3.3.3.3
interface FastEthernet0/0
ip address 10.0.0.3 255.255.255.0
ip ospf 1 area 0
no shut
interface FastEthernet0/1
ip address 10.0.13.3 255.255.255.0
ip ospf 1 area 13
no shut
interface loopback0
ip address 10.0.3.3 255.255.255.0
ip ospf 1 area 3
hostname R4
router rip
version 2
network 10.0.0.0
no auto-summary
redistribute ospf 1 metric 1
router ospf 1
router-id 4.4.4.4
redistribute rip subnets
interface FastEthernet0/0
ip address 10.0.0.4 255.255.255.0
ip ospf 1 area 0
no shut
interface FastEthernet0/1
ip address 10.0.45.4 255.255.255.0
no shutdown
hostname R5
interface FastEthernet0/1
ip address 10.0.45.5 255.255.255.0
no shut
interface loopback0
ip address 10.0.5.5 255.255.255.0
router rip
version 2
network 10.0.0.0
no auto-summary
hostname R6
router ospf 1
router-id 6.6.6.6
interface serial 1/1
ip address 10.0.16.6 255.255.255.0
ip ospf 1 area 16
no shutdown
Figure 1 – OSPF hello packet sent by R2
Router(config)# hostname R1
R1(config)# interface GigabitEthernet0/2
R1(config-if)# ip address 10.0.12.1 255.255.255.0
R1(config-if)# ip ospf network point-to-point
R1(config-if)# no shutdown
R1(config-if)# interface GigabitEthernet0/4
R1(config-if)# ip address 10.0.14.1 255.255.255.0
R1(config-if)# ip ospf network point-to-multipoint
R1(config-if)# no shutdown
R1(config-if)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 10.0.12.1 0.0.0.0 area 0
R1(config-router)# network 10.0.14.1 0.0.0.0 area 0
Router(config)# hostname R2
R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip address 10.0.12.2 255.255.255.0
R2(config-if)# ip ospf network point-to-point
R2(config-if)# no shutdown
R2(config-if)# interface GigabitEthernet0/3
R2(config-if)# ip address 10.0.23.2 255.255.255.0
R2(config-if)# ip ospf network point-to-multipoint non-broadcast
R2(config-if)# no shutdown
R2(config-if)# interface GigabitEthernet0/4
R2(config-if)# ip address 10.0.24.2 255.255.255.0
R2(config-if)# ip ospf network broadcast
R2(config-if)# no shutdown
R2(config-if)# router ospf 1
R2(config-router)# router-id 2.2.2.2
R2(config-router)# neighbor 10.0.23.3
R2(config-router)# network 10.0.12.2 0.0.0.0 area 0
R2(config-router)# network 10.0.23.2 0.0.0.0 area 0
R2(config-router)# network 10.0.24.2 0.0.0.0 area 0
Router(config)# hostname R3
R3(config)# interface GigabitEthernet0/2
R3(config-if)# ip address 10.0.23.3 255.255.255.0
R3(config-if)# ip ospf network point-to-multipoint non-broadcast
R3(config-if)# no shutdown
R3(config-if)# interface GigabitEthernet0/4
R3(config-if)# ip address 10.0.34.3 255.255.255.0
R3(config-if)# ip ospf network non-broadcast
R3(config-if)# no shutdown
R3(config-if)# router ospf 1
R3(config-router)# router-id 3.3.3.3
R3(config-router)# neighbor 10.0.23.2
R3(config-router)# neighbor 10.0.34.4
R3(config-router)# network 10.0.23.3 0.0.0.0 area 0
R3(config-router)# network 10.0.34.3 0.0.0.0 area 0
Router(config)# hostname R4
R4(config)# interface GigabitEthernet0/1
R4(config-if)# ip address 10.0.14.4 255.255.255.0
R4(config-if)# ip ospf network point-to-multipoint
R4(config-if)# no shutdown
R4(config-if)# interface GigabitEthernet0/2
R4(config-if)# ip address 10.0.24.4 255.255.255.0
R4(config-if)# ip ospf network broadcast
R4(config-if)# no shutdown
R4(config-if)# interface GigabitEthernet0/3
R4(config-if)# ip address 10.0.34.4 255.255.255.0
R4(config-if)# ip ospf network non-broadcast
R4(config-if)# no shutdown
R4(config-if)# router ospf 1
R4(config-router)# router-id 4.4.4.4
R4(config-router)# neighbor 10.0.34.3
R4(config-router)# network 10.0.14.4 0.0.0.0 area 0
R4(config-router)# network 10.0.24.4 0.0.0.0 area 0
R4(config-router)# network 10.0.34.4 0.0.0.0 area 0
Why Adjusting the Hello and Dead Intervals?
A Higher Hello interval causes OSPF adjacencies to take a long time to get built up. Therefore, lowering the Hello timer’s interval speeds up the process of forming full OSPF neighbor relationships. However, that would generate more OSPF routing traffic.
OSPF router ID is a 32-bit binary number, written in a dotted-decimal format similar to an IPv4 address, that must be uniquely assigned to distinguish each router within an OSPF Autonomous System.
What is The Purpose of OSPF Router ID?
In OSPF, routers build a network map to calculate the shortest path to every network prefix. Each router labels the other routers before applying Dijkstra’s algorithm. Also, each router needs a way to recognize and track all routers on the map.
Here comes the concept of OSPF router ID, which helps identify all nodes in the OSPF autonomous system. An OSPF router ID consists of a number between 0.0.0.1 and 255.255.255.255 that should be uniquely assigned, and it is used to track every router in the OSPF domain. Additionally, OSPF router ID and priority are used in DR/BDR election on multi-access data links.
OSPF Router ID Selection Process on Cisco IOS and IOS XR
OSPF Router ID Selection Process on Cisco IOS
On Cisco routers, you can create many OSPF instances that work independently from one another. Each instance can have a distinct Router ID. It is not mandatory to give them identical Router IDs. Cisco IOS uses the following process to generate the Router ID of a particular OSPF instance:
Step 1. If the RID has been explicitly assigned to the current OSPF instance using the router-id command, Cisco IOS uses that Router ID.
Step 2. If no Router ID has been explicitly configured, Cisco IOS uses the highest IPv4 address on active loopback interfaces. Down loopback interfaces are not used in the selection process.
Step 3. If no IP-enabled loopback interfaces are eligible for use, the router selects the highest IPv4 address on active physical interfaces.
Finally, an interface whether it is loopback or physical does not have to be advertised in the OSPF autonomous system in order to be used in the Router ID selection process.
hostname R1
interface loopback0
ip address 1.1.1.1 255.255.255.255
interface loopback1
ip address 10.0.10.1 255.255.255.255
shutdown
interface gigabitethernet 0/2
ip address 10.0.12.1 255.255.255.0
no shutdown
interface gigabitethernet 0/3
ip address 10.0.13.1 255.255.255.0
no shutdown
router ospf 1
hostname R2
interface loopback0
ip address 10.0.20.2 255.255.255.255
shutdown
interface loopback1
ip address 10.0.21.2 255.255.255.255
shutdown
interface loopback2
ip address 10.0.22.2 255.255.255.255
shutdown
interface gigabitethernet 0/1
ip address 10.0.12.2 255.255.255.0
no shutdown
interface gigabitethernet 0/0
ip address 10.0.234.2 255.255.255.0
no shutdown
router ospf 1
network 0.0.0.0 255.255.255.255 area 0
hostname R4
interface loopback0
ip address 10.0.40.4 255.255.255.255
interface loopback1
ip address 10.0.4.4 255.255.255.255
interface gigabitethernet 0/0
ip address 10.0.234.4 255.255.255.0
no shutdown
router ospf 1
network 0.0.0.0 255.255.255.255 area 0
hostname R3
interface loopback0
ip address 10.0.30.3 255.255.255.255
interface loopback1
ip address 10.0.31.3 255.255.255.255
interface gigabitethernet 0/0/0/1
ip address 10.0.13.3 255.255.255.0
no shutdown
interface gigabitethernet 0/0/0/0
ip address 10.0.234.3 255.255.255.0
no shutdown
exit
router ospf 1
area 0
interface loopback0
interface loopback1
interface gigabitethernet 0/0/0/1
interface gigabitethernet 0/0/0/0
hostname R5
interface loopback0
ip address 10.0.50.5 255.255.255.255
interface loopback1
ip address 10.0.51.5 255.255.255.255
interface gigabitethernet 0/0
ip address 10.0.234.5 255.255.255.0
no shutdown
router ospf 1
router-id 5.5.5.5
network 10.0.0.0 0.0.255.255 area 0
In Exhibit 1, the show ip ospf command output reveals that R4’s OSPF RID is 10.0.40.4, which represents the highest IP address on all active loopback interfaces (Exhibit 2).
Commnd
Router R1
router ospf 1
area 0 authentication
area 1 authentication
interface fastethernet 0/0
ip ospf authentication-key cisco
interface serial 1/0
ip ospf authentication-key cisco
Router R2
router ospf 1
area 0 authentication
area 1 authentication
area 1 virtual-link 3.3.3.3 authentication null
interface fastethernet 0/0
ip ospf authentication-key cisco
interface fastethernet 0/1
ip ospf authentication null
When you activate OSPFv2 plain text authentication on a data link, routers insert the shared password into the OSPF header of the packets sent over the link. In addition, when a router receives an OSPF packet, it reads the authentication data field and checks it matches the shared password. If there is no match, the packet gets discarded.
Router R1
interface serial 1/0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 Area0pa55
Router R2
interface serial 1/0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 Area0pa55
Figure 1 – The network diagram of an OSPF routing domain
Here are the links to download the initial configurations of the routers.
hostname R1
interface GigabitEthernet0/2
ip address 10.0.12.1 255.255.255.0
no shutdown
router ospf 1
router-id 1.1.1.1
network 10.0.12.1 0.0.0.0 area 12
hostname R2
hostname R2
interface GigabitEthernet0/1
ip address 10.0.12.2 255.255.255.0
no shutdown
interface GigabitEthernet0/3
ip address 10.0.23.2 255.255.255.0
no shutdown
router ospf 1
router-id 2.2.2.2
network 10.0.12.2 0.0.0.0 area 12
network 10.0.23.2 0.0.0.0 area 234
hostname R4
interface GigabitEthernet0/3
ip address 10.0.34.4 255.255.255.0
no shutdown
interface GigabitEthernet0/5
ip address 10.0.45.4 255.255.255.0
no shutdown
router ospf 1
router-id 4.4.4.4
network 10.0.34.4 0.0.0.0 area 234
network 10.0.45.4 0.0.0.0 area 0
hostname R3
hostname R3
interface GigabitEthernet0/2
ip address 10.0.23.3 255.255.255.0
no shutdown
interface GigabitEthernet0/4
ip address 10.0.34.3 255.255.255.0
no shutdown
router ospf 1
router-id 3.3.3.3
network 10.0.23.3 0.0.0.0 area 234
network 10.0.34.3 0.0.0.0 area 234
The backbone area (area 0) cannot be discontiguous across an OSPF routing domain. This means each router attached to area 0 must have at least one OSPF adjacency with a router in that area. Routers in the backbone area can share LSAs between OSPF areas. if a router is connected to multiple areas, not including area 0, then it cannot share LSAs between areas because if it is not connected to area 0. Here comes the concept of OSPF virtual link.
OSPF virtual link is a tool used to connect an OSPF-enabled router to area 0 across a particular transit area.
In Figure 1, router R2 is connected to two OSPF areas, not including area 0 (Figure 1). Therefore, it does not flood LSAs received in area 12 into area 234, and vice versa. This way, router R1 does have routes to subnets 10.0.23.0/24, 10.0.34.0/24, and 10.0.45.0/24 (Example 1).
Router 2
R2(config)# router ospf 1
R2(config-router)# area 234 virtual-link 4.4.4.4
Router 4 <Area 0 Router>
R4(config)# router ospf 1
R4(config-router)# area 234 virtual-link 2.2.2.2
Configuring The Hello Interval of an OSPF Virtual Link
The default value of the hello interval on the virtual link between R2 and R4 is 10 seconds. To change it, use the area area_number virtual-link router_id hello-interval seconds, where seconds is between 1 and 8192.
R2(config)# router ospf 1
R2(config-router)# area 234 virtual-link 4.4.4.4 hello-interval 5
R4(config)# router ospf 1
R4(config-router)# area 234 virtual-link 2.2.2.2 hello-interval 5
To verify the configuration, we use the show ip ospf virtual-links command, as you can see in this example:
Configuring The Dead Interval of an OSPF Virtual Link
The default value of the dead interval on OSPF virtual links is 40 seconds. To change it, use the area area_number virtual-link router_id dead-interval seconds, where seconds is between 1 and 8192.
In this example, we set the dead interval of the virtual link between R2 and R4 to 60 seconds.
R2(config)# router ospf 1
R2(config-router)# area 234 virtual-link 4.4.4.4 dead-interval 60
R4(config)# router ospf 1
R4(config-router)# area 234 virtual-link 2.2.2.2 dead-interval 60
The following show ip ospf virtual-links command output states that the dead interval of the virtual link interface on R2 is now 60 seconds instead of 40 seconds.
Configuring The Retransmission Interval on an OSPF Virtual Link
Configuring The Transmission Delay on an OSPF Virtual Link
To change the default transmit delay value, use the area area-id virtual-link router-id transmit-delay seconds command, where seconds is between 1 and 8192. This parameter does not have to be identical on both ends of the virtual link.
In this example, we configure router R2 to set the transmit delay of the virtual link to 2 seconds.
To verify that the change has been applied, we use the show ip ospf virtual-links command in enable mode, as shown below:
Configuring The TTL-Security Hops for an OSPF Virtual Link
The area area_id virtual-link router_id ttl-security hops hop_count command allows to instruct Cisco IOS to start checking TTL values on OSPF packets received over a virtual link and set the Time-to-Live (TTL) security hops allowed on one end of a virtual link, where area_id is the ID of the transit area, router_id is the router ID of the other end node of the virtual link, and hop_count is an integer between 1 and 254.
You don’t have to configure this setting on both ends of the virtual link, but you should pay attention to not set it to a value that may break OSPF adjacency across the transit. For example, OSPF packets between R2 and R3 traverse two devices, and thus the minimum TTL security hops value should at least be 2. Otherwise, the virtual link between R2 and R4 will fail.
In this example, we set the TTL-security hops to 2 on R2 and R4.
Commnd
The show ip ospf virtual-links command output below states that the TTL-security check feature is enabled and the maximum hop count allowed is 2.
OSPF Virtual Link Authentication
The command must be issued on both ends of the virtual link. This example configures null authentication on the virtual link between R2 and R4.
Configuring Plain Text Password Authentication Over a Virtual Link
To add OSPF plain text authentication to a virtual link, use the area number virtual-link router_id authentication authentication-key psswrd command in router configuration mode, where number is the ID of the transit area, router_id is the router ID of the other end node of the virtual link, and psswrd is the shared password between both ends of the virtual link that is used to generate and authenticate OSPF packets.
When simple password authentication is applied over a virtual link, both endpoints of that link should be configured with the same password. In addition, the area virtual-link authentication authentication-key command must be issued on both ends of the virtual link. This example configures plain text authentication over the virtual link between R2 and R4 using the password CISCO.
Configuring HMAC-SHA Authentication Over a Virtual Link
Step 1. Construct a key chain object, using the key chain name command in router configuration mode, where name is a string.
Step 2. Create the secret key’s identifier using the key command in key chain configuration mode.
Step 3. Configure the secret key’s password using the key-string pwd command, where pwd is a string that should not exceed 80 characters.
Step 4. Specify the cryptographic authentication algorithm using the cryptographic-algorithm command.
Step 5. (optional) configure the KeyStartAccept and KeyStopAccept time constants of the key using the accept-lifetime command.
Step 6. (optional) configure the KeyStartGenerate and KeyStopGenerate time constants of the key using the send-lifetime command.
Step 7. Apply the key chain object to the virtual link using the area virtual-link authentication key-chain command.
For more information about the KeyStartAccept, KeyStopAccept, KeyStartGenerate, and KeyStopGenerate constants, read this article about OSPF HMAC-SHA cryptographic authentication.
In the examples below, we configure routers R2 and R4 to activate the OSPF HMAC-SHA authentication method over the virtual link using the HMAC-SHA-512 algorithm, key 1, and password CISCO.