Table of contents
Chapter 1 OSPF Protocol Features and Configuration
Experiment 1-2 OSPF multi-area
Step 1. Basic configuration and IP addressing
Step 2. Configure multi-area OSPF
Step 3. Configure route summarization between OSPF areas
Step 4. Modify the reference bandwidth value of OSPF
Step 5. Configure to summarize direct routes and import them into the OSPF area
Step 6. OSPF imports the default route
Step 7. Modify the priority of the two types of routes in OSPF
Additional Experiments: Think and Verify
Chapter 1 OSPF Protocol Features and Configuration
Experiment 1-2 OSPF Multi-Area
learning purpose
Master the method of specifying Router ID in OSPF configuration
Master the configuration method of multi-area OSPF
Master the configuration method of route summarization between OSPF areas
Master the configuration method of OSPF reference bandwidth
Master the configuration method of importing external routes by OSPF
Master the method of route summarization when OSPF imports external routes
Master the method of importing default routes to OSPF
Master the method of modifying the administrative distance of various routes in OSPF
Topology
Figure 1-2 OSPF multi-area
Scenes
You are the company's network administrator. Now there are five ARG3 routers in the company's network, among which R1, R2 and R4 are in the company's headquarters and interconnected through Ethernet. R3 and R5 are in the branch of the company. R3 is connected to R2 of the company headquarters through a dedicated line, and R5 and R3 are also connected through a dedicated line. Due to the large scale of the network, in order to control the flooding of LSAs, you have designed multi-area OSPF interconnection.
The Loopback0 interface and the interconnection interface of R2 and R3 belong to area 0; the network segment connecting R3 and R5, and the Loopback0/1/2 interface of R5 belong to area 1; the network segment connecting R1, R2 and R4, and the loopback0 interface of R1 and R4 belong to area 2.
At the same time, in order to specify the Router-ID of the device, you configure the device to use a fixed address as the Router ID.
In order to make routers more efficient in routing and forwarding, you configure automatic summarization at the border of the area.
Router R1 is connected to a network outside the company, and you configure routing information outside these OSPF areas to be imported into the OSPF area.
Router R4 is connected to the Internet. You need to configure a default route and import it into the OSPF area so that all routers in the OSPF area know how to access the Internet.
At the same time, internal routes and external routes are distinguished in OSPF routing information. You have modified the priority information of OSPF routing information to avoid potential risks.
The metric value of specific routing information in OSPF is obtained by accumulating the cost values of all links passed through to reach the destination network. The link cost is obtained by the router comparing the interface bandwidth with the reference bandwidth. The reference bandwidth value is 100 Mbps, the actual interface bandwidth may be 1000 Mbps, and the metric values are all integers, so the OSPF cost value of the Fast Ethernet interface and the Gigabit Ethernet interface are both 1. To be able to distinguish these links from each other, you define a reference bandwidth value of 10Gbps.
While configuring the device, some network failures occurred, which you troubleshoot by using the display and debug commands.
Learning tasks
Step 1. Basic configuration and IP addressing
Configure IP addresses and masks for all routers. When configuring, note that all loopback interface configuration masks are 24 bits, which is simulated as a separate network segment.
<R1>system-view
Enter system view, return user view with Ctrl+Z.
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.0.124.1 24
[R1-GigabitEthernet0/0/0]quit
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 10.0.1.1 24
[R1-LoopBack0]quit
[R1]interface LoopBack 1
[R1-LoopBack1]ip address 10.2.0.1 24
[R1-LoopBack1]quit
[R1]interface LoopBack 2
[R1-LoopBack2]ip address 10.2.1.1 24
[R1-LoopBack2]quit
<R2>system-view
Enter system view, return user view with Ctrl+Z.
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 10.0.124.2 24
[R2-GigabitEthernet0/0/0]quit
[R2]interface Serial 2/0/0
[R2-Serial2/0/0]ip address 10.0.23.2 24
[R2-Serial2/0/0]quit
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 10.0.2.2 24
[R2-LoopBack0]quit
<R3>system-view
Enter system view, return user view with Ctrl+Z.
[R3]interface Serial 2/0/0
[R3-Serial2/0/0]ip address 10.0.23.3 24
[R3-Serial2/0/0]quit
[R3]interface Serial 3/0/0
[R3-Serial3/0/0]ip address 10.0.35.3 24
[R3-Serial3/0/0]quit
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 10.0.3.3 24
<R4>system-view
Enter system view, return user view with Ctrl+Z.
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 10.0.124.4 24
[R4-GigabitEthernet0/0/0]quit
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 10.0.4.4 24
[R4-LoopBack0]quit
<R5>system-view
Enter system view, return user view with Ctrl+Z.
[R5]interface Serial 1/0/0
[R5-Serial1/0/0]ip address 10.0.35.5 24
[R5-Serial1/0/0]quit
[R5]interface LoopBack 0
[R5-LoopBack0]ip address 10.0.5.5 24
[R5-LoopBack0]quit
[R5]interface LoopBack 1
[R5-LoopBack1]ip address 10.1.0.1 24
[R5-LoopBack1]quit[R5]interface LoopBack 2
[R5-LoopBack2]ip address 10.1.1.1 24
[R5-LoopBack2]quit
After the configuration is complete, test the connectivity of the direct link.
[R2]ping -c 1 10.0.124.1
PING 10.0.124.1: 56 data bytes, press CTRL_C to break
Reply from 10.0.124.1: bytes=56 Sequence=1 ttl=255 time=5 ms
--- 10.0.124.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 5/5/5 ms
[R2]ping -c 1 10.0.124.4
PING 10.0.124.4: 56 data bytes, press CTRL_C to break
Reply from 10.0.124.4: bytes=56 Sequence=1 ttl=255 time=14 ms
--- 10.0.124.4 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 14/14/14 ms
[R2]ping -c 1 10.0.23.3
PING 10.0.23.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.23.3: bytes=56 Sequence=1 ttl=255 time=41 ms
--- 10.0.23.3 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 41/41/41 ms
[R3]ping -c 1 10.0.35.5
PING 10.0.35.5: 56 data bytes, press CTRL_C to break
Reply from 10.0.35.5: bytes=56 Sequence=1 ttl=255 time=38 ms
--- 10.0.35.5 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 38/38/38 ms
Step 2. Configure multi-area OSPF
To ensure the stability of the OSPF Router ID, we usually manually specify the Router ID of the router. There are two methods to manually specify the Router ID of a router running OSPF. The first method is to use the router id command in the system view .
[R1]router id 10.0.1.1
The second way is to add the parameter router-id when starting the OSPF process .
[R1]ospf 1 router-id 10.0.1.1
When these two commands are configured on the router at the same time, the router will finally select the value configured in the second way as the Router ID. If multiple OSPF processes need to be started on a router, and the Router ID of each OSPF process needs to be different, we can only use the second method to specify the Router ID.
Configure Loopback 0 interface and GigabitEthernet 0/0/0 on R1 to belong to area 2. Here we change the OSPF network type of the loopback interfaces in all OSPF areas to Broadcast so that OSPF can publish the real mask information of the loopback interfaces.
[R1]ospf 1 router-id 10.0.1.1
[R1-ospf-1]area 2
[R1-ospf-1-area-0.0.0.2]network 10.0.124.1 0.0.0.0
[R1-ospf-1-area-0.0.0.2]network 10.0.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.2]quit
[R1-ospf-1]quit
[R1]interface LoopBack 0
[R1-LoopBack0]ospf network-type broadcast
[R1-LoopBack0]quit
Configure Loopback 0 and Serial 2/0/0 interfaces on R2 to belong to area 0, and GigabitEthernet 0/0/0 to belong to area 2.
[R2]ospf 1 router-id 10.0.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 10.0.23.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 10.0.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]quit
[R2-ospf-1]area 2
[R2-ospf-1-area-0.0.0.2]network 10.0.124.2 0.0.0.0
[R2-ospf-1-area-0.0.0.2]quit
[R2-ospf-1]quit
[R2]interface LoopBack 0
[R2-LoopBack0]ospf network-type broadcast
[R2-LoopBack0]quit
On R3, configure Loopback 0 and Serial 2/0/0 to belong to area 0, and Serial 3/0/0 to belong to area 1.
[R3]ospf 1 router-id 10.0.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 10.0.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 10.0.23.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]quit
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 10.0.35.3 0.0.0.0
[R3-ospf-1-area-0.0.0.1]quit
[R3-ospf-1]quit
[R3]interface LoopBack 0
[R3-LoopBack0]ospf network-type broadcast
[R3-LoopBack0]quit
Configure Loopback 0 and GigabitEthernet 0/0/0 on R4 to belong to area 2.
[R4]ospf 1 router-id 10.0.4.4
[R4-ospf-1]area 2
[R4-ospf-1-area-0.0.0.2]network 10.0.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.2]network 10.0.124.4 0.0.0.0
[R4-ospf-1-area-0.0.0.2]quit
[R4-ospf-1]quit
[R4]interface LoopBack 0
[R4-LoopBack0]ospf network-type broadcast
[R4-LoopBack0]quit
Configure all loopback interfaces and Serial 1/0/0 on R5 to belong to area 1.
[R5]ospf 1 router-id 10.0.5.5
[R5-ospf-1]area 1
[R5-ospf-1-area-0.0.0.1]network 10.0.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.1]network 10.1.0.1 0.0.0.0
[R5-ospf-1-area-0.0.0.1]network 10.1.1.1 0.0.0.0
[R5-ospf-1-area-0.0.0.1]network 10.0.35.5 0.0.0.0
[R5-ospf-1-area-0.0.0.1]quit
[R5-ospf-1]quit
[R5]interface LoopBack 0
[R5-LoopBack0]ospf network-type broadcast
[R5-LoopBack0]quit
[R5]interface LoopBack 1
[R5-LoopBack1]ospf network-type broadcast
[R5-LoopBack1]quit
[R5]interface LoopBack 2
[R5-LoopBack2]ospf network-type broadcast
[R5-LoopBack2]quit
After the configuration is complete, check the routing table on R1.
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
---------------------------------------------------------------------------
Routing Tables: Public
Destinations : 24 Routes : 24
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 Direct 0 0 D 10.0.1.1 LoopBack0
10.0.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.2.0/24 OSPF 10 1 D 10.0.124.2 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 10 1563 D 10.0.124.2 GigabitEthernet0/0/0
10.0.4.0/24 OSPF 10 1 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 3125 D 10.0.124.2 GigabitEthernet0/0/0
10.0.23.0/24 OSPF 10 1563 D 10.0.124.2 GigabitEthernet0/0/0
10.0.35.0/24 OSPF 10 3125 D 10.0.124.2 GigabitEthernet0/0/0
10.0.124.0/24 Direct 0 0 D 10.0.124.1 GigabitEthernet0/0/0
10.0.124.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.124.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.1.0.0/24 OSPF 10 3125 D 10.0.124.2 GigabitEthernet0/0/0
10.1.1.0/24 OSPF 10 3125 D 10.0.124.2 GigabitEthernet0/0/0
10.2.0.0/24 Direct 0 0 D 10.2.0.1 LoopBack1
10.2.0.1/32 Direct 0 0 D 127.0.0.1 LoopBack1
10.2.0.255/32 Direct 0 0 D 127.0.0.1 LoopBack1
10.2.1.0/24 Direct 0 0 D 10.2.1.1 LoopBack2
10.2.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack2
10.2.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack2
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32Direct 0 0 D 127.0.0.1 InLoopBack0
This router already has all routing entries on the entire network.
Test the connectivity to the loopback interface of other routers on R1.
[R1]ping -c 1 10.0.2.2
PING 10.0.2.2: 56 data bytes, press CTRL_C to break
Reply from 10.0.2.2: bytes=56 Sequence=1 ttl=255 time=3 ms
--- 10.0.2.2 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 3/3/3 ms
[R1]ping -c 1 10.0.5.5
PING 10.0.5.5: 56 data bytes, press CTRL_C to break
Reply from 10.0.5.5: bytes=56 Sequence=1 ttl=253 time=88 ms
--- 10.0.5.5 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 88/88/88 ms
[R1]ping -c 1 10.0.4.4
PING 10.0.4.4: 56 data bytes, press CTRL_C to break
Reply from 10.0.4.4: bytes=56 Sequence=1 ttl=255 time=3 ms
--- 10.0.4.4 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 3/3/3 ms
We use the display ospf brief command to check the basic OSPF information running on the router on R2.
[R2]display ospf brief
OSPF Process 1 with Router ID 10.0.2.2
OSPF Protocol Information
RouterID: 10.0.2.2 Border Router: AREA
Multi-VPN-Instance is not enabled
Global DS-TE Mode: Non-Standard IETF Mode
Graceful-restart capability: disabled
Helper support capability : not configured
Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms
Default ASE parameters: Metric: 1 Tag: 1 Type: 2
Route Preference: 10
ASE Route Preference: 150
SPF Computation Count: 19
RFC 1583 Compatible
Retransmission limitation is disabled
Area Count: 2 Nssa Area Count: 0
ExChange/Loading Neighbors: 0
Area: 0.0.0.0 (MPLS TE not enabled)
Authtype: None Area flag: Normal
SPF scheduled Count: 18
ExChange/Loading Neighbors: 0
Router ID conflict state: Normal
Area interface up count: 2
Interface: 10.0.2.2 (LoopBack0)
Cost: 0 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 10.0.2.2
Backup Designated Router: 0.0.0.0
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 10.0.23.2 (Serial2/0/0) --> 10.0.23.3
Cost: 1562 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Area: 0.0.0.2 (MPLS TE not enabled)
Authtype: None Area flag: Normal
SPF scheduled Count: 16
ExChange/Loading Neighbors: 0
Router ID conflict state: Normal
Area interface up count: 1
Interface: 10.0.124.2 (GigabitEthernet0/0/0)
Cost: 1 State: BDR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 10.0.124.1
Backup Designated Router: 10.0.124.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
The first line Border Router: AREA indicates that the router is an ABR; if the router is an intra-area router, the value is empty; if the router is an ASBR, the value is AS.
The router has three interfaces participating in the OSPF operation. We have manually changed the network type of the Loopback 0 interface to Broadcast. The encapsulation type of Serial2/0/0 is PPP, so the default network type is point-to-point. In addition, GigabitEthernet 0/0/0 is connected to area 2, which is a broadcast network.
We run the display ospf peer brief command on R2 to view the establishment of the OSPF neighbor relationship of the router. It can be seen that in area 0, R2 has a neighbor 10.0.3.3, and in area 2, R2 has two neighbors: 10.0.1.1 and 10.0.4.4, and R2 forms an adjacency relationship (Full) with them.
[R2]display ospf peer brief
OSPF Process 1 with Router ID 10.0.2.2
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial2/0/0 10.0.3.3 Full
0.0.0.2 GigabitEthernet0/0/0 10.0.1.1 Full
0.0.0.2 GigabitEthernet0/0/0 10.0.4.4 Full
----------------------------------------------------------------------------
We run the display ospf lsdb command on R2 to check the OSPF database information of the router. We can find that since R2 is an ABR, two LSDBs are maintained on the router, which are used to describe the routes of area 0 and area 2 respectively.
[R2]display ospf lsdb
OSPF Process 1 with Router ID 10.0.2.2
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.0.3.3 10.0.3.3 788 60 80000008 0
Router 10.0.2.2 10.0.2.2 869 60 80000008 0
Sum-Net 10.0.35.0 10.0.3.3 846 28 80000002 1562
Sum-Net 10.0.124.0 10.0.2.2 1259 28 80000002 1
Sum-Net 10.0.1.0 10.0.2.2 143 28 80000001 1
Sum-Net 10.1.1.0 10.0.3.3 1565 28 80000001 1562
Sum-Net 10.0.5.0 10.0.3.3 1594 28 80000001 1562
Sum-Net 10.1.0.0 10.0.3.3 1584 28 80000001 1562
Sum-Net 10.0.4.0 10.0.2.2 538 28 80000002 1
Area: 0.0.0.2
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.0.4.4 10.0.4.4 504 48 80000008 1
Router 10.0.2.2 10.0.2.2 558 36 80000006 1
Router 10.0.1.1 10.0.1.1 568 60 80000011 1
Network 10.0.124.1 10.0.1.1 559 36 80000005 0
Sum-Net 10.0.35.0 10.0.2.2 846 28 80000002 3124
Sum-Net 10.0.3.0 10.0.2.2 830 28 80000002 1562
Sum-Net 10.0.2.0 10.0.2.2 1249 28 80000002 0
Sum-Net 10.1.1.0 10.0.2.2 1565 28 80000001 3124
Sum-Net 10.0.5.0 10.0.2.2 1595 28 80000001 3124
Sum-Net 10.1.0.0 10.0.2.2 1584 28 80000001 3124
Sum-Net 10.0.23.0 10.0.2.2 1261 28 80000002 1562
Step 3. Configure route summarization between OSPF areas
First check the OSPF routing tables of R2 and R3.
[R2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 7 Routes : 7
OSPF routing table status : <Active>
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 OSPF 10 1 D 10.0.124.1 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 10 1562 D 10.0.23.3 Serial2/0/0
10.0.4.0/24 OSPF 10 1 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 3124 D 10.0.23.3 Serial2/0/0
10.0.35.0/24 OSPF 10 3124 D 10.0.23.3 Serial2/0/0
10.1.0.0/24 OSPF 10 3124 D 10.0.23.3 Serial2/0/0
10.1.1.0/24 OSPF 10 3124 D 10.0.23.3 Serial2/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[R3]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 7 Routes : 7
OSPF routing table status : <Active>
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 OSPF 10 1563 D 10.0.23.2 Serial2/0/0
10.0.2.0/24 OSPF 10 1562 D 10.0.23.2 Serial2/0/0
10.0.4.0/24 OSPF 10 1563 D 10.0.23.2 Serial2/0/0
10.0.5.0/24 OSPF 10 1562 D 10.0.35.5 Serial3/0/0
10.0.124.0/24 OSPF 10 1563 D 10.0.23.2 Serial2/0/0
10.1.0.0/24 OSPF 10 1562 D 10.0.35.5 Serial3/0/0
10.1.1.0/24 OSPF 10 1562 D 10.0.35.5 Serial3/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
Both routing information of 10.1.0.0/24 and 10.1.1.0/24 appear as detailed entries.
Such routing information can be summarized and then sent to other areas. On the one hand, it reduces the routing table entries in other areas, and on the other hand, it can also reduce the occurrence of route flapping. We can use the abr-summary command on R3 to summarize and send the network segments of the Loopback1 and Loopback2 interfaces of R5.
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr-summary 10.1.0.0 255.255.254.0
[R3-ospf-1-area-0.0.0.1]quit
[R3-ospf-1]quit
After the configuration is complete, check the summary routing information on R3 and R2 respectively.
[R3]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 7 Routes : 7
OSPF routing table status : <Active>
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 OSPF 10 1563 D 10.0.23.2 Serial2/0/0
10.0.2.0/24 OSPF 10 1562 D 10.0.23.2 Serial2/0/0
10.0.4.0/24 OSPF 10 1563 D 10.0.23.2 Serial2/0/0
10.0.5.0/24 OSPF 10 1562 D 10.0.35.5 Serial3/0/0
10.0.124.0/24 OSPF 10 1563 D 10.0.23.2 Serial2/0/0
10.1.0.0/24 OSPF 10 1562 D 10.0.35.5 Serial3/0/0
10.1.1.0/24 OSPF 10 1562 D 10.0.35.5 Serial3/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[R2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 6 Routes : 6
OSPF routing table status : <Active>
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 OSPF 10 1 D 10.0.124.1 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 10 1562 D 10.0.23.3 Serial2/0/0
10.0.4.0/24 OSPF 10 1 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 3124 D 10.0.23.3 Serial2/0/0
10.0.35.0/24 OSPF 10 3124 D 10.0.23.3 Serial2/0/0
10.1.0.0/23 OSPF 10 3124 D 10.0.23.3 Serial2/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
From the output, we can see that in the routing table of R3, these two routes still appear as detailed routes, but on R2, only the summary route 10.1.0.0/23 exists.
After the configuration is complete, test the connectivity between other routers and networks 10.1.0.0/24 and 10.1.1.0/24.
[R1]ping -c 1 10.1.0.1
PING 10.1.0.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.0.1: bytes=56 Sequence=1 ttl=253 time=66 ms
--- 10.1.0.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 66/66/66 ms
[R1]ping -c 1 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=253 time=66 ms
--- 10.1.1.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 66/66/66 ms
[R2]ping -c 1 10.1.0.1
PING 10.1.0.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.0.1: bytes=56 Sequence=1 ttl=254 time=69 ms
--- 10.1.0.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 69/69/69 ms
[R3]ping -c 1 10.1.0.1
PING 10.1.0.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.0.1: bytes=56 Sequence=1 ttl=255 time=29 ms
--- 10.1.0.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 29/29/29 ms
Step 4. Modify the reference bandwidth value of OSPF
In the actual network, we may use Gigabit or even 10 Gigabit Ethernet. However, because the default reference bandwidth value of OSPF is 100 Mbps, and the interface cost value is only an integer, OSPF cannot distinguish between 100M Ethernet and 1000M Ethernet in terms of bandwidth.
Change the reference bandwidth value of OSPF on R2 to 10 Gbps. Here, use the command bandwidth-reference to modify, and the unit of the corresponding bandwidth parameter value is Mbps.
[R2-ospf-1]bandwidth-reference 10000
Checking the OSPF neighbor relationship and routing information learning on R2, we can see that the Cost value in the routing table has changed.
[R2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 7 Routes : 7
OSPF routing table status : <Active>
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.3.0/24 OSPF 10 65535 D 10.0.23.3 Serial2/0/0
10.0.4.0/24 OSPF 10 10 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 67097 D 10.0.23.3 Serial2/0/0
10.0.35.0/24 OSPF 10 67097 D 10.0.23.3 Serial2/0/0
10.1.0.0/23 OSPF 10 67097 D 10.0.23.3 Serial2/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
In multiple areas where OSPF runs, the reference bandwidth of OSPF must be the same; otherwise, OSPF cannot work normally. Modify the OSPF reference bandwidth value of all routers to 10Gbps.
[R1]ospf 1
[R1-ospf-1]bandwidth-reference 10000
[R1-ospf-1]quit
[R2]ospf 1
[R2-ospf-1]bandwidth-reference 10000
[R2-ospf-1]quit
[R3]ospf 1
[R3-ospf-1]bandwidth-reference 10000
[R3-ospf-1]quit
[R4]ospf 1
[R4-ospf-1]bandwidth-reference 10000
[R4-ospf-1]quit
[R5]ospf 1
[R5-ospf-1]bandwidth-reference 10000
[R5-ospf-1]quit
Check the neighbor list and routing table on R2 to see whether the OSPF neighbor relationship and routing information are normal.
[R2]display ospf peer brief
OSPF Process 1 with Router ID 10.0.2.2
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial2/0/0 10.0.3.3 Full
0.0.0.2 GigabitEthernet0/0/0 10.0.1.1 Full
0.0.0.2 GigabitEthernet0/0/0 10.0.4.4 Full
----------------------------------------------------------------------------
[R2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 6 Routes : 6
OSPF routing table status : <Active>
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 OSPF 10 100 D 10.0.124.1 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 10 65535 D 10.0.23.3 Serial2/0/0
10.0.4.0/24 OSPF 10 100 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.0.35.0/24 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.1.0.0/23 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
As shown above, the routing information is OK. In addition, the connectivity of the network can be tested.
Step 5. Configure to summarize direct routes and import them into the OSPF area
Loopback1 and Loopback2 interfaces on R1 do not belong to the OSPF area. Import the two direct routes into the OSPF area, and perform route summary on R1.
[R1]ospf 1
[R1-ospf-1]import-route direct
[R1-ospf-1]asbr-summary 10.2.0.0 255.255.254.0
[R1-ospf-1]quit
Check the external routing information on R1.
[R1]display ospf lsdb ase 10.2.0.0
OSPF Process 1 with Router ID 10.0.1.1
Link State Database
Type : External
Ls id : 10.2.0.0
Adv rtr : 10.0.1.1
Ls age : 293
Len : 36
Options : E
seq# : 80000001
chksum : 0x2b6
Net mask : 255.255.254.0
TOS 0 Metric: 2
E type : 2
Forwarding Address : 0.0.0.0
Tag : 1
Priority : Low
R1 advertises the network segment 10.2.0.0 to other routers through a Type 5 LSA, and the subnet mask is 255.255.254.0.
View summarized routes on other routers and test network connectivity.
[R2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 7 Routes : 7
OSPF routing table status : <Active>
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 O_ASE 150 100 D 10.0.124.1 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 10 65535 D 10.0.23.3 Serial2/0/0
10.0.4.0/24 OSPF 10 100 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.0.35.0/24 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.1.0.0/23 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.2.0.0/23 O_ASE 150 2 D 10.0.124.1 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[R2]ping -c 1 10.2.0.1
PING 10.2.0.1: 56 data bytes, press CTRL_C to break
Reply from 10.2.0.1: bytes=56 Sequence=1 ttl=255 time=2 ms
--- 10.2.0.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/2/2 ms
[R2]ping -c 1 10.2.1.1
PING 10.2.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.2.1.1: bytes=56 Sequence=1 ttl=255 time=2 ms
--- 10.2.1.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/2/2 ms
You can see a summary route with a mask of 23 bits on R2.
Delete the Loopback 2 interface of R1, and check the changes of routing entries on R2. We can see that when the Loopback 2 interface no longer exists, the summary route still exists.
[R1]undo interface LoopBack 2
[R2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 7 Routes : 7
OSPF routing table status : <Active>
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 ospf 150 100 D 10.0.124.1 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 10 65535 D 10.0.23.3 Serial2/0/0
10.0.4.0/24 OSPF 10 100 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.0.35.0/24 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.1.0.0/23 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.2.0.0/23 O_ASE 150 2 D 10.0.124.1 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
Send a Tracert packet to the 10.2.1.1 address on the R5 device.
<R5>tracert 10.2.1.1
traceroute to 10.2.1.1(10.2.1.1), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.0.35.3 62 ms 28 ms 27 ms
2 10.0.23.2 54 ms 58 ms 57 ms
3 * * *
...
We can see that although the Loopback 2 interface is deleted, the data packet arriving at the destination address is still forwarded by R2 and R3 until the data packet is discarded on R1.
Step 6. OSPF imports the default route
The Loopback0 interface of R4 is connected to the Internet. Configure a default route on R4, with the next hop pointing to Loopback0.
[R4]ip route-static 0.0.0.0 0.0.0.0 LoopBack 0
Import this default route to the OSPF area, define the type as 1, and define the cost as 10, and define it as a permanent import.
[R4]ospf 1
[R4-ospf-1]default-route-advertise always type 1
[R4-ospf-1]quit
Check the learning status of the default route on R2. We can see that R2 has learned a default route through the fifth type LSA, and the next hop is the interface address of R4.
[R2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 8 Routes : 8
OSPF routing table status : <Active>
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 101 D 10.0.124.4 GigabitEthernet0/0/0
10.0.1.0/24 ospf 10 100 D 10.0.124.1 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 10 65535 D 10.0.23.3 Serial2/0/0
10.0.4.0/24 OSPF 10 100 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.0.35.0/24 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.1.0.0/23 OSPF 10 131070 D 10.0.23.3 Serial2/0/0
10.2.0.0/23 O_ASE 150 2 D 10.0.124.1 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
Finally, test the connectivity between the R5 router and 10.0.4.4.
[R5]ping -c 1 10.0.4.4
PING 10.0.4.4: 56 data bytes, press CTRL_C to break
Reply from 10.0.4.4: bytes=56 Sequence=1 ttl=253 time=78 ms
--- 10.0.4.4 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/78/78 ms
Step 7. Modify the priority of the two types of routes in OSPF
Check the routing table of R1, and pay attention to the priority information of different types of OSPF routes.
[R1]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 8 Routes : 8
OSPF routing table status : <Active>
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 101 D 10.0.124.4 GigabitEthernet0/0/0
10.0.2.0/24 OSPF 10 100 D 10.0.124.2 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 10 65635 D 10.0.124.2 GigabitEthernet0/0/0
10.0.4.0/24 OSPF 10 100 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 10 131170 D 10.0.124.2 GigabitEthernet0/0/0
10.0.23.0/24 OSPF 10 65635 D 10.0.124.2 GigabitEthernet0/0/0
10.0.35.0/24 OSPF 10 131170 D 10.0.124.2 GigabitEthernet0/0/0
10.1.0.0/23 OSPF 10 131170 D 10.0.124.2 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
By default, the OSPF intra-area and inter-area routes have a priority of 10. OSPF external route with priority 150.
Change the priority of OSPF intra-area and inter-area routes on routers R1 and R4 to 20, and change the priority of OSPF external routes to 50.
[R1]ospf 1
[R1-ospf-1]preference 20
[R1-ospf-1]preference ase 50
[R1-ospf-1]quit
[R4]ospf 1
[R4-ospf-1]preference 20
[R4-ospf-1]preference ase 50
[R4-ospf-1]quit
Check the priorities of OSPF internal routes and external routes in the routing table to confirm that they have been modified successfully.
[R1]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
----------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 8 Routes : 8
OSPF routing table status : <Active>
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 50 101 D 10.0.124.4 GigabitEthernet0/0/0
10.0.2.0/24 OSPF 20 100 D 10.0.124.2 GigabitEthernet0/0/0
10.0.3.0/24 OSPF 20 65545 D 10.0.124.2 GigabitEthernet0/0/0
10.0.4.0/24 OSPF 20 100 D 10.0.124.4 GigabitEthernet0/0/0
10.0.5.0/24 OSPF 20 131170 D 10.0.124.2 GigabitEthernet0/0/0
10.0.23.0/24 OSPF 20 65635 D 10.0.124.2 GigabitEthernet0/0/0
10.0.35.0/24 OSPF 20 131170 D 10.0.124.2 GigabitEthernet0/0/0
10.1.0.0/23 OSPF 20 131170 D 10.0.124.2 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
Route priority is valid only locally and is used to measure the optimality of routes learned locally through multiple methods. Different routers in the local area can work fine if the priority information is different.
Additional Experiments : Think and Verify
Consider in step 6, what is the function of defining the permanent release of the default route? What are the pros and cons?
Route summarization is like a double-edged sword, which has advantages and disadvantages. Think and summarize the advantages and disadvantages of using route summarization, and analyze how to avoid these disadvantages.
final device configuration
<R1>display current-configuration
[V200R007C00SPC600]
#
sysname R1
#
interface GigabitEthernet0/0/0
ip address 10.0.124.1 255.255.255.0
#
interface LoopBack0
ip address 10.0.1.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 10.2.0.1 255.255.255.0
#
ospf 1 router-id 10.0.1.1
asbr-summary 10.2.0.0 255.255.254.0
import-route direct
preference 20
preference ase 50
bandwidth-reference 10000
area 0.0.0.2
network 10.0.1.1 0.0.0.0
network 10.0.124.1 0.0.0.0
#
return
<R2>display current-configuration
[V200R007C00SPC600]
#
sysname R2
#
interface Serial2/0/0
link-protocol ppp
ip address 10.0.23.2 255.255.255.0
#
interface GigabitEthernet0/0/0
ip address 10.0.124.2 255.255.255.0
#
interface LoopBack0
ip address 10.0.2.2 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 10.0.2.2
bandwidth-reference 10000
area 0.0.0.0
network 10.0.2.2 0.0.0.0
network 10.0.23.2 0.0.0.0
area 0.0.0.2
network 10.0.124.2 0.0.0.0
#
return
<R3>display current-configuration
[V200R007C00SPC600]
#
sysname R3
#
interface Serial2/0/0
link-protocol ppp
ip address 10.0.23.3 255.255.255.0
#
interface Serial3/0/0
link-protocol ppp
ip address 10.0.35.3 255.255.255.0
#
interface LoopBack0
ip address 10.0.3.3 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 10.0.3.3
bandwidth-reference 10000
area 0.0.0.0
network 10.0.3.3 0.0.0.0
network 10.0.23.3 0.0.0.0
area 0.0.0.1
abr-summary 10.1.0.0 255.255.254.0
network 10.0.35.3 0.0.0.0
#
return
<R4>display current-configuration
[V200R007C00SPC600]
#
sysname R4
#
interface GigabitEthernet0/0/0
ip address 10.0.124.4 255.255.255.0
#
interface LoopBack0
ip address 10.0.4.4 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 10.0.4.4
default-route-advertise always type 1
preference 20
preference ase 50
bandwidth-reference 10000
area 0.0.0.2
network 10.0.4.4 0.0.0.0
network 10.0.124.4 0.0.0.0
#
ip route-static 0.0.0.0 0.0.0.0 LoopBack0
#
return
<R5>display current-configuration
[V200R007C00SPC600]
#
sysname R5
#
interface Serial1/0/0
link-protocol ppp
ip address 10.0.35.5 255.255.255.0
#
interface LoopBack0
ip address 10.0.5.5 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 10.1.0.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack2
ip address 10.1.1.1 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 10.0.5.5
bandwidth-reference 10000
area 0.0.0.1
network 10.0.5.5 0.0.0.0
network 10.1.0.1 0.0.0.0
network 10.1.1.1 0.0.0.0
network 10.0.35.5 0.0.0.0
#
return