1. 每臺設(shè)備上配置接口以及環(huán)回口地址:
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
2. 每臺設(shè)備上配置ospf協(xié)議,并劃好區(qū)域:
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. 使用虛鏈路使區(qū)域2與區(qū)域-邏輯相連:
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
此時(shí)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. 優(yōu)先使用路徑R4-R3-R1,并以R4-R3-R2路徑為備份路徑:
R3:
interface GigabitEthernet0/0/2
ospf cost 10
R2:
interface GigabitEthernet0/0/2
ospf cost 10
5. 使用虛鏈路作為區(qū)域0鏈路的冗余備份
目前,R1與R2之間只有單條鏈路連接,如果出現(xiàn)鏈路故障,就會導(dǎo)致區(qū)域0被分割的問題。為了解決這一問題,增強(qiáng)網(wǎng)絡(luò)的可靠性,可以以區(qū)域1為傳輸區(qū)域,在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. 配置虛鏈路的認(rèn)證功能
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
#