R1:
interface GigabitEthernet0/0/0
ip address 10.0.12.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.1 255.255.255.0
#
interface LoopBack0
ip address 10.0.1.1 255.255.255.255
R2:
interface GigabitEthernet0/0/0
ip address 10.0.12.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.0.23.2 255.255.255.0
#
interface LoopBack0
ip address 10.0.2.2 255.255.255.255
R3:
interface GigabitEthernet0/0/0
ip address 10.0.34.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.3 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.0.23.3 255.255.255.0
#
interface LoopBack0
ip address 10.0.3.3 255.255.255.255
R4:
interface GigabitEthernet0/0/0
ip address 10.0.34.4 255.255.255.0
#
interface LoopBack0
ip address 10.0.4.4 255.255.255.255
R1:
ospf 1 router-id 10.0.1.1
area 0.0.0.0
network 10.0.12.0 0.0.0.255
network 10.0.1.1 0.0.0.0
area 0.0.0.1
network 10.0.13.0 0.0.0.255
R2:
ospf 1 router-id 10.0.2.2
area 0.0.0.0
network 10.0.2.2 0.0.0.0
network 10.0.12.0 0.0.0.255
area 0.0.0.1
network 10.0.23.0 0.0.0.255
R3:
ospf 1 router-id 10.0.3.3
area 0.0.0.1
network 10.0.3.3 0.0.0.0
network 10.0.23.0 0.0.0.255
network 10.0.13.0 0.0.0.255
area 0.0.0.2
network 10.0.34.0 0.0.0.255
R4:
ospf 1 router-id 10.0.4.4
area 0.0.0.2
network 10.0.4.4 0.0.0.0
network 10.0.34.0 0.0.0.255
3. 使用虚链路使区域2与区域-逻辑相连:
R1:
ospf 1
area 0.0.0.1
vlink-peer 10.0.3.3
R2:
ospf 1
area 0.0.0.1
vlink-peer 10.0.3.3
R3:
ospf 1
area 0.0.0.1
vlink-peer 10.0.2.2
vlink-peer 10.0.1.1
此时R1、R2能ping通R4
[R1]ping 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=254 time=40 ms
Reply from 10.0.4.4: bytes=56 Sequence=2 ttl=254 time=40 ms
4. 优先使用路径R4-R3-R1,并以R4-R3-R2路径为备份路径:
R3:
interface GigabitEthernet0/0/2
ospf cost 10
R2:
interface GigabitEthernet0/0/2
ospf cost 10
5. 使用虚链路作为区域0链路的冗余备份
目前,R1与R2之间只有单条链路连接,如果出现链路故障,就会导致区域0被分割的问题。为了解决这一问题,增强网络的可靠性,可以以区域1为传输区域,在R1与R2之间建立–条虚链路作为冗余备份。
R1:
ospf 1
area 0.0.0.1
vlink-peer 10.0.1.1
R2:
ospf 1
area 0.0.0.1
vlink-peer 10.0.2.2
6. 配置虚链路的认证功能
R1:
ospf 1
area 0.0.0.1
vlink-peer 10.0.3.3 hmac-md5 1 plain huawei
vlink-peer 10.0.2.2 hmac-md5 1 plain huawei
R2:
ospf 1
area 0.0.0.1
vlink-peer 10.0.1.1 hmac-md5 1 plain huawei
vlink-peer 10.0.3.3 hmac-md5 1 plain huawei
R3:
ospf 1
area 0.0.0.1
vlink-peer 10.0.1.1 hmac-md5 1 plain huawei
vlink-peer 10.0.2.2 hmac-md5 1 plain huawei
最终配置:
R1:
sysname R1
#
interface GigabitEthernet0/0/0
ip address 10.0.12.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.1 255.255.255.0
#
interface LoopBack0
ip address 10.0.1.1 255.255.255.255
#
ospf 1 router-id 10.0.1.1
area 0.0.0.0
network 10.0.12.0 0.0.0.255
network 10.0.1.1 0.0.0.0
area 0.0.0.1
network 10.0.13.0 0.0.0.255
vlink-peer 10.0.3.3 hmac-md5 1 plain huawei
vlink-peer 10.0.2.2 hmac-md5 1 plain huawei
#
R2:
sysname R2
#
interface GigabitEthernet0/0/0
ip address 10.0.12.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.0.23.2 255.255.255.0
ospf cost 10
#
interface LoopBack0
ip address 10.0.2.2 255.255.255.255
#
ospf 1 router-id 10.0.2.2
area 0.0.0.0
network 10.0.2.2 0.0.0.0
network 10.0.12.0 0.0.0.255
area 0.0.0.1
network 10.0.23.0 0.0.0.255
vlink-peer 10.0.1.1 hmac-md5 1 plain huawei
vlink-peer 10.0.3.3 hmac-md5 1 plain huawei
#
R3:
sysname R3
#
interface GigabitEthernet0/0/0
ip address 10.0.34.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.3 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.0.23.3 255.255.255.0
ospf cost 10
#
interface LoopBack0
ip address 10.0.3.3 255.255.255.255
#
ospf 1 router-id 10.0.3.3
area 0.0.0.1
network 10.0.3.3 0.0.0.0
network 10.0.23.0 0.0.0.255
network 10.0.13.0 0.0.0.255
vlink-peer 10.0.1.1 hmac-md5 1 plain huawei
vlink-peer 10.0.2.2 hmac-md5 1 plain huawei
area 0.0.0.2
network 10.0.34.0 0.0.0.255
#
R4:
sysname R4
#
interface GigabitEthernet0/0/0
ip address 10.0.34.4 255.255.255.0
#
interface LoopBack0
ip address 10.0.4.4 255.255.255.255
#
ospf 1 router-id 10.0.4.4
area 0.0.0.2
network 10.0.4.4 0.0.0.0
network 10.0.34.0 0.0.0.255
#