实验介绍

辅助理解OSPF的特殊区域。

实验目的

  • 探索不同区域对于能接收到的明细路由的影响。

拓扑结构

接口信息

路由器

接口

IP Address/Mask

协议

区域/进程号

路由器类型

R1

GE 0/0/0

10.1.1.1/24

ISIS

1

R2

GE 0/0/0

10.1.1.2/24

ISIS

1

GE 0/0/1

20.1.1.1/24

OSPF

Area 1

ASBR

R3

GE 0/0/0

20.1.1.2/24

OSPF

Area 1

ABR

GE 0/0/1

30.1.1.1/24

OSPF

Area 0

ABR

R4

GE 0/0/0

30.1.1.2/24

OSPF

Area 0

ABR

GE 0/0/1

40.1.1.1/24

OSPF

Area 2

ABR

R5

GE 0/0/0

40.1.1.2/24

OSPF

Area 2

ABR

GE 0/0/1

50.1.1.1/24

OSPF

Area 3

ABR

R6

GE 0/0/0

50.1.1.2/24

OSPF

Area 3

ASBR

GE 0/0/1

60.1.1.1/24

ISIS

1

R7

GE 0/0/0

60.1.1.2/24

ISIS

1

实验步骤

步骤一:配置基本信息

以R2举例,其他配置类似

配置IP地址

[R2-GigabitEthernet0/0/0]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 10.1.1.2 255.255.255.0
#
return
[R2-GigabitEthernet0/0/1]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/1
 ip address 20.1.1.1 255.255.255.0
#
return

步骤二:配置OSPF以及ISIS

OSPF

配置OSPF

同一个路由器OSPF有多区域时,是在同一个OSPF进程下配置。

以R3为例

[R3-ospf-1]dis th
[V200R003C00]
#
ospf 1 router-id 3.3.3.3
 area 0.0.0.0
  network 30.1.1.0 0.0.0.255
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
#
return
查看邻居
[R2-ospf-1]dis ospf peer

         OSPF Process 1 with Router ID 2.2.2.2
                 Neighbors

 Area 0.0.0.1 interface 20.1.1.1(GigabitEthernet0/0/1)'s neighbors
 Router ID: 3.3.3.3          Address: 20.1.1.2
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 20.1.1.1  BDR: 20.1.1.2  MTU: 0
   Dead timer due in 35  sec
   Retrans timer interval: 5
   Neighbor is up for 00:08:45
   Authentication Sequence: [ 0 ]

引入ISIS
[R2-ospf-1]dis th
[V200R003C00]
#
ospf 1 router-id 2.2.2.2
 import-route isis 1
 area 0.0.0.1
  network 20.1.1.1 0.0.0.0
#
return
引入前

R3学习不到R1的路由

[R3]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 1        Routes : 1

OSPF routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       40.1.1.0/24  OSPF    10   2           D   30.1.1.2        GigabitEthernet0/0/1

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
引入后

可见R3学习到了R1的路由

[R3]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 2        Routes : 2

OSPF routing table status : <Active>
         Destinations : 2        Routes : 2

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.1.1.0/24  O_ASE   150  1           D   20.1.1.1        GigabitEthernet0/0/0
       40.1.1.0/24  OSPF    10   2           D   30.1.1.2        GigabitEthernet0/0/1

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
Area 3需要做VLink与Area 0相连

需要链路穿过Area 2,故进入Area 2配置

[R4-ospf-1-area-0.0.0.2]dis th
[V200R003C00]
#
 area 0.0.0.2
  network 40.1.1.0 0.0.0.255
  vlink-peer 5.5.5.5
#
return
[R5-ospf-1-area-0.0.0.2]dis th
[V200R003C00]
#
 area 0.0.0.2
  network 40.1.1.2 0.0.0.0
  vlink-peer 4.4.4.4
#
return

VLink下的两个路由器建立连接跳过了2-Way阶段,原因是早已确定主从关系了

Oct  1 2025 21:36:44-08:00 R4 %%01OSPF/4/VLINK_NBR_CHG_E(l)[13]:Virtual link peer event: neighbor status changed. (ProcessId=256, VirtualLinkNeighborAddress=5.5.5.5, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[R4-ospf-1-area-0.0.0.2]
Oct  1 2025 21:36:44-08:00 R4 %%01OSPF/4/VLINK_NBR_CHG_E(l)[14]:Virtual link peer event: neighbor status changed. (ProcessId=256, VirtualLinkNeighborAddress=5.5.5.5, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=ExStart)
[R4-ospf-1-area-0.0.0.2]
Oct  1 2025 21:36:44-08:00 R4 %%01OSPF/4/VLINK_NBR_CHG_E(l)[15]:Virtual link peer event: neighbor status changed. (ProcessId=256, VirtualLinkNeighborAddress=5.5.5.5, NeighborEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchange)
[R4-ospf-1-area-0.0.0.2]
Oct  1 2025 21:36:44-08:00 R4 %%01OSPF/4/VLINK_NBR_CHG_E(l)[16]:Virtual link peer event: neighbor status changed. (ProcessId=256, VirtualLinkNeighborAddress=5.5.5.5, NeighborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading)
[R4-ospf-1-area-0.0.0.2]
Oct  1 2025 21:36:44-08:00 R4 %%01OSPF/4/VLINK_NBR_CHG_E(l)[17]:Virtual link peer event: neighbor status changed. (ProcessId=256, VirtualLinkNeighborAddress=5.5.5.5, NeighborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
VLink建立前

此时的R6学习不到OSPF的路由

[R6-ospf-1]dis ip routing-table protocol ospf
[R6-ospf-1]
VLink建立后

此时的R6学习到了其他路由器的路由

[R6-ospf-1]dis ip rou p ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 4        Routes : 4

OSPF routing table status : <Active>
         Destinations : 4        Routes : 4

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.1.1.0/24  O_ASE   150  1           D   50.1.1.1        GigabitEthernet0/0/0
       20.1.1.0/24  OSPF    10   4           D   50.1.1.1        GigabitEthernet0/0/0
       30.1.1.0/24  OSPF    10   3           D   50.1.1.1        GigabitEthernet0/0/0
       40.1.1.0/24  OSPF    10   2           D   50.1.1.1        GigabitEthernet0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
R6的GE 0/0/0接口抓包观察

ISIS

配置ISIS
[R2-isis-1]dis th
[V200R003C00]
#
isis 1
 is-level level-2
 network-entity 49.0001.0020.0000.0002.00
#
return
接口使能ISIS
[R2-GigabitEthernet0/0/0]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 10.1.1.2 255.255.255.0
 isis enable 1
#
return
查看邻居
[R2-GigabitEthernet0/0/0]dis isis peer

                          Peer information for ISIS(1)

  System Id     Interface          Circuit Id       State HoldTime Type     PRI
-------------------------------------------------------------------------------
0010.0000.0001  GE0/0/0            0020.0000.0002.01 Up   26s      L2       64

Total Peer(s): 1
引入OSPF
[R2-isis-1]dis th
[V200R003C00]
#
isis 1
 is-level level-2
 network-entity 49.0001.0020.0000.0002.00
 import-route ospf 1
#
return
引入前

R1学习不到其他路由器的路由

[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 8

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.1.1.0/24  Direct  0    0           D   10.1.1.1        GigabitEthernet0/0/0
       10.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     10.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
引入后

可见R1学习到了其他路由器的路由

[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.1.1.0/24  Direct  0    0           D   10.1.1.1        GigabitEthernet0/0/0
       10.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     10.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       20.1.1.0/24  ISIS-L2 15   74          D   10.1.1.2        GigabitEthernet0/0/0
       30.1.1.0/24  ISIS-L2 15   74          D   10.1.1.2        GigabitEthernet0/0/0
       40.1.1.0/24  ISIS-L2 15   74          D   10.1.1.2        GigabitEthernet0/0/0
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

步骤三:验证

此时,所有路由器的路由表都已包含完整的拓扑明细路由,彼此之间实现了通信。

R2路由表

[R2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 15

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.1.1.0/24  Direct  0    0           D   10.1.1.2        GigabitEthernet0/0/0
       10.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     10.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       20.1.1.0/24  Direct  0    0           D   20.1.1.1        GigabitEthernet0/0/1
       20.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     20.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
       30.1.1.0/24  OSPF    10   2           D   20.1.1.2        GigabitEthernet0/0/1
       40.1.1.0/24  OSPF    10   3           D   20.1.1.2        GigabitEthernet0/0/1
       50.1.1.0/24  OSPF    10   4           D   20.1.1.2        GigabitEthernet0/0/1
       60.1.1.0/24  O_ASE   150  1           D   20.1.1.2        GigabitEthernet0/0/1
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

R3路由表

[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 15

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.1.1.0/24  O_ASE   150  1           D   20.1.1.1        GigabitEthernet0/0/0
       20.1.1.0/24  Direct  0    0           D   20.1.1.2        GigabitEthernet0/0/0
       20.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     20.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       30.1.1.0/24  Direct  0    0           D   30.1.1.1        GigabitEthernet0/0/1
       30.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     30.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
       40.1.1.0/24  OSPF    10   2           D   30.1.1.2        GigabitEthernet0/0/1
       50.1.1.0/24  OSPF    10   3           D   30.1.1.2        GigabitEthernet0/0/1
       60.1.1.0/24  O_ASE   150  1           D   30.1.1.2        GigabitEthernet0/0/1
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

R1路由表

[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.1.1.0/24  Direct  0    0           D   10.1.1.1        GigabitEthernet0/0/0
       10.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     10.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       20.1.1.0/24  ISIS-L2 15   74          D   10.1.1.2        GigabitEthernet0/0/0
       30.1.1.0/24  ISIS-L2 15   74          D   10.1.1.2        GigabitEthernet0/0/0
       40.1.1.0/24  ISIS-L2 15   74          D   10.1.1.2        GigabitEthernet0/0/0
       50.1.1.0/24  ISIS-L2 15   74          D   10.1.1.2        GigabitEthernet0/0/0
       60.1.1.0/24  ISIS-L2 15   74          D   10.1.1.2        GigabitEthernet0/0/0
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

R7路由表

[R7]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        7.7.7.7/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.1.1.0/24  ISIS-L2 15   74          D   60.1.1.1        GigabitEthernet0/0/0
       20.1.1.0/24  ISIS-L2 15   74          D   60.1.1.1        GigabitEthernet0/0/0
       30.1.1.0/24  ISIS-L2 15   74          D   60.1.1.1        GigabitEthernet0/0/0
       40.1.1.0/24  ISIS-L2 15   74          D   60.1.1.1        GigabitEthernet0/0/0
       50.1.1.0/24  ISIS-L2 15   74          D   60.1.1.1        GigabitEthernet0/0/0
       60.1.1.0/24  Direct  0    0           D   60.1.1.2        GigabitEthernet0/0/0
       60.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     60.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

用R1通信R7

[R1]tracert -a 10.1.1.1 60.1.1.2
 traceroute to  60.1.1.2(60.1.1.2), max hops: 30 ,packet length: 40,press CTRL_C to break
 1 10.1.1.2 20 ms  20 ms  20 ms
 2 20.1.1.2 30 ms  20 ms  20 ms
 3 30.1.1.2 20 ms  30 ms  40 ms
 4 40.1.1.2 40 ms  30 ms  30 ms
 5 50.1.1.2 40 ms  50 ms  40 ms
 6 60.1.1.2 40 ms  50 ms  50 ms

途经5个路由器,故ttl值为250

[R1]ping -a 10.1.1.1 60.1.1.2
  PING 60.1.1.2: 56  data bytes, press CTRL_C to break
    Reply from 60.1.1.2: bytes=56 Sequence=1 ttl=250 time=80 ms
    Reply from 60.1.1.2: bytes=56 Sequence=2 ttl=250 time=40 ms
    Reply from 60.1.1.2: bytes=56 Sequence=3 ttl=250 time=50 ms
    Reply from 60.1.1.2: bytes=56 Sequence=4 ttl=250 time=70 ms
    Reply from 60.1.1.2: bytes=56 Sequence=5 ttl=250 time=60 ms

  --- 60.1.1.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/60/80 ms

步骤三:配置特殊区域并验证

把R2变为内部路由

[R2-GigabitEthernet0/0/0]int g 0/0/0
[R2-GigabitEthernet0/0/0]shu
[R2-GigabitEthernet0/0/0]shutdown
Oct  1 2025 22:06:07-08:00 R2 %%01IFPDT/4/IF_STATE(l)[9]:Interface GigabitEthernet0/0/0 has turned into DOWN state.
[R2-GigabitEthernet0/0/0]
[R2-GigabitEthernet0/0/0]
Oct  1 2025 22:06:07-08:00 R2 %%01IFNET/4/LINK_STATE(l)[10]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the DOWN state.
[R2-GigabitEthernet0/0/0]
Oct  1 2025 22:06:07-08:00 R2 %%01ISIS/4/ADJ_CHANGE_LEVEL(l)[11]:The neighbor of ISIS was changed. (IsisProcessId=256, Neighbor=0010.0000.0001, InterfaceName=GE0/0/0, CurrentState=down, ChangeType=L2_CIRCUIT_DOWN, Level=Level-2)
[R2-GigabitEthernet0/0/0]
Oct  1 2025 22:06:07-08:00 R2 %%01ISIS/4/PEER_DOWN_CIRC_DOWN(l)[12]:ISIS 256 neighbor 0010.0000.0001 was Down because interface GE0/0/0 was down. The Hello packet was received at 22:02:22 last time; the maximum interval for sending Hello packets was 3657891840; the local router sent 3557425152 Hello packets and received 100663296 packets; the type of the Hello packet was Lan Level-2.

此时的R2为标准区域

学习本区域的内部路由、学习域间路由、学习外部路由。

R2路由表
[R2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 12       Routes : 12

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
       20.1.1.0/24  Direct  0    0           D   20.1.1.1        GigabitEthernet0/0/1
       20.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     20.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
       30.1.1.0/24  OSPF    10   2           D   20.1.1.2        GigabitEthernet0/0/1
       40.1.1.0/24  OSPF    10   3           D   20.1.1.2        GigabitEthernet0/0/1
       50.1.1.0/24  OSPF    10   4           D   20.1.1.2        GigabitEthernet0/0/1
       60.1.1.0/24  O_ASE   150  1           D   20.1.1.2        GigabitEthernet0/0/1
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

将Area 1变为Stub区域

学习本区域的内部路由、学习域间路由,不学习外部路由,不包含 ASBR, 与外部通讯完全依靠自动创建的缺省路由。

[R2-ospf-1-area-0.0.0.1]dis th
[V200R003C00]
#
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
  stub
#
return
[R3-ospf-1-area-0.0.0.1]dis th
[V200R003C00]
#
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
  stub
#
return
改变后

可见学习不到R6引入的外部路由了,但是多了一条缺省路由

[R2-ospf-1-area-0.0.0.1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 12       Routes : 12

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   20.1.1.2        GigabitEthernet0/0/1
        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
       20.1.1.0/24  Direct  0    0           D   20.1.1.1        GigabitEthernet0/0/1
       20.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     20.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
       30.1.1.0/24  OSPF    10   2           D   20.1.1.2        GigabitEthernet0/0/1
       40.1.1.0/24  OSPF    10   3           D   20.1.1.2        GigabitEthernet0/0/1
       50.1.1.0/24  OSPF    10   4           D   20.1.1.2        GigabitEthernet0/0/1
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
测试与R7通信

通信正常

[R2]ping -a 20.1.1.1 60.1.1.2
  PING 60.1.1.2: 56  data bytes, press CTRL_C to break
    Reply from 60.1.1.2: bytes=56 Sequence=1 ttl=251 time=50 ms
    Reply from 60.1.1.2: bytes=56 Sequence=2 ttl=251 time=40 ms
    Reply from 60.1.1.2: bytes=56 Sequence=3 ttl=251 time=50 ms
    Reply from 60.1.1.2: bytes=56 Sequence=4 ttl=251 time=40 ms
    Reply from 60.1.1.2: bytes=56 Sequence=5 ttl=251 time=70 ms

  --- 60.1.1.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/50/70 ms

将Area 1变为Totally Stubby区域

仅学习本区域内部路由,不学习外部路由,不学习域间路由,与外部通讯完全依靠自动创建的缺省路由

[R2-ospf-1-area-0.0.0.1]dis th
[V200R003C00]
#
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
  stub no-summary
#
return
[R3-ospf-1-area-0.0.0.1]dis th
[V200R003C00]
#
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
  stub no-summary
#
return
改变后

可见完全学习不到其他路由器的明细路由了,仅有一条缺省路由

[R2-ospf-1-area-0.0.0.1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 9        Routes : 9

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   20.1.1.2        GigabitEthernet0/0/1
        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
       20.1.1.0/24  Direct  0    0           D   20.1.1.1        GigabitEthernet0/0/1
       20.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     20.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
测试与R7通信

通信正常

[R2-ospf-1-area-0.0.0.1]ping -a 20.1.1.1 60.1.1.2
  PING 60.1.1.2: 56  data bytes, press CTRL_C to break
    Reply from 60.1.1.2: bytes=56 Sequence=1 ttl=251 time=40 ms
    Reply from 60.1.1.2: bytes=56 Sequence=2 ttl=251 time=60 ms
    Reply from 60.1.1.2: bytes=56 Sequence=3 ttl=251 time=60 ms
    Reply from 60.1.1.2: bytes=56 Sequence=4 ttl=251 time=50 ms
    Reply from 60.1.1.2: bytes=56 Sequence=5 ttl=251 time=70 ms

  --- 60.1.1.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/56/70 ms

将Area 1变为NSSA区域

学习域内路由,学习域间路由,学习本区域自身引入的外部路由

在R1上新建网段,观察是否能被引入

[R1-LoopBack0]dis th
[V200R003C00]
#
interface LoopBack0
 ip address 172.16.1.1 255.255.255.0
 isis enable 1
#
return
[R2-GigabitEthernet0/0/0]undo shutdown
[R2-GigabitEthernet0/0/0]
Oct  1 2025 22:30:24-08:00 R2 %%01IFPDT/4/IF_STATE(l)[44]:Interface GigabitEthernet0/0/0 has turned into UP state.
[R2-GigabitEthernet0/0/0]
Oct  1 2025 22:30:24-08:00 R2 %%01IFNET/4/LINK_STATE(l)[45]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]
Oct  1 2025 22:30:24-08:00 R2 %%01ISIS/4/ADJ_CHANGE_LEVEL(l)[46]:The neighbor of ISIS was changed. (IsisProcessId=256, Neighbor=0010.0000.0001, InterfaceName=GE0/0/0, CurrentState=up, ChangeType=NEW_L2_ADJ, Level=Level-2)
[R2-ospf-1-area-0.0.0.1]dis th
[V200R003C00]
#
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
  nssa
#
return
[R3-ospf-1-area-0.0.0.1]dis th
[V200R003C00]
#
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
  nssa
#
return
改变后

可见除了R6引入的路由学不到,其余的都能学习

[R2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 16       Routes : 16

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   O_NSSA  150  1           D   20.1.1.2        GigabitEthernet0/0/1
        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
       10.1.1.0/24  Direct  0    0           D   10.1.1.2        GigabitEthernet0/0/0
       10.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     10.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       20.1.1.0/24  Direct  0    0           D   20.1.1.1        GigabitEthernet0/0/1
       20.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     20.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
       30.1.1.0/24  OSPF    10   2           D   20.1.1.2        GigabitEthernet0/0/1
       40.1.1.0/24  OSPF    10   3           D   20.1.1.2        GigabitEthernet0/0/1
       50.1.1.0/24  OSPF    10   4           D   20.1.1.2        GigabitEthernet0/0/1
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
     172.16.1.0/24  ISIS-L2 15   10          D   10.1.1.1        GigabitEthernet0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
测试与R7通信

通信正常

[R2]ping -a 20.1.1.1 60.1.1.2
  PING 60.1.1.2: 56  data bytes, press CTRL_C to break
    Reply from 60.1.1.2: bytes=56 Sequence=1 ttl=251 time=60 ms
    Reply from 60.1.1.2: bytes=56 Sequence=2 ttl=251 time=40 ms
    Reply from 60.1.1.2: bytes=56 Sequence=3 ttl=251 time=50 ms
    Reply from 60.1.1.2: bytes=56 Sequence=4 ttl=251 time=40 ms
    Reply from 60.1.1.2: bytes=56 Sequence=5 ttl=251 time=50 ms

  --- 60.1.1.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/48/60 ms

将Area 1变为Totally NSSA区域

学习域内路由,学习本区域自身引入的外部路由,不学习域间路由,不学习其它区域引入的外部路由

[R2-ospf-1-area-0.0.0.1]dis th
[V200R003C00]
#
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
  nssa no-import-route
#
return
[R3-ospf-1-area-0.0.0.1]dis th
[V200R003C00]
#
 area 0.0.0.1
  network 20.1.1.0 0.0.0.255
  nssa no-import-route
#
return
改变后
[R3-ospf-1-area-0.0.0.1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 14       Routes : 14

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   20.1.1.2        GigabitEthernet0/0/1
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
       20.1.1.0/24  Direct  0    0           D   20.1.1.2        GigabitEthernet0/0/0
       20.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     20.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       30.1.1.0/24  Direct  0    0           D   30.1.1.1        GigabitEthernet0/0/1
       30.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     30.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
      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/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
测试与R7通信

通信正常

[R2-ospf-1-area-0.0.0.1]ping -a 20.1.1.1 60.1.1.2
  PING 60.1.1.2: 56  data bytes, press CTRL_C to break
    Reply from 60.1.1.2: bytes=56 Sequence=1 ttl=251 time=40 ms
    Reply from 60.1.1.2: bytes=56 Sequence=2 ttl=251 time=60 ms
    Reply from 60.1.1.2: bytes=56 Sequence=3 ttl=251 time=60 ms
    Reply from 60.1.1.2: bytes=56 Sequence=4 ttl=251 time=50 ms
    Reply from 60.1.1.2: bytes=56 Sequence=5 ttl=251 time=40 ms

  --- 60.1.1.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/50/60 ms

总结

R2通过ABR下发的缺省路由与其他路由器(如R7)进行通信,而其他路由器(如R7)与R2之间的通信则采用明细路由方式。