拓扑图如下:
条件:
4台路由 AR1220
========================================================
AR-1配置:
<Huawei>system-view //进系统视图
[Huawei]sysname AR-1 //修改主机名
[AR-1]int g0/0/0 //进接口g0/0/0
[AR-1-GigabitEthernet0/0/0]ip address 192.168.14.1 24 //配置IP地址和子网掩码
[AR-1-GigabitEthernet0/0/0]int g0/0/1 //切换接口
[AR-1-GigabitEthernet0/0/0]ip address 192.168.14.1 24 //配置IP地址和子网掩码
启动OSPF如下命令:
[AR-1]ospf 1 router-id 1.1.1.1 //名称为1
[AR-1-ospf-1]area 0 //进入骨干区域0
[AR-1-ospf-1-area-0.0.0.0]network 192.168.14.0 0.0.0.255 //配置IP地址和反掩码
[AR-1-ospf-1-area-0.0.0.0]q //退到上一层
[AR-1-ospf-1]area 0.0.0.1 //进入非骨干区域0.0.0.1
[AR-1-ospf-1-area-0.0.0.1]network 192.168.12.0 0.0.0.255 //配置IP地址和反掩码
==================================================================================================
AR-2配置:
<Huawei>system-view //进系统视图
[Huawei]sysname AR-2 //修改主机名
[AR-2]int g0/0/0 //进g0/0/0接口
[AR-2-GigabitEthernet0/0/0]ip address 192.168.23.2 24 //配置IP地址和子网掩码
[AR-2-GigabitEthernet0/0/0]int g0/0/1 //切换接口
[AR-2-GigabitEthernet0/0/1]ip address 192.168.12.2 24 //配置IP地址和子网掩码
启动ospf如下命令:
[AR-2]ospf 1 router-id 2.2.2.2 //名称为2.2.2.2
[AR-2-ospf-1]area 0.0.0.1 //进入非骨干区域0.0.0.1
[AR-2-ospf-1-area-0.0.0.1]network 192.168.12.0 0.0.0.255 //配置IP地址和反掩码
[AR-2-ospf-1-area-0.0.0.1]q //退到上一层
[AR-2-ospf-1]area 0.0.0.2 //进入非骨干区域0.0.0.2
[AR-2-ospf-1-area-0.0.0.2]network 192.168.23.0 0.0.0.255 //配置IP地址和反掩码
===================================================================================================
AR-3配置:
<Huawei>system-view //进系统视图
[Huawei]sysname AR-3 //修改主机名
[AR-3]int g0/0/0 //进g0/0/0接口
[AR-3-GigabitEthernet0/0/0]ip address 192.168.23.3 24 //配置IP地址和子网掩码
启用ospf如下命令
[AR-3]ospf 1 router-id 3.3.3.3 //设置名称为:3.3.3.3
[AR-3-ospf-1]area 0.0.0.2 //进非骨干区域0.0.0.2
[AR-3-ospf-1-area-0.0.0.2]network 192.168.23.0 0.0.0.255 //配置IP地址和反掩码
====================================================================================================
AR-4配置:
<Huawei>system-view //进系统视图
[Huawei]sysname AR-4 //修改主机名
[AR-4]int g0/0/0 //进g0/0/0接口
[AR-4-GigabitEthernet0/0/0]ip address 192.168.14.4 24 //配置IP地址和子网掩码
启用ospf如下命令
[AR-4]ospf 1 router-id 4.4.4.4 //设置名称为 4.4.4.4
[AR-4-ospf-1]area 0.0.0.0 //进入骨干区域0.0.0.0
[AR-4-ospf-1-area-0.0.0.0]network 192.168.14.0 0.0.0.255 //配置IP地址和反掩码
===================================================================================================
穿越区域 1 ,创建虚链路,命令如下:
AR-1配置如下命令:
[AR-1]ospf 1 //进入进程为1的ID
AR-1-ospf-1]area 1 //进入区域1
[AR-1-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2 //创建虚链路为2.2.2.2
AR-2配置如下命令:
[AR-2]ospf 1 //进入进程为1的ID
[AR-2-ospf-1]area 1 //进入区域1
[AR-2-ospf-1-area-0.0.0.1]vlink-peer 1.1.1.1 //创建虚链路为1.1.1.1
===================================================================================================
验证如下:
<AR-3>ping 192.168.14.4
PING 192.168.14.4: 56 data bytes, press CTRL_C to break
Reply from 192.168.14.4: bytes=56 Sequence=1 ttl=253 time=50 ms
Reply from 192.168.14.4: bytes=56 Sequence=2 ttl=253 time=50 ms
Reply from 192.168.14.4: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 192.168.14.4: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 192.168.14.4: bytes=56 Sequence=5 ttl=253 time=30 ms
--- 192.168.14.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/40/50 ms
=============================================================================
<AR-4>ping 192.168.23.3
PING 192.168.23.3: 56 data bytes, press CTRL_C to break
Reply from 192.168.23.3: bytes=56 Sequence=1 ttl=253 time=60 ms
Reply from 192.168.23.3: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 192.168.23.3: bytes=56 Sequence=3 ttl=253 time=50 ms
Reply from 192.168.23.3: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 192.168.23.3: bytes=56 Sequence=5 ttl=253 time=40 ms
--- 192.168.23.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/44/60 ms
=============================================================================
[AR-2]dis ospf peer brief //查看ospf邻接关系表
OSPF Process 1 with Router ID 2.2.2.2
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.1 GigabitEthernet0/0/1 1.1.1.1 Full
0.0.0.2 GigabitEthernet0/0/0 3.3.3.3 Full
----------------------------------------------------------------------------
[AR-2]dis ospf vlink //查看ospf虚链路
OSPF Process 1 with Router ID 2.2.2.2
Virtual Links
Virtual-link Neighbor-id -> 1.1.1.1, Neighbor-State: Full
Interface: 192.168.12.2 (GigabitEthernet0/0/1)
Cost: 1 State: P-2-P Type: Virtual
Transit Area: 0.0.0.1
Timers: Hello 10 , Dead 40 , Retransmit 5 , Transmit Delay 1
GR State: Normal
==============================================================================
[AR-2]dis ospf brief
OSPF Process 1 with Router ID 2.2.2.2
OSPF Protocol Information
RouterID: 2.2.2.2 Border Router: AREA
Multi-VPN-Instance is not enabled
来源:CSDN
作者:qq_1412785173
链接:https://blog.csdn.net/qq_38936227/article/details/104564998