Configure OSPF Connection in A Virtual Link Environment
Configure OSPF Connection in A Virtual Link Environment
Environment
Contents
Introduction
Prerequisites
Requirements
Components Used
Conventions
Background Information
Configure
Network Diagram
Configurations
How the Virtual Link Operates
Calculate the Shortest Path
Use a GRE Tunnel Instead of a Virtual Link
Verify
Examine the OSPF Database
Troubleshoot
Troubleshoot Commands
Related Information
Introduction
This document describes an Open Shortest Path First (OSPF) connection with the use of a virtual
link.
Prerequisites
Requirements
Components Used
The information in this document was created from the devices in a specific lab environment. All of
the devices used in this document started with a cleared (default) configuration. If your network is
live, ensure that you understand the potential impact of any command.
Conventions
Refer to Cisco Technical Tips Conventions for more information on document conventions.
Background Information
All areas in an Open Shortest Path First (OSPF) autonomous system must be physically
connected to the backbone area (Area 0). In some cases, where this is not possible, you can use
a virtual link to connect to the backbone through a non-backbone area. You can also use virtual
links to connect two parts of a partitioned backbone through a non-backbone area. The area
through which you configure the virtual link, known as a transit area , must have full routing
information. The transit area cannot be a stub area. This document examines the OSPF database
in a virtual link environment. You can read more about virtual links in the OSPF Design Guide.
Configure
In this section, you are presented with the information to configure the features described in this
document.
Network Diagram
Network Diagram
Configurations
● Router10.1.1.1
● Router10.2.2.2
● Router10.3.3.3
Router10.1.1.1
Current configuration:
hostname Router10.1.1.1
!
interface Loopback0
ip address 10.1.1.1 255.255.0.0
!
interface Ethernet2/0/0
ip address 10.4.0.1 255.255.0.0 !
interface Serial2/1/0
ip address 10.5.0.1 255.255.0.0
!
router ospf 2
network 10.4.0.0 0.0.255.255 area 0
network 10.5.0.0 0.0.255.255 area 1
area 1 virtual-link 10.3.3.3
!
end
Note: The OSPF router ID is usually the highest IP address on the box or the highest
loopback address, if one exists. The router ID is only calculated at boot time or at any time
that the OSPF process is restarted. Issue the show ip ospf interface command to find the
router ID.
Router10.2.2.2
Current configuration:
hostname Router10.2.2.2
!
interface Loopback0
ip address 10.2.2.2 255.255.0.0
!
interface Serial0/1/0
ip address 10.5.0.2 255.255.0.0
!
interface ATM1/0.20 point-to-point
ip address 10.6.0.2 255.255.0.0
!
router ospf 2
network 10.6.0.0 0.0.255.255 area 1
network 10.5.0.0 0.0.255.255 area 1
!
end
Router10.3.3.3
Current configuration:
hostname Router10.3.3.3
!
interface Loopback0
ip address 10.3.3.3 255.255.0.0
!
interface Ethernet0/0
ip address 10.12.03 255.255.0.0
!
interface ATM2/0.20 point-to-point
ip address 10.6.0.3 255.255.0.0
!
router ospf 2
network 10.12.0.0 0.0.255.255 area 2
network 10.6.0.0 0.0.255.255 area 1
area 1 virtual-link 10.1.1.1
!
end
!--- Area 1 is the transit area.
!--- IP address 10.1.1.1 is the router
!--- ID of the router between Area 1
!--- and Area 0 (Router10.1.1.1).
After the routers know how to reach each other through the transit area, they try to form adjacency
across the virtual link. The OSPF packets between the two ends of the virtual link are not multicast
packets. They are tunneled packets from source 10.5.0.1 to the destination 10.6.0.3, because they
are tunneled to the other end of the virtual link. It is important to note that if there is a firewall in
between the virtual-link routers, you need to enable the OSPF (IP protocol 89) port between the
virtual-link tunnel outgoing interface IPs that are between 10.5.0.1 and 10.6.0.3.
Once the routers become adjacent on the virtual link, Router10.3.3.3 considers itself an area
border router (ABR), because it now has a link in Area 0. As a result, Router10.3.3.3 creates a
summary LSA for 10.12.0.0/16 in Area 0 and in Area 1.
If the virtual link is misconfigured for some reason, then Router10.3.3.3 does not consider itself an
ABR because it does not have any interfaces in Area 0. If this is the case, it does not create
summary LSAs or advertise 10.12.0.0/16 into Area 1.
Note: OSPF runs on top of IP and uses protocol number 89. OSPF does not rely on any
other transport protocols, such as TCP and UDP.
This section calculates the shortest path from the perspective of Router10.2.2.2.
Router10.2.2.2 looks in its own LSA and sees that Router10.3.3.3 is a neighbor. It then looks at
the LSA of Router10.3.3.3 to verify that Router10.3.3.3 sees Router10.2.2.2 as a neighbor. If both
routers see each other as neighbors, then they are considered reachable.
Each router also checks its local neighbor table (which you can see with the show ip ospf neighbor
command) to verify that its interface and the interface of the neighbor are on a common IP subnet.
If they are on a common subnet, the routers install routes for any stub networks listed in the router
LSA of their neighbor. In this example, 10.6.0.0/16 is the only stub network listed in the LSA of
Router10.3.3.3 in Area 1, to which Router10.2.2.2 is already directly connected.
Router10.3.3.3 does the same examination for the LSA of Router10.1.1.1, but there are not any
useful stub networks in the LSA of Router10.1.1.1.
After all of the reachable router LSAs in Area 1 are examined, Router10.2.2.2 looks at summary
LSAs in the database. It finds two summary LSAs for 10.12.0.0/16 in Area 1 and chooses the one
with the lowest total cost, which is the metric to reach the advertising router plus the metric of the
summary LSA.
Verify
Use this section to confirm that your configuration works properly.
Note: Only registered Cisco users have access to internal Cisco tools and information.
The Cisco CLI Analyzer supports certain show commands. Use the tool to view an analysis of show
command output.
● show ip ospf database — Displays a list of the LSAs and types them into a link-state database. This
list shows only the information in the LSA header.
● show ip ospf database [router] [link-state-id] — Displays a list of all of the LSAs of a router in the
database. LSAs are produced by every router. These fundamental LSAs list all of the links of
the routers or interfaces, along with the states and outgoing costs of the links, and they are
flooded only within the area in which they originate.
● show ip ospf [process-id [area-id]] database [summary] [link-state-id] — Displays information only about the
network summary LSAs in the database.
● show ip ospf database [summary] [self-originate] — Displays only self-originated LSAs (from the local
router).
This is how the OSPF database looks, given this network environment, when you issue the show ip
ospf database command.
LS age: 1100
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 10.1.1.1
!--- For router links, Link State ID is always the same as the Advertising Router.
Advertising Router: 10.1.1.1
!--- This is the router ID of the router that created this LSA. LS Seq Number:
80000003 Checksum: 0xD5DF Length: 48 Area Border Router
!--- Bit B in the router LSA indicates that this router is an ABR. Number of Links: 2
!--- There are two links in Area 0. Link connected to: a Virtual Link (Link ID)
Neighboring Router ID: 10.3.3.3
!--- Router ID of the neighbor on the other end of the virtual link. (Link Data)
Router Interface address: 10.5.0.1
!--- The interface that this router uses to send packets to the neighbor. Number of
TOS metrics: 0 TOS 0 Metrics: 65
!--- The metric comes from the cost for this router to reach the neighboring router:
!--- the ATM link has a cost of 1 and the serial link has a cost of 64. Link
connected to: a Stub Network
!--- This represents the Ethernet segment 10.4.0.0/16. (Link ID) Network/subnet
number: 10.4.0.0 (Link Data) Network Mask: 255.255.0.0 Number of TOS metrics: 0 TOS 0
Metrics: 10 Router Link States (Area 1) LS age: 122 Options: (No TOS-capability, DC)
LS Type: Router Links Link State ID: 10.1.1.1 Advertising Router: 10.1.1.1 LS Seq
Number: 80000006 Checksum: 0xDBA7 Length: 48 Area Border Router Number of Links: 2
!--- There are two links in Area 1. Link connected to: another Router (point-to-
point) (Link ID) Neighboring Router ID: 10.2.2.2 (Link Data) Router Interface
address: 10.5.0.1 Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected to: a
Stub Network (Link ID) Network/subnet number: 10.5.0.0 (Link Data) Network Mask:
255.255.0.0 Number of TOS metrics: 0 TOS 0 Metrics: 64 Router10.1.1.1#show ip ospf
database router 10.2.2.2
LS age: 245
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 10.2.2.2
Advertising Router: 10.2.2.2
LS Seq Number: 80000009
Checksum: 0x64DD
Length: 72
Number of Links: 4
!--- There are four links in Area 1. Link connected to: another Router (point-to-
point) (Link ID) Neighboring Router ID: 10.3.3.3 (Link Data) Router Interface
address: 10.6.0.2 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Stub
Network (Link ID) Network/subnet number: 10.6.0.0 (Link Data) Network Mask:
255.255.0.0 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: another
Router (point-to-point) (Link ID) Neighboring Router ID: 10.1.1.1 (Link Data) Router
Interface address: 10.5.0.2 Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected
to: a Stub Network (Link ID) Network/subnet number: 10.5.0.0 (Link Data) Network
Mask: 255.255.0.0 Number of TOS metrics: 0 TOS 0 Metrics: 64 Router10.1.1.1#show ip
ospf database router 10.3.3.3
!--- There is one link in Area 0. Link connected to: a Virtual Link (Link ID)
Neighboring Router ID: 10.1.1.1 (Link Data) Router Interface address: 10.6.0.3
Number of TOS metrics: 0
TOS 0 Metrics: 65
!--- There are two links in Area 1. Link connected to: another Router (point-to-
point) (Link ID) Neighboring Router ID: 10.2.2.2 (Link Data) Router Interface
address: 10.6.0.3 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Stub
Network (Link ID) Network/subnet number: 10.6.0.0 (Link Data) Network Mask:
255.255.0.0 Number of TOS metrics: 0 TOS 0 Metrics: 1
Router10.3.3.3 considers itself an ABR because it has a link to Area 0 (the virtual link). As a result,
it generates a summary LSA for 10.12.0.0 into Area 1 and Area 0, which you can see when you
issue the show ip ospf database summary command.
LS age: 1766
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.12.0.0 (summary Network Number)
Advertising Router: 10.1.1.1
LS Seq Number: 80000001
Checksum: 0xBF22
Length: 28
Network Mask: /16
TOS: 0 Metric: 75
LS age: 1781
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.12.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000001
Checksum: 0xF624
Length: 28
Network Mask: /16
TOS: 0 Metric: 10
Also, notice that Router10.3.3.3 creates summary LSAs in Area 2 for all of the information that it
learned from Area 0 and Area 1.
LS age: 155
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.5.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000002
Checksum: 0x7871
Length: 28
Network Mask: /16
TOS: 0 Metric: 65
LS age: 155
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.6.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000002
Checksum: 0xE840
Length: 28
Network Mask: /16
TOS: 0 Metric: 1
LS age: 156
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.12.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000002
Checksum: 0xF425
Length: 28
Network Mask: /16
TOS: 0 Metric: 10
LS age: 157
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.4.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000002
Checksum: 0xE9F6
Length: 28
Network Mask: /16
TOS: 0 Metric: 75
LS age: 165
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.12.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000002
Checksum: 0xF425
Length: 28
Network Mask: /16
TOS: 0 Metric: 10
LS age: 167
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.4.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000002
Checksum: 0xE9F6
Length: 28
Network Mask: /16
TOS: 0 Metric: 75
LS age: 168
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.5.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000002
Checksum: 0x7871
Length: 28
Network Mask: /16
TOS: 0 Metric: 65
LS age: 168
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 10.6.0.0 (summary Network Number)
Advertising Router: 10.3.3.3
LS Seq Number: 80000002
Checksum: 0xE840
Length: 28
Network Mask: /16
TOS: 0 Metric: 1
Troubleshoot
Use this section to troubleshoot your configuration.
Troubleshoot Commands
Note: Only registered Cisco users have access to internal Cisco tools and information.
The Cisco CLI Analyzer supports certain show commands. Use the OIT to view an analysis of
show command output.
Note: Refer to Important Information on Debug Commands before you use debug
commands.
● debug ip ospf adj—Displays the events involved to build or break OSPF adjacency.
The routers become adjacent and exchange LSAs via the virtual link, similar to a physical link. You
can see the adjacency if you examine the router LSA or the output of the debug ip ospf adj
command:
Router10.3.3.3#
May 26 17:25:03.089: OSPF: Rcv hello from 10.1.1.1 area 0 from OSPF_VL3 10.5.0.1
May 26 17:25:03.091: OSPF: 2 Way Communication to 10.1.1.1 on OSPF_VL3, state 2WAY
May 26 17:25:03.091: OSPF: Send DBD to 10.1.1.1 on OSPF_VL3
seq 0xD1C opt 0x62 flag 0x7 len 32
May 26 17:25:03.135: OSPF: End of hello processing
May 26 17:25:03.139: OSPF: Rcv DBD from 10.1.1.1 on OSPF_VL3
seq 0x1617 opt 0x22 flag 0x7 len 32
mtu 0 state EXSTART
May 26 17:25:03.175: OSPF: First DBD and we are not SLAVE
May 26 17:25:03.179: OSPF: Rcv DBD from 10.1.1.1 on OSPF_VL3
seq 0xD1C opt 0x22 flag 0x2 len 172
mtu 0 state EXSTART
May 26 17:25:03.183: OSPF: NBR Negotiation Done. We are the MASTER
May 26 17:25:03.189: OSPF: Send DBD to 10.1.1.1 on OSPF_VL3
seq 0xD1D opt 0x62 flag 0x3 len 172
May 26 17:25:03.191: OSPF: Database request to 10.1.1.1
May 26 17:25:03.191: OSPF: sent LS REQ packet to 10.5.0.1, length 36
May 26 17:25:03.263: OSPF: Rcv DBD from 10.1.1.1 on OSPF_VL3
seq 0xD1D opt 0x22 flag 0x0 len 32
mtu 0 state EXCHANGE
May 26 17:25:03.267: OSPF: Send DBD to 10.1.1.1 on OSPF_VL3
seq 0xD1E opt 0x62 flag 0x1 len 32
May 26 17:25:03.311: OSPF: Rcv DBD from 10.1.1.1 on OSPF_VL3
seq 0xD1E opt 0x22 flag 0x0 len 32
mtu 0 state EXCHANGE
May 26 17:25:03.311: OSPF: Exchange Done with 10.1.1.1 on OSPF_VL3
May 26 17:25:03.315: OSPF: Synchronized with 10.1.1.1 on OSPF_VL3, state FULL
May 26 17:25:03.823: OSPF: Build router LSA for area 0,
router ID 10.3.3.3, seq 0x80000029
May 26 17:25:03.854: OSPF: Dead event ignored for 10.1.1.1 on demand circuit OSPF_VL3
Notice that adjacencies over virtual links are not displayed in the show ip ospf neighbor command
output. The only way to see them is to look at the router LSA and observe debug commands as the
adjacency comes up, or issue the show ip ospf virtual-links command.
Related Information
● What Are OSPF Areas and Virtual Links?
● Configure OSPF Authentication on a Virtual Link
● Configure a GRE Tunnel over IPSec with OSPF
● What Does the show ip ospf interface Command Reveal?
● How OSPF Propagates External Routes into Multiple Areas
● OSPF Database Explanation Guide
● IP Routing and OSPF Support
● Network Technologies and Protocols
● Cisco Technical Support & Downloads