Lab 1-1 Single-Area OSPF
Lab 1-1 Single-Area OSPF
Learning Objectives
The objectives of this lab are to learn and understand how to perform the following
operations:
HUAWEI TECHNOLOGIES 10
HCIP-IERS Chapter 2 OSPF Features and Configurations
Topology
Scenario
Assume that you are a network administrator of a company that has three ARG3
routers. These routers are interconnected over the Ethernet. A broadcast
multi-access network, such as Ethernet, has security threats. Therefore, OSPF area
authentication is required to prevent malicious route attacks. A network connectivity
failure occurs during network deployment. You can run the display and debug
commands for fault location.
Tasks
Configure IP addresses and masks for R1, R2, and R3. Set a 24-bit mask for loopback
interfaces to simulate an independent network segment.
<R1>system-view
HUAWEI TECHNOLOGIES 11
HCIP-IERS Chapter 2 OSPF Features and Configurations
[R1-GigabitEthernet0/0/0]quit
[R1]interface LoopBack 0
[R1-LoopBack0]quit
<R2>system-view
[R2-GigabitEthernet0/0/0]quit
[R2]interface LoopBack 0
[R2-LoopBack0]quit
<R3>system-view
[R3-GigabitEthernet0/0/0]quit
[R3]interface LoopBack 0
[R3-LoopBack0]quit
[R1]ping -c 1 10.0.123.2
HUAWEI TECHNOLOGIES 12
HCIP-IERS Chapter 2 OSPF Features and Configurations
1 packet(s) transmitted
1 packet(s) received
[R1]ping -c 1 10.0.123.3
1 packet(s) transmitted
1 packet(s) received
[R2]ping -c 1 10.0.123.3
1 packet(s) transmitted
1 packet(s) received
HUAWEI TECHNOLOGIES 13
HCIP-IERS Chapter 2 OSPF Features and Configurations
Configure single-area OSPF and deploy all routers in area 0. Configure OSPF process
1. In addition, configure area authentication and set the password to huawei. In an
OSPF area, Huawei devices support plain text or MD5 authentication. Plain text
authentication is used for this step.
Set the wildcard subnet mask to 0.0.0.0 when you use the network command. To
ensure the stability of Router IDs, they are usually specified manually as.
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]quit
[R1-ospf-1]quit
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]quit
[R2-ospf-1]quit
[R3-ospf-1]area 0
HUAWEI TECHNOLOGIES 14
HCIP-IERS Chapter 2 OSPF Features and Configurations
[R3-ospf-1-area-0.0.0.0]quit
[R3-ospf-1]quit
View the routing tables and test the connectivity of the entire network.
[R1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
HUAWEI TECHNOLOGIES 15
HCIP-IERS Chapter 2 OSPF Features and Configurations
The command output shows that R1 learns two routes from OSPF: 10.0.2.2/32 and
10.0.3.3/32. The next hops of the two routes are 10.0.123.2 and 10.0.123.3
respectively.
[R1]ping -c 1 10.0.2.2
1 packet(s) transmitted
1 packet(s) received
[R1]ping -c 1 10.0.3.3
1 packet(s) transmitted
1 packet(s) received
Run the display ospf brief command to view basic OSPF information on R1.
HUAWEI TECHNOLOGIES 16
HCIP-IERS Chapter 2 OSPF Features and Configurations
Route Preference: 10
ExChange/Loading Neighbors: 0
ExChange/Loading Neighbors: 0
HUAWEI TECHNOLOGIES 17
HCIP-IERS Chapter 2 OSPF Features and Configurations
Priority: 1
Run the display ospf peer brief command on R1 to check information about OSPF
neighbor relationships between the routers.
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Total Peer(s): 2
The preceding command output shows that R1 has two neighbors in Area 0.0.0.0,
their router IDs are 10.0.2.2 and 10.0.3.3 respectively, and their OSPF neighbor
relationships are in Full state.
HUAWEI TECHNOLOGIES 18
HCIP-IERS Chapter 2 OSPF Features and Configurations
Run the display ospf lsdb command on R1 to check OSPF LSDB information.
Area: 0.0.0.0
The preceding command output shows that the LSDB contains four LSAs, the first
three of which are Type 1 LSAs generated by R1, R2, and R3 respectively. You can
check the AdvRouter field to determine which router generates an LSA. The fourth
LSA is a Type 2 LSA, which is generated by a DR of a network segment. Because R1 is
the DR of the network segment 10.0.123.0/24, you can see that the AdvRouter field
of this LSA is 10.0.1.1.
Area: 0.0.0.0
Type : Router
Ls id : 10.0.1.1
Ls age : 430
HUAWEI TECHNOLOGIES 19
HCIP-IERS Chapter 2 OSPF Features and Configurations
Len : 48
Options : E
seq# : 80000009
chksum : 0x8188
Link count: 2
Data : 255.255.255.255
Metric : 0
Priority : Medium
* Link ID : 10.0.123.1
Data : 10.0.123.1
Metric :1
The preceding command output shows detailed information about the Router LSA
generated by R1. This LSA describes two networks. The first network is the network
segment where the loopback interface resides. The Link Type field displays StubNet,
and Link ID and Data fields indicate the IP address and mask of this stub network
segment. The second network is the network segment that connects the three
routers. The Link Type displays TransNet, the Link ID field displays 10.0.123.1, which
is the interface address of the DR, and the Data field displays 10.0.123.1, which is the
local interface address on the network segment.
Area: 0.0.0.0
HUAWEI TECHNOLOGIES 20
HCIP-IERS Chapter 2 OSPF Features and Configurations
Type : Network
Ls id : 10.0.123.1
Ls age : 1662
Len : 36
Options : E
seq# : 80000005
chksum : 0x3d58
Priority : Low
The preceding command output shows detailed information about the Network LSA
generated by R1. This Type 2 LSA describes neighbor information on the network
segment where the DR resides.
Check DR and BDR election on the network segment 10.0.123.0/24 and analyze
whether the results of tests performed by different candidates are the same.
According to the following command output, the interface IP address of the DR on
this network segment is 10.0.123.1, and that of the BDR on this network segment is
10.0.123.2.
HUAWEI TECHNOLOGIES 21
HCIP-IERS Chapter 2 OSPF Features and Configurations
Neighbors
Authentication Sequence: [ 0 ]
Authentication Sequence: [ 0 ]
After the DR fails, the BDR becomes the new DR. You can reset an OSPF process to
observe the DR role change. The following example resets the OSPF process of R1.
HUAWEI TECHNOLOGIES 22
HCIP-IERS Chapter 2 OSPF Features and Configurations
Neighbors
Authentication Sequence: [ 0 ]
Authentication Sequence: [ 0 ]
After the OSPF process of R1 is reset, the BDR 10.0.123.2 becomes the new DR, and
the DR other 10.0.123.3 becomes the new BDR.
Shut down G0/0/0 of R1, R2, and R3 and run the debugging ospf 1 event command
to check the OSPF neighbor relationship establishment process. Undoshutdown
G0/0/0 of R1, R2, and R3 simultaneously, and observe neighbor status change and
DR and BDR election on the broadcast multi-access network.
HUAWEI TECHNOLOGIES 23
HCIP-IERS Chapter 2 OSPF Features and Configurations
<R1>terminal debugging
[R1-GigabitEthernet0/0/0]shut
[R1-GigabitEthernet0/0/0]undo shut
<R2>terminal debugging
[R2-GigabitEthernet0/0/0]shut
[R2-GigabitEthernet0/0/0]undo shut
<R3>terminal debugging
[R3-GigabitEthernet0/0/0]shutdown
[R3-GigabitEthernet0/0/0]undo shutdown
Perform the same operations on R2 and R3 and check debugging information on R3.
The default interface priority of all routers is 1. Therefore, router IDs of the three
routers are compared during DR election. Among the three routers, R3 has the
largest router ID and becomes the DR of the network segment.
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
HUAWEI TECHNOLOGIES 24
HCIP-IERS Chapter 2 OSPF Features and Configurations
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
HUAWEI TECHNOLOGIES 25
HCIP-IERS Chapter 2 OSPF Features and Configurations
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]
HUAWEI TECHNOLOGIES 26
HCIP-IERS Chapter 2 OSPF Features and Configurations
When G0/0/0 is just enabled, the interface state changes from Down to Waiting.
Then routers start exchanging Hello packets. After 40 seconds, the status of G0/0/0
on R3 changes from Waiting to DR.
Check the IP routing table of R1 and focus on the two routes 10.0.2.2/32 and
10.0.3.3/32.
[R1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
HUAWEI TECHNOLOGIES 27
HCIP-IERS Chapter 2 OSPF Features and Configurations
During the configuration of IP addresses for loopback interfaces of R2 and R3, the
24-bit mask is used. Analyze why the IP routing table of R1 displays routes with the
32-bit mask.
Run the display ospf interface LoopBack 0 verbose command to check the OSPF
running status of Loopback0.
Interfaces
IO Statistics
Hello 0 0
DB Description 0 0
Link-State Req 0 0
Link-State Update 0 0
Link-State Ack 0 0
ALLSPF GROUP
OSPF knows that the network segment where Loopback0 resides can have only one
IP address. Therefore the subnet mask of the advertised route is 32 bits.
HUAWEI TECHNOLOGIES 28
HCIP-IERS Chapter 2 OSPF Features and Configurations
[R2]interface LoopBack 0
You can see that the subnet mask of the route to Loopback0 address advertised by
R2 is 24 bits.
[R1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
HUAWEI TECHNOLOGIES 29
HCIP-IERS Chapter 2 OSPF Features and Configurations
Run the display ospf interface LoopBack 0 verbose command to check the OSPF
running status of Loopback0. The command output shows that the network type of
Loopback0 is broadcast.
Interfaces
Priority: 1
IO Statistics
Hello 0 0
DB Description 0 0
Link-State Req 0 0
Link-State Update 0 0
Link-State Ack 0 0
ALLSPF GROUP
ALLDR GROUP
Check the cost of the route from R1 to Loopback0 of R3. You can see that the cost of
the route to 10.0.3.3/32 is 1.
HUAWEI TECHNOLOGIES 30
HCIP-IERS Chapter 2 OSPF Features and Configurations
[R1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
[R1-GigabitEthernet0/0/0]ospf cost 20
[R1-GigabitEthernet0/0/0]quit
[R3-GigabitEthernet0/0/0]ospf cost 10
HUAWEI TECHNOLOGIES 31
HCIP-IERS Chapter 2 OSPF Features and Configurations
[R3-GigabitEthernet0/0/0]quit
Check the cost of the route from R1 to Loopback0 of R3 again. You can see that the
cost of the route to 10.0.3.3/32 is 20.
[R1]display ip routing-table
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
On R3, check the cost of the route to 10.0.1.1/32. You can see that the cost is 10.
[R3]display ip routing-table
HUAWEI TECHNOLOGIES 32
HCIP-IERS Chapter 2 OSPF Features and Configurations
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
[R1]ospf 1
[R1-ospf-1]quit
[R1]display ip routing-table
HUAWEI TECHNOLOGIES 33
HCIP-IERS Chapter 2 OSPF Features and Configurations
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
Check the neighbor list of R1. You can see that OSPF neighbor relationships between
R1 and R2 and between R1 and R3 disapear. After a RIP interface is configured as a
silent interface, this interface does not send RIP updates. In OSPF, routers can
exchange routing information only after they establish an OSPF neighbor
relationship. After an OSPF interface is configured as a silent interface, this interface
does not receive or send Hello packets. As a result, this interface cannot establish
OSPF neighbor relationships with interfaces of other routers.
Interfaces
HUAWEI TECHNOLOGIES 34
HCIP-IERS Chapter 2 OSPF Features and Configurations
Priority: 1
Restore G0/0/0 of R1 to the default state and configure Loopback0 of the three
routes as silent interfaces.
[R1]ospf 1
[R1-ospf-1]silent-interface LoopBack 0
[R1-ospf-1]quit
[R2]ospf 1
[R2-ospf-1]silent-interface LoopBack 0
[R1-ospf-1]quit
[R3]ospf 1
[R3-ospf-1]silent-interface LoopBack 0
[R1-ospf-1]quit
Check the IP routing table of R1. The command output shows that configuring
Loopback0 as a silent interface does not affect its route advertisement.
[R1]display ip routing-table
HUAWEI TECHNOLOGIES 35
HCIP-IERS Chapter 2 OSPF Features and Configurations
----------------------------------------------------------------------------
Destinations : 12 Routes : 12
----End
Analyze why the wildcard mask 0.0.0.0 is used in OSPF configuration? The wildcard
mask 0.0.0.255 can also be used in actual configuration, what are the differences of
the two wildcard masks?
Device Configurations
<R1>display current-configuration
HUAWEI TECHNOLOGIES 36
HCIP-IERS Chapter 2 OSPF Features and Configurations
[V200R007C00SPC600]
sysname R1
interface GigabitEthernet0/0/0
ospf cost 20
interface LoopBack0
silent-interface LoopBack0
area 0.0.0.0
return
<R2>display current-configuration
[V200R007C00SPC600]
sysname R2
interface GigabitEthernet0/0/0
interface LoopBack0
HUAWEI TECHNOLOGIES 37
HCIP-IERS Chapter 2 OSPF Features and Configurations
silent-interface LoopBack0
area 0.0.0.0
return
<R3>display current-configuration
[V200R007C00SPC600]
sysname R3
interface GigabitEthernet0/0/0
ospf cost 10
interface LoopBack0
silent-interface LoopBack0
area 0.0.0.0
HUAWEI TECHNOLOGIES 38
HCIP-IERS Chapter 2 OSPF Features and Configurations
return
HUAWEI TECHNOLOGIES 39