OSPF Handout
OSPF Handout
As a matter of fact, OSPF is one of the Interior Gateway Protocol (IGP), which helps to find the
best routing path between the source and the destination router using its own shortest path first
algorithm. It is a link-state routing protocol that is used to distribute routing information about data
packets within a large Autonomous System. Because it is an open standard, it is implemented by
a variety of network vendors. OSPF will run on most routers that doesn’t necessarily have to be
Cisco routers (unlike EIGRP which can be run only on Cisco routers). Here are the most
important features of OSPF:
a classless routing protocol
supports CIDR, manual route summarization, equal cost load balancing
incremental updates are supported
uses only one parameter as the metric – the interface cost.
the administrative distance of OSPF routes is, by default, 110.
uses multicast addresses 224.0.0.5 and 224.0.0.6 for routing updates.
Routers running OSPF have to establish neighbor relationships before exchanging routes.
Because OSPF is a link state routing protocol, neighbors don’t exchange routing tables. Instead,
they exchange information about network topology. Each OSPF router then runs SPF or Dijkstra
algorithm to calculate the best routes and adds those to the routing table. Because each router
knows the entire topology of a network, the chance for a routing loop to occur is minimal.
When it is configured, it listens to its neighbours in the networks, and it gathers all the link state
data available. This data is then used to make a topology map that contains all available paths in
the network. This database is saved for use, and we call it Link State Database. Once the Link
State Database is made, it is used to calculate the shortest path to subnets/networks using an
algorithm known as Shortest Path First, developed by Edsger W Dijkstra. However, OSPF creates
three tables:
Routing Table: It contains currently working best paths that will be used to forward traffic
between two neighbours.
Neighbour Table: This contains all discovered Open Short Path First neighbours.
Topology Table: This one contains the entire road map of the network (i.e., topology
structure of a network). This road map includes all the available Open Short Path First
routers and keeps calculated data about best and alternative paths.
B) OSPF Neighbors
OSPF routers need to establish a neighbor relationship before exchanging routing updates. OSPF
neighbors are dynamically discovered by sending Hello packets out each OSPF-enabled interface
on a router. Hello packets are sent to the multicast IP address of 224.0.0.5. The process is
explained in the following figure:
Routers R1 and R2 are directly connected. After OSPF is enabled both routers send Hellos to each
other to establish a neighbor relationship. You can verify that the neighbor relationship has indeed
been established by typing the show ip ospf neighbors command.
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:30 192.168.0.2 FastEthernet0/0
In the example above, you can see that the router-id of R2 is 2.2.2.2. Each OSPF router is
assigned a router ID. A router ID is determined by using one of the following:
Using the router-id command under the OSPF process.
Using the highest IP address of the router’s loopback interfaces.
Using the highest IP address of the router’s physical interfaces.
C) OSPF Neighborship Requirement
In order to become OSPF neighbor, the following values must be match on both routers. In other
words, the following fields in the Hello packets must be the same on both routers in order for
routers to become neighbors:
Subnet, totally clear
Area ID, which will be discussed shortly
Authentication (optional but highly recommended)
Hello and Dead Intervals
Area Type, which will be discussed shortly
Interface MTU Size
1. Authentication
To enhance the security of network, OSPF allows us to configure the password for specific areas.
Routers who have same password will be eligible for neighborship. If you want to use this facility
(as the default is no authentication, as seen in Figure 2), you need to configure password on all
routers which you want to include in network. If you skip any router, that will not be able to
form an OSPF neighborship.
Suppose that our network has two routers R1 and R2. Both routers are connected with direct link
and meet all criteria mentioned in first requirement. What if I configure password in R1 and leave
R2 as it is? Will it form neighborship with R2? In this situation neighborship will not take place
because when both routers see each other’s hello packet in segment, they try to match all configure
values including password field. One packet has a value in password filed while other has
nothing in it. In this case routers will simply ignore each other’s packet. However, kindly pay
attention to the OSPF authentication option 2, as shown in Figure 3.
By default, OSPF sends hello packets every 10 second on an Ethernet network (Hello interval).
A dead timer is four times the value of the hello interval, so if a router on an Ethernet network
doesn’t receive at least one Hello packet from an OSPF neighbor for 40 seconds, the routers
declares that neighbor to be down. Figure 4 shows a description for OSPF Hello and dead
intervals.
OSPF routers go through the seven states while building neighborship with other routers,
which are as follows:
1. Down state
2. Attempt/Init state
3. Two ways state
4. Exstart state
5. Exchange state
6. Loading state
7. Full state
They are explained thoroughly as follows:
1. Down state
At this point both routers have no information about each other. Following Figure 5, R1 does not
know which protocol is running on R2. Vice versa R2 have no clue about R1. In this stage OSPF
learns about the local interfaces which are configured to run the OSPF instance.
In down state routers prepares themselves for neighborship process. In this state routers choose
RID (Router ID). RID plays a big role in OSPF process. If OSPF fails to select the RID, it will
halt the OSPF process. We cannot use OSPF process without RID (where there are three
different ways to assign RIDs, as shown in Figure 6). In fact, RID is a unique identifier of Router
in OSPF network. It must be unique within the autonomous system. Routers identify each other
through the RID in AS.
Figure 6. OSPF Router ID Options
In down state, router do following:
Choose RID and initialize the OSPF process
Run OSPF instance on local interfaces which are configured through the network
command such as R1(config-router)#network 10.0.0.0 0.0.255.255 area 0.
Collect necessary information for Hello packet such RID and configuration values which
are required to build the neighborship.
2. Attempt/Init states
They are illustrated as follows:
i. Init state
Neighborship building process starts from this state. Following Figure 7, R1 multicasts first hello
packet so other routers in network can learn about the existence of R1 as an OSPF router. This
hello packet contains Router ID and some essential configuration values such as area ID,
hello interval, hold down timer, stub flag and MTU. Essential configuration values must be
same on routers who want to build an OSPF neighborship. Let us assume that these values
match on both routers. If essential configuration values match, R2 will add R1 in his neighbor
Table.
R1 will generate a hello packet with RID and essential configuration values and send it out
from all active interfaces.
The hello packets are sent to the multicast address 224.0.0.5.
R2 will receive this packet.
R2 will read RID from packet and look in neighbor table for existing entry.
If a match found, R2 would skip neighborship building process and reset the dead interval
timer for that entry.
If OSPF does not find a match in neighbor table, it will consider R1 (sender router) as a
possible OSPF neighbor and start neighborship building process.
R2 will match its essential configuration values with values listed in packet.
If all necessary configuration values match, R2 will add R1 in its neighbor table.
At this moment R1 has no idea about R2. R1 will learn about R2 when it will respond. Let’s have
a quick look on attempt state.
ii. Attempt
In non-broadcast multi-access environment such as Frame Relay and X.25, OSPF uses
Attempt state instead of Init state. OSPF uses this state only if neighbors are statically
configured with neighbor command. In this situation, it does not have to discover them
dynamically. As it already knows the neighbors, it will use unicast instead of multicast in this
state.
Once neighborship is built, OSPF uses hello packets as keep alive. If a router does not receive
a hello packet from any particular neighbor in dead interval, it will change its state to down
from full. After changing the state, it will make an effort to contact the neighbor by sending
Hello packets. This effort is made in Attempt state.
R2 has checked all essential configuration values listed in hello packet which it received
from R1.
R2 is ready to build neighborship with these parameters.
R2 has added R1 in its neighbor table.
To continue the neighborship process, R2 has replied with its hello packet.
R1 has received a reply from neighbor, with its own RID listed in R2’s neighbor table.
Figure 8. OSPF Neighborship States - Two Ways State - In Process
Now, it is R1’s turn to take action on R2’s reply. This reply would be based on hello packet which
it received from R2. As we know that this hello packet contains one additional field; Neighbor
table data field which indicates that this is not a regular neighbor discovery hello packet. This
packet is a reply of its own request. It is interesting to note that R1 will take following actions:
It will read RID from hello packet and look in its neighbor table for existing entry.
If a match for RID found in neighbor table, it would reset the dead interval timer for that
entry.
If a match is not found in neighbor table, it would read the essential configuration values
from packet.
It will match configuration values with its own values. If values match, it will add R2’s RID
in neighbor table.
If packet contains neighbor table data with its own RID, it will consider that as request
to enter in two-way state.
R1 will reply with a hello packet which contains its neighbor table data.
This packet is a confirmation of two ways state, as shown in Figure 9.
LSDB
Every OSPF router maintains a Link state database (LSDB). LSDB is collection of all LSAs
received by a router. Every LSA has a sequence number. OSPF stores LSA in LADB with
this sequence number.
DBDs
Database description packets (also referred as DDPs) contain the list of LSA. This list
includes link state type, cost of link, ID of advertising router and sequence number of link.
Make sure you understand this term correctly. It is only a list of all LSAs from its respective
database (i.e., LSAs checklist). It does not include full LSAs.
In this state, routers exchanges DBDs. Through DBDs routers can learn which LSAs they
already have. For example, in Figure 14, R1 has A1, A2 and B2 LSAs in its LADB. Therefore,
it will send a list of these LSAs to R2. This list is a DBDs. R2 will send an acknowledgment
of receiving the list with LSACK signal. Same as R2 will send its DBDs to R1 and R1 would
acknowledge that with its LSACK single.
6. Loading state
In this state, actual routing information is exchanged, as shown in Figure 15. Routers
exchange LSAs from LSR list. In fact, routers will use LSU (Link state update) to exchange
the LSAs. Each LSA contains routing information about a particular link. Routers also
maintain a retransmission list to make sure that every sent LSA is acknowledged. For
example, following figure illustrates loading state of above example. R1 sent a LSU which
contain two LSAs but it received acknowledgement of only one, so it had to resend lost LSA
again.
LSR
Upon receiving DBDs, routers will compare it with their own LSDB. Thus, they will learn
what they need to order. Referring to Figure 14, R1 received a check list (DBDs) of A1 and
B1. When it will compare this list with its own LSA database (LADB), it will learn that it
already has A1. Hence, it does not need to order this LSA again. But it does not have B1, so
it needs to order for this LSA. After a complete comparison, both routers will prepare a list
of LSAs which they do not have in their own LADB. This list is known as LSR (Link State
Request). It is important to mention that after exchanging Database Description packets with
a neighboring router, a router may find that parts of its topological database are out of date.
The LSR is further used to request the pieces of the neighbor's database that are more up to
date.
Link-State Update (LSU), which is a packet that contains fully detailed LSAs,
typically sent in response to an LSR message.
Link-State Acknowledgment (LSAck), which is sent to confirm the receipt of an
LSU message.
Figure 15 illustrates how aforementioned packets work over the scope of this state and
eventually how to get to the full state.
Figure 15. OSPF - OSPF Adjacency (loading and getting to full state)
7. Full state
Full state indicates that both routers has been exchanged all LSAs from LSR list. Referring
to Figure 14, both routers now have identical LSDB, as shown in Figure 16.
Adjacent routers remain in this state for life time. This state also referred as adjacency. If any
change occurs in network, routers will go through this process again.
Please pay attention that the neighboring routers are the routers that have interfaces in
common network. Adjacency is a relationship formed between neighboring routers for the
purpose of exchanging routing information. Not every pair of neighboring routers becomes
adjacent.
The terms adjacencies, DR, BDR and AllSPFRouters will be explained shortly.
iii. NMBA
Non-broadcast Multi-access networks are also capable in connecting more than two devices
but they do not have broadcast capability. X.25 and Frame Relay are the example of NMBA
type network. In this type of network:
As network does not have broadcast capability, dynamic network discovery will not
be possible.
OSPF neighbors must have to define statically (relies on manual neighbor setup).
All OSFP packets are unicast (as NBMA does not support multicast either).
DR and BDR are required.
Questions? What does DR and BDR actually do? Why do we need them in our network?
b. DR and BDR (Adjacent is Neighbor while Neighbor is not Adjacent)
OSPF routers in a network, which need DR and BDR, do not share routing information
directly with all each other’s. To minimize the routing information exchange, they select one
router as designated router (DR) and one other router as backup designated router (BDR).
Remaining routers are known as DROTHERs.
All DROTHERs share routing information with DR. DR will share this information back to
all DROTHERs. BDR is a backup router. In case DR is down, BDR will immediately take
place the DR and would elect new BDR for itself. Main reason behind this mechanism is that
routers have a central point for routing information exchange. Thus they need not to update
each other’s. A DROTHER only need to update the central point (DR) and other
DROTHERs will receive this update from DR. Practically this will cut the numbers of
routing information exchange from O(n*n) to O(n) where n is the number of routers in a
multi-access segment.
For example, Figure 18 illustrates a simple OSPF network. In this network R4 is selected as
DR and R5 is selected as BDR. DROTHERs (R1, R2 and R3) will share routing information
with R4 (DR) and R5 (BDR), but they will not share routing information with each other.
Later DR will share this information back to all DROTHERs.
R4 R5
R1 R2 R3
OSPF uses priority value to select DR and BDR. OSPF router with the highest priority
becomes DR. Router with second highest priority becomes BDR. If there is a tie, router with
the highest RID will be chosen.
Priority value is 8 bit in length. Default priority value is 1. We can set any value from range
0 to 255. We can change it from Interface Sub-configuration mode with ip ospf
priority command. Interestingly, we can force any router to become DR (Highest) or BDR
(Second highest) by changing its priority value. If we set priority value to 0, it will never
become DR or BDR. For example, Figure 19 illustrates a simple OPSF network. In this network
we have five routers. We do not want that R3 becomes DR or BDR. Therefore, we changed its
default priority value to 0. Now, let’s see how these routers select DR and BDR.
This condition says “Arrange all routes in high to low order and pick the highest for DR and second
highest for BDR”. If we arrange our routers in high to lower order, R3 will stand at last. Remaining
routers have equal priority value. Hence, at the end of this condition, we have a tie between four
routers.
Condition 2: If there is a tie use the highest RID
This condition says “If there is a tie, use RID value to choose”. In our network we have a tie
between four routers, so our routers will use RID to elect the DR and BDR. Arranging routers in
high to low order will give us the DR and BDR.
As we know that there are two types of network; networks which do not require DR and BDR for
exchange process and networks which require DR and BDR for exchange process. In the first type,
all routers will exchange routing information with each other’s. In the second type, DROTHERs
will exchange routing information with DR and BDR. Routers which will exchange routing
information are known as adjacent. Relationship between two adjacent is known as adjacency.
This terminology is associated with interfaces.
A router which has two interfaces can be adjacent in one interface and DROTHER in other
interface. For example, Figure 20 illustrates an OSPF running NBMA network. In this
network, R3 will build adjacency with R1, so in this relationship they will be considered
as Adjacent. Now, R3 will not build adjacency with R4, so in this relationship they will be
considered only DROTHER.
Interestingly, from R1’s perspective, R2 is the BDR, and R3 is the DR. When a router is not the
DR or BDR, it’s called a DROTHER. Referring to the following neighbor tables, we can see
that R1 is a DROTHER. Besides, R2 (the BDR) sees the DR and DROTHER.
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.123.2 1 FULL/BDR 00:00:32 192.168.123.2 FastEthernet0/0
192.168.123.3 1 FULL/DR 00:00:31 192.168.123.3 FastEthernet0/0
In Figure 21 (f), we have two multi-access segments. Between R2 and R1, and between R2
and R3. For each segment, there will be a DR/BDR election.
It is good to mention that you change the priority if you like by using the ip ospf priority command
taking into account that the default priority is “1” and a priority of 0 means you will never be
elected as DR or BDR.
Figure 29 (a) shows a portion of R4 LSDB where each entry describes a certain LSA. Additionally,
the LSA header is shown in Figure 29 (b) along with necessary discussion of its fields.
G) OSPF Areas
a. Preliminaries
OSPF uses the concept of areas. An area is a logical grouping of contiguous networks and routers.
All routers in the same area have the same topology table, but they don’t know about routers in
the other areas. The main benefits of creating areas is that the size of the topology and the
routing table on a router is reduced, less time is required to run the SPF algorithm and
routing updates are also reduced.
Each area in the OSPF network has to connect to the backbone area (area 0). In other words,
the area 0 is mandatory in OSPF. All router inside an area must have the same area ID to become
OSPF neighbors. A router that has interfaces in more than one area (area 0 and area 1, for example)
is called Area Border Router (ABR). A router that connects an OSPF network to other routing
domains (EIGRP network, for example) is called Autonomous System Border Router (ASBR).
More details about OSPF areas and routers will be discussed shortly. To better understand the
concept of areas, consider the following example, which is illustrated in Figure 30. Particularly,
all routers are running OSPF. Routers R1 and R2 are inside the backbone area (area 0). Router R3
is an ABR, because it has interfaces in two areas, namely area 0 and area 1. Router R4 and R5 are
inside area 1. Router R6 is an ASBR, because it connects OSPF network to another routing domain
(an EIGRP domain in this case). If the R1’s directly connected subnet fails, router R1 sends the
routing update only to R2 and R3, because all routing updates all localized inside the area.
Important Tip: The ABR is the router that has interfaces in multiple OSPF areas (i.e., not
necessarily to have at least interface in area 0).
In a nutshell, there are three advantages of using OSPF areas. The first one related to the
capability of ABR. In particular, it is capable of summarizing all contiguous subnets of an
area, it belongs to, to send just one summarized LSA packet and this can happen in both
directions. The second one related also to ABR capability. As a matter of fact, it is able to
limit the propagation of link state updates into a confined section. In other words, it will
reduce the wide flooding of link state updates, thereby maintaining identical LSDB for just
every area (i.e., not for the whole network topology) which in turn does not waste bandwidth
and resources for recalculating the network map. Figure 33 (b) describes the first advantage
of OSPF areas. There is a question arises, does the ABR R3 care if there is a link failure in
subnet 172.16.3.0/24 taking into account that it already summarized these 8 contiguous
subnets into one subnet or network 172.16.0.0/20 (not /16). Certainly, no, bearing in mind
that the only way for area 2 to reach foreign areas is through this ABR (R3). The last
advantage related to the areas usage. In specific, the use of OSPF areas, which is identified
by having direct communications with just the backbone area (area 0) (i.e., not other areas),
prevents any potential loop and assures a loop free area topology.
Figure 33 (c): Virtual link connects area 7 to the backbone through area 5
In a nutshell, through OSPF virtual link, you connect an isolated OSPF area to the OSPF
backbone area 0, and you must configure Virtual links on ABRs.
In summary, there are three main steps:
Step 1: Identify an isolated area that needs to connect to area 0.
Step 2: Identify appropriate ABRs and make sure the above requirements are met.
Step 3: Configure under the OSPF process using the above command on both ABRs.
H) OSPF Metric Cost Calculation
In this part, we will show how SPF (Shortest Path First) algorithm calculates cumulative cost of
route to build the Shortest Path Tree (SPT) and how OSPF Metric Formula can be manipulated by
changing reference bandwidth value.
a. Shortest Path First (SPF) Algorithm
As we know upon initialization or due to any change in routing information an OSPF router
generates a LSA. This LSA contains the collection of all link-states on that router. Router
propagates this LSA in network. Each router that receives this LSA would store a copy of it in its
LSA database then flood this LSA to other routers. After database is updated, router selects a
single best route for each destination from all available routes. Router uses SPF algorithm
to select the best route. Just like other routing algorithm, SPF also uses a metric component
called cost to select the best route for routing table.
Reference bandwidth was defined as arbitrary value in OSPF documentation (RFC 2338).
Network vendors need to use their own reference bandwidth. Cisco uses 100Mbps (108)
bandwidth as reference bandwidth. With this bandwidth, our equation would be:
There are three examples, illustrated through Figures 34, 35, and 36, which detail well how the
OSPF link cost is calculated (kindly refer to equations (1) and (2)) and ultimately how the best
route is selected, which is certainly based on the least accumulated cost to the destined network.
Figure 34. OSPF Cost Calculation and Best Route Selection – Example 1
Figure 35. OSPF Cost Calculation and Best Route Selection – Example 2
Figure 36. OSPF Cost Calculation and Best Route Selection – Example 3
Part II: OSPF Configuration Commands
A. OSPF configuration commands for IPv4 (OSPFv2):
The Configuration of OSPF for IPV4 is a pretty simple and requires only two major steps:
1. Enabling the OSPF routing process on all routers by using the router OSPF
{process ID} command in the global configuration command. The process ID is a
positive number between 1 and 65535 and it’s locally significant, which means that it
does not have to match other OSPF routers in order to establish adjacencies with those
neighbors. We can run multiple OSPF process on same router. Process ID is used to
differentiate between them. Process ID need not to match on all routers. This command
does not directly start the OSPF process. Instead, it provides access to the router
configuration mode where the OSPF routing settings are configured. Routing updates
are not sent until OSPF is enabled using the network command in router configuration
mode for the directly connected networks.
Thus, Entering the network address for each directly connected network indicates that:
- Enabling OSPF on all interfaces that belong to a specific network.
- Associated interfaces will now both send and receive OSPF updates.
- Advertising the specified network (A.B.C.D) in OSPF routing updates sent to
other routers.
- The wild card mask is used in the network command to specify the interface or
range of interfaces that will be enabled for OSPF. Additionally, Wildcard mask
is used with network ID to filter the interfaces. Wildcard mask is different from
subnet mask. Subnet mask is used to separate the network portion and host
portion in IP address. While wildcard mask is used to match corresponding octet
in network portion. Wildcard mask tells OSPF the part of network address that
must be matched.
- 0 (Decimal–octet format) Wildcard mask indicates that corresponding octet in
network address must be matched exactly.
- 255 (Decimal–octet format) Wildcard mask indicates that we don’t care about
corresponding octet in network address.
- OSPF area ID: Third argument which network command accept is area number.
This parameter say router to put matched interface in specified area. All routers
inside an area must have the same area ID. When a single routing domain is
existed, the backbone area (Area 0) is used.
- Note that the OSPF process ID doesn’t have to be the same on all routers in
order for the routers to establish a neighbor relationship, but the area parameter
has to be the same on all neighboring routers in order for the routers to become
neighbors.
The first command is easy to comprehend, but the second command requires a little bit
more thought. With the network command you specify which interfaces will participate in
the routing process, the wild card mask, and the backbone area 0. Figure 2.1 shows the
directly connected networks in both R1 and R2.
R1(config)#router ospf 1
R1(config-router)#network 10.0.1.0 0.0.0.255 area 0
R1(config-router)#network 172.16.0.0 0.0.255.255 area 0
The configuration on R2 looks similar, but with different network number for the directly
connected subnet:
R2(config)#router ospf 1
R2(config-router)#network 192.168.0.0 0.0.0.255 area 0
R2(config-router)#network 172.16.0.0 0.0.255.255 area 0
The clear ip ospf process command is used to activate the RID on a router that is already
running OSPF:
Router#clear ip ospf process
The passive-interface command in the router mode allows a router to receive routing
updates on an interface but not send updates via that interface. In other words, Use the
passive-interface to prevent the transmission of routing messages through a LAN router
interface, but still allow that network to be advertised to other routers.
In real life environment clock rate parameter controls the data flow between serial links
and need to be set at service provider’s end. In lab environment we need not to worry about
this value. We can use any valid clock rate.
Router(config-if)#clock rate 64000
Priority value is 8 bits in length. Default priority value is 1. We can set any value from
range 0 to 255. We can change it from Interface Sub-configuration mode with ip
ospf priority command. Interestingly, we can force any router to become DR
(Highest) or BDR (Second highest) by changing its priority value. If we set priority value
to 0, it will never become DR or BDR.
Router(config-if)# ip ospf priority{ priority-
value}
For instance, to explain, how bandwidth influence route selection process we will configure
(64Kbps) bandwidth for any serial in the network topology.
Code Summary
O OSPF routes in the same area
O IA OSPF routes in other areas
O E1 Routes in non-OSPF domains (metric type 1)
O E2 Routes in non-OSPF domains (metric type 2)
S* The default route.
Means that there is a default route is distributed and
O* can be reached. The route source of this path is the
OSPF routing protocol.
14) show ip route Verifies the routing table, where O in the output indicates the
remote networks routes that discovered via OSPF updates. Also note that the
administrative distance of 110 is shown, together with the cost of 128.
Router#show ip route
O 192.168.10.8 [110/128] via 192.168.10.6, 14:27:57, Serial0/0/1
[110/128] via 192.168.10.2, 14:27:57, Serial0/0/0
For instance, the number 10 is the OSPF process ID, 0 is the area ID.
4. To configure the OSPFv3 network type use the ipv6 ospf network command in interface
configuration mode. To return to the default type, use the no form of this command.
Router(config-if)# ipv6 ospf network point-to-point
Router(config-if)# no ipv6 ospf network
A loopback interface is always enabled and therefore does not require a no shutdown
command. Multiple loopback interfaces can be enabled on a router. The IPv4 address for
each loopback interface must be unique and unused by any other interface.
6. Verifying OSPFv3: Commands used to verify the OSPV3 is the same command that are
used to verify the IPv4, but use ipv6 instead of ip in all commands, for instance, Figure 2.2
shows the show ipv6 route ospf command. Table 2.1 summarizes the OSPF Routing
protocol configuration commands.
Figure 2.2. Verify OSPFv3
Command Description
Router(config-if)# ipv6 ospf {process This command when executed in interface configuration mode enables
ID} area {area ID} OSPFv3 per specified process id and area id.
Router(config)#ipv6 router ospf This command when executed in global configuration mode places you
{process ID} into IPv6 OSPF (OSPFv3) router configuration mode where you can
configure the router-id, distribute list, default information options and
more.
Router(config-rtr)#router-id This command is executed in OSPFv3 router configuration mode to
A.B.C.D statically set a router-id. If you’re in a complete IPv6 network with no
IPv4 addresses assigned to any interface on a router you must have a
Router-ID assigned due to OSPF not being able to use the highest IPv4
address assigned to a logical or connected physical interface.
Router #show ipv6 ospf {process ID} This command when executed in user or privileged mode will display
current timers, router-id and reference bandwidth.
Router #show ipv6 ospf neighbor This command when executed in user or privileged mode displays
established neighbor relationships and their router type (DR,BDR,
DROTHER)
Router #show ipv6 ospf database This command when executed in user or privileged mode displays the
current OSPFv3 database contents including the sequence number.
Router #show ipv6 protocols This command displays the parameters about the state of any active IPv6
routing protocol processes configured on the router.
Router # show ipv6 route This command is used to examine the IPv6 routing table. OSPF for IPv6
routes are denoted in the routing table with a O.
Figure 2.3 . Network topology for OSPFv2 routing protocol without interface names
Now let we show you how to configure a virtual link. In the example above area 2 is not directly
connected to area 0 so we will have to use a virtual link between routers R1 and R2, as shown on
Figure 2.4. here is how we do it: we will start with a default OSPF configuration.
R1(config)#router ospf 1
R1(config-router)#network 1.1.1.0 0.0.0.255 area 0
R1(config-router)#network 192.168.12.0 0.0.0.255 area 1
R2(config)#router ospf 1
R2(config-router)#network 192.168.12.0 0.0.0.255 area 1
R2(config-router)#network 192.168.23.0 0.0.0.255 area 2
R3(config)#router ospf 1
R3(config-router)#network 192.168.23.0 0.0.0.255 area 2
R2(config)#router ospf 1
R2(config-router)#area 1 virtual-link 1.1.1.1
You will see the message below that tells us the virtual link is established correctly.
R1# %OSPF-5-ADJCHG Process 1, Nbr 192.168.23.2 on OSPF_VL0 from
LOADING to FULL, Loading Done
If you look at the LSDB you will see that the virtual link shows up as a type 1 router LSA.
You can also see DNA which means do not age.
R1#show ip ospf database
OSPF Router with ID (1.1.1.1) (Process ID 1)
hostname R2
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
interface FastEthernet1/0
ip address 192.168.23.2 255.255.255.0
!
router ospf 1
area 1 virtual-link 1.1.1.1
network 192.168.12.0 0.0.0.255 area 1
network 192.168.23.0 0.0.0.255 area 2
!
end
hostname R3
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
!
router ospf 1
network 192.168.23.0 0.0.0.255 area 2
!
end
4. If any router is connected to the Internet or ISP, we must add two extra commands,
4) Use the appropriate command to create a static default route on that router for all Internet
traffic to reach the network.
5) Advertise the default route configured in the previous step with other OSPF routers.
5. ISP router is configured with summarized static route and LAN static routes.
1) We have to configure unicast-routing on R1 and R2 so that routing protocols will work for
IPv6.
R1(config)#ipv6 unicast-routing
R2(config)#ipv6 unicast-routing
3) Then, we have to enable IPv6 on our interfaces and configure their IPv6 addresses as well.
R1(config)#interface G0/0/0
R1(config-if)#ipv6 enable
R1(config-if)#ipv6 address 2001:db8:0:20::1/64
R1(config)#int G0/0/1
R1(config-if)#ipv6 enable
R1(config-if)#ipv6 address 2001:db8:0:10::1/64
R2(config)#interface G0/0/0
R2(config-if)#ipv6 enable
R2(config-if)#ipv6 address 2001:db8:0:20::2/64
R2(config)#interface G0/0/1
R2(config-if)#ipv6 enable
R2(config-if)#ipv6 address 2001:db8:0:30::1/64
4) So that’s our basic configuration done. Now let’s enable OSPFv3 on our routers using
the ‘ipv6 router ospfv3 <process-id>’ command at the global configuration
mode. We also have to assign a router ID for the OSPF routing process if there are no IPv4
addresses configured on the router. The command to do this is ‘router-id <router-
id>’, and it is entered under the OSPF router configuration mode. The router ID resembles
an IPv4 address and it can have any value as long as it is unique within the OSPF domain.
R1(config)#ipv6 router ospf 1
R1(config-rtr)#router-id 1.1.1.1
R1(config-rtr)#exit
R2(config)#ipv6 router ospf 1
R2(config-rtr)#router-id 2.2.2.2
R2(config-rtr)#exit
5) Finally, we have to assign our interfaces to their corresponding OSPFv3 areas. Under the
interface configuration mode, enter the command ‘ipv6 ospf <process id> area
<area number>’. For our example, we will assign all interfaces into area 0.
R1(config)#interface range G0/0/0-1
R1(config-if)#ipv6 ospf 1 area 0
R1(config)#interface loopback 0
R1(config-if)#ipv6 ospf 1 area 0
R2(config)#interface range G0/0/0-1
R2(config-if)#ipv6 ospf 1 area 0
R2(config)#interface loopback 0
R2(config-if)#ipv6 ospf 1 area 0
2. IPv6 OSPFv3 Verification
1) To check the IPv6 addresses on the router, we can use the ‘show ipv6 interface
brief’ command.
R1#show ipv6 interface brief
GigabitEthernet0/0/0 [up/up]
FE80::5054:FF:FE0F:F10A
2001:DB8:0:20::1
GigabitEthernet0/0/1 [up/up]
FE80::5054:FF:FE0B:CEFB
2001:DB8:0:10::1
GigabitEthernet0/0/2 [administratively down/down]
unassigned
GigabitEthernet0/0/3 [administratively down/down]
unassigned
Loopback0 [up/up]
FE80::5054:FF:FE0F:F10A
2001::1
2) To view the OSPFv3 neighbor, we can use the command ‘show ipv6 ospf
neighbor.
R1#show ipv6 ospf neighbor
OSPFv3 Router with ID (1.1.1.1) (Process ID 1)
Neighbor ID Pri State Dead Time Interface ID
Interface
2.2.2.2 1 FULL/DR 00:00:38 2 GigabitEthernet0/0
O 2001::2/128 [110/1]
via FE80::5054:FF:FE10:8031, GigabitEthernet0/0
O 2001:DB8:0:30::/64 [110/2]
via FE80::5054:FF:FE10:8031, GigabitEthernet0/0
Important Note: Some parts of this handout have been collected from several trustable sites,
books, and published videos/slides and other parts have been prepared and written by the
instructors. As a matter of fact, this handout is made to be so straight forward, understandable, and
so attractive whereas the students can do the required activities and solve the problems in a
systematic and easy way, but still the instructors are expected to discuss some important material
during the labs’ sessions.