華爲路由器OSPF虛連接和驗證配置
適用於所有版本、所有形態的AR路由器。
一、組網需求
Area2沒有與Area0直接相連。Area1被用作傳輸區域(Transit Area)來連接Area2和Area0。RouterA和RouterB之間配置一條虛連接,配置完成後,RouterA能夠學到Area2中的路由。同時要求所有OSPF鄰居之間都要進行OSPF區域驗證,所有接口都要進行OSPF接口驗證。
配置OSPF虛連接組網圖
二、操作步驟
1.RouterA的配置
#
sysname RouterA
#
router id 1.1.1.1 //Router ID,建議配置爲LoopBack0的IP地址
#
interface GigabitEthernet1/0/0
ip address 192.168.1.2 255.255.255.0
ospf authentication-mode hmac-sha256 //配置OSPF接口的驗證模式爲hmac-sha256驗證
#
interface GigabitEthernet2/0/0
ip address 192.168.0.2 255.255.255.0
ospf authentication-mode hmac-sha256
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ospf 2
area 0.0.0.0
authentication-mode hmac-sha256 //配置OSPF區域的驗證模式爲hmac-sha256驗證
network 192.168.0.0 0.0.0.255 //指定運行OSPF 2協議的接口的IP地址位於192.168.0.0/24網段,接口所屬的區域爲area 0
area 0.0.0.1
authentication-mode hmac-sha256
network 192.168.1.0 0.0.0.255
vlink-peer 2.2.2.2 //創建對端路由器ID爲2.2.2.2的虛連接
#
2.RouterB的配置
#
sysname RouterB
#
router id 2.2.2.2
#
interface GigabitEthernet1/0/0
ip address 192.168.3.1 255.255.255.0
ospf authentication-mode hmac-sha256
#
interface GigabitEthernet2/0/0
ip address 192.168.1.1 255.255.255.0
ospf authentication-mode hmac-sha256
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
ospf 2
area 0.0.0.1
authentication-mode hmac-sha256
network 192.168.1.0 0.0.0.255
vlink-peer 1.1.1.1
area 0.0.0.2
authentication-mode hmac-sha256
network 192.168.3.0 0.0.0.255
#
3.驗證配置結果
# 在RouterA上執行命令display ip routing-table,會查看到路由表中有到192.168.3.0/24網段的OSPF路由信息。
三、配置注意事項
每個OSPF進程的Router ID要保證全網唯一,否則會導致鄰居不能正常建立、路由信息不正確的問題。使用OSPF區域驗證時,一個區域中所有的路由器在該區域下的驗證模式和口令必須一致。使用OSPF接口驗證時,同一網段的路由器接口下配置的驗證模式和口令必須一致。接口驗證方式優先級高於區域驗證方式。配置虛連接驗證時,兩端的路由器配置的驗證模式和口令必須一致。