開放最短路徑優先(OSPF)自治系統中的所有區域必須物理連線到主幹區域(區域0)。 但是,在無法進行此物理連線的情況下,您可以使用虛擬鏈路通過非主幹區域連線到主幹。您還可以使用虛擬鏈路通過非主幹區域連線分割槽主幹的兩個部分。您也可以在虛擬鏈路上啟用OSPF身份驗證。
本文檔介紹如何在OSPF網路中的虛擬鏈路上啟用純文字檔案和消息摘要5(MD5)身份驗證。有關如何配置OSPF身份驗證的詳細資訊,請參閱在OSPF中進行身份驗證的示例配置。
嘗試此組態之前,請確保符合以下要求:
瞭解OSPF路由協定及其操作
瞭解OSPF虛擬鏈路概念
有關OSPF路由協定和OSPF中虛擬鏈路概念的詳細資訊,請參閱OSPF設計手冊。
本文中的資訊係根據以下軟體和硬體版本:
Cisco 2500系列路由器
Cisco IOS®軟體版本12.2(27)
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
本節提供用於設定本文件中所述功能的資訊。
註:使用Command Lookup Tool(僅限註冊客戶)查詢有關本文檔中使用的命令的更多資訊。
本檔案會使用以下網路設定:
本檔案會使用以下設定:
明文身份驗證通過網路以明文形式傳送口令。在此配置中,路由器3.3.3.3在區域0中沒有介面,但虛擬連線到區域0。此配置使路由器3.3.3.3成為虛擬區域邊界路由器(ABR),因此您必須在路由器3.3.3.3上啟用區域0身份驗證。本節提供在虛擬鏈路方案中配置純文字檔案身份驗證的命令。
注意:配置使用的身份驗證金鑰定義了直接插入OSPF報頭的金鑰(密碼)。Cisco IOS軟體建立路由通訊協定封包時,會將金鑰插入到標頭中。您可以為每個介面為每個網路分配單獨的密碼。為了交換OSPF資訊,同一網路上的所有相鄰路由器必須具有相同的密碼。
路由器1.1.1.1 |
---|
hostname r1.1.1.1 interface Loopback0 ip address 1.1.1.1 255.0.0.0 interface Ethernet0 ip address 4.0.0.1 255.0.0.0 ip ospf authentication-key cisco !--- This command configures the authentication key (password) !--- on the interface as "cisco". interface Serial0 ip address 5.0.0.1 255.0.0.0 clockrate 64000 ! router ospf 2 network 4.0.0.0 0.255.255.255 area 0 network 5.0.0.0 0.255.255.255 area 1 area 0 authentication !--- This command enables plain authentication for area 0 !--- on the router. area 1 virtual-link 3.3.3.3 authentication-key cisco !--- This command creates the virtual link between Router !--- 1.1.1.1 and Router 3.3.3.3 with plain text authentication enabled. |
路由器3.3.3.3 |
---|
hostname r3.3.3.3 interface Loopback0 ip address 3.3.3.3 255.0.0.0 interface Ethernet0 ip address 12.0.0.3 255.0.0.0 interface Serial0 ip address 6.0.0.3 255.0.0.0 ! router ospf 2 network 12.0.0.0 0.255.255.255 area 2 network 6.0.0.0 0.255.255.255 area 1 area 0 authentication !--- This command enables plain authentication for area 0 !--- on the router. area 1 virtual-link 1.1.1.1 authentication-key cisco !--- This command creates the virtual link to area 0 via !--- transit area 1 with plain text authentication enabled. |
MD5身份驗證比純文字檔案身份驗證更安全。安全性更好,因為此方法使用MD5演算法從OSPF資料包的內容和密碼(或金鑰)計算雜湊值。 該雜湊值隨金鑰ID和非遞減序列號一起在資料包中傳輸。知道相同密碼的接收方會計算自己的雜湊值。本節提供在虛擬鏈路場景中配置MD5身份驗證的命令。
路由器1.1.1.1 |
---|
hostname r1.1.1.1 interface Loopback0 ip address 1.1.1.1 255.0.0.0 interface Ethernet0 ip address 4.0.0.1 255.0.0.0 ip ospf message-digest-key 1 md5 cisco !--- This command configures the MD5 authentication key !--- on the interface as "cisco". interface Serial0 ip address 5.0.0.1 255.0.0.0 clockrate 64000 ! router ospf 2 network 4.0.0.0 0.255.255.255 area 0 network 5.0.0.0 0.255.255.255 area 1 area 0 authentication message-digest !--- This command enables MD5 authentication for area 0 !--- on the router. area 1 virtual-link 3.3.3.3 message-digest-key 1 md5 cisco !--- This command creates the virtual link between Router !--- 1.1.1.1 and Router 3.3.3.3 with MD5 authentication enabled. |
路由器3.3.3.3 |
---|
hostname r3.3.3.3 interface Loopback0 ip address 3.3.3.3 255.0.0.0 interface Ethernet0 ip address 12.0.0.3 255.0.0.0 interface Serial0 ip address 6.0.0.3 255.0.0.0 ! router ospf 2 network 12.0.0.0 0.255.255.255 area 2 network 6.0.0.0 0.255.255.255 area 1 area 0 authentication message-digest !--- This command enables MD5 authentication for area 0 !--- on the router. area 1 virtual-link 1.1.1.1 message-digest-key 1 md5 cisco !--- This command creates the virtual link to area 0 via !--- the transit area 1 with MD5 authentication enabled. |
使用本節內容,確認您的組態是否正常運作。
輸出直譯器工具(僅供已註冊客戶使用)(OIT)支援某些show命令。使用OIT檢視show命令輸出的分析。
show ip ospf virtual-links — 顯示OSPF虛擬鏈路的引數和當前狀態。
show ip route — 顯示路由表的當前狀態。
r3.3.3.3# show ip ospf virtual-links Virtual Link OSPF_VL0 to router 1.1.1.1 is up !--- The status of the virtual link displays. Run as demand circuit DoNotAge LSA allowed !--- This specifies that OSPF runs as a demand circuit over virtual links, !--- and so link-state advertisements (LSAs) are not refreshed (not aged out). Transit area 1, via interface Serial0, Cost of using 128 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:01 Adjacency State FULL (Hello suppressed) !--- The status of the neighbor adjacency displays. Index 1/2, retransmission queue length 0, number of retransmission 1 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 1, maximum is 1 Last retransmission scan time is 0 msec, maximum is 0 msec Simple password authentication enabled !--- The type of authentication that is enabled displays. !--- The authentication type is simple password. r3.3.3.3#
注意:輸出顯示OSPF hello被抑制。這意味著,一旦虛擬鏈路啟動,就不再交換hello。OSPF會抑制hello,因為它將虛擬鏈路視為請求電路。通常,OSPF每10秒傳送一次hello,並每30分鐘刷新一次LSA。然而,即使這種流量量也不需要按需電路。使用OSPF需求電路選項會抑制hello和LSA刷新功能。因此,在使用clear ip ospf process 命令清除OSPF進程之前,對OSPF身份驗證所做的任何更改都不會生效。例如,路由器上的身份驗證型別發生了變化。
r3.3.3.3# show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set C 3.0.0.0/8 is directly connected, Loopback0 O 4.0.0.0/8 [110/138] via 6.0.0.2, 00:31:08, Serial0 O 5.0.0.0/8 [110/128] via 6.0.0.2, 22:55:44, Serial0 C 6.0.0.0/8 is directly connected, Serial0 C 12.0.0.0/8 is directly connected, Ethernet0 r3.3.3.3#
r3.3.3.3# show ip ospf virtual-links Virtual Link OSPF_VL1 to router 1.1.1.1 is up !--- The status of the virtual link displays. Run as demand circuit DoNotAge LSA allowed !--- This specifies that OSPF runs as a demand circuit over virtual links, !--- and so LSAs are not refreshed (not aged out). Transit area 1, via interface Serial0, Cost of using 128 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:01 Adjacency State FULL (Hello suppressed) !--- The status of the neighbor adjacency displays. Index 1/2, retransmission queue length 0, number of retransmission 0 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 0, maximum is 0 Last retransmission scan time is 0 msec, maximum is 0 msec Message digest authentication enabled !--- The type of authentication that is enabled displays. !--- The authentication type is MD5. Youngest key id is 1
r3.3.3.3# show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set C 3.0.0.0/8 is directly connected, Loopback0 O 4.0.0.0/8 [110/138] via 6.0.0.2, 00:02:41, Serial0 O 5.0.0.0/8 [110/128] via 6.0.0.2, 00:02:51, Serial0 C 6.0.0.0/8 is directly connected, Serial0 C 12.0.0.0/8 is directly connected, Ethernet0
使用本節內容,對組態進行疑難排解。
附註:使用 debug 指令之前,請先參閱有關 Debug 指令的重要資訊。
debug ip ospf adj — 調試OSPF鄰居鄰接關係建立過程。
r3.3.3.3# debug ip ospf adj 23:31:41: OSPF: Interface OSPF_VL0 going Up 23:31:41: OSPF: Build router LSA for area 0, router ID 3.3.3.3, seq 0x8000002E 23:31:41: OSPF: Build router LSA for area 1, router ID 3.3.3.3, seq 0x8000002E 23:31:41: OSPF: Build router LSA for area 2, router ID 3.3.3.3, seq 0x80000031 23:31:51: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL0 seq 0x887 opt 0x62 flag 0x7 len 32 mtu 0 state INIT 23:31:51: OSPF: 2 Way Communication to 1.1.1.1 on OSPF_VL0, state 2WAY 23:31:51: OSPF: Send DBD to 1.1.1.1 on OSPF_VL0 seq 0x2102 opt 0x62 flag 0x7 len 32 23:31:51: OSPF: First DBD and we are not SLAVE 23:31:51: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL0 seq 0x2102 opt 0x62 flag 0x2 len 172 mtu 0 state EXSTART 23:31:51: OSPF: NBR Negotiation Done. We are the MASTER 23:31:51: OSPF: Send DBD to 1.1.1.1 on OSPF_VL0 seq 0x2103 opt 0x62 flag 0x3 len 172 23:31:51: OSPF: Database request to 1.1.1.1 23:31:51: OSPF: sent LS REQ packet to 5.0.0.1, length 12 23:31:51: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL0 seq 0x2103 opt 0x62 flag 0x0 len 32 mtu 0 state EXCHANGE 23:31:51: OSPF: Send DBD to 1.1.1.1 on OSPF_VL0 seq 0x2104 opt 0x62 flag 0x1 len 32 23:31:51: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL0 seq 0x2104 opt 0x62 flag 0x0 len 32 mtu 0 state EXCHANGE 23:31:51: OSPF: Exchange Done with 1.1.1.1 on OSPF_VL0 23:31:51: OSPF: Synchronized with 1.1.1.1 on OSPF_VL0, state FULL !--- This indicates the establishment of neighbor adjacency. 23:31:51: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on OSPF_VL0 from LOADING to FULL, Loading Done 23:31:52: OSPF: Build router LSA for area 0, router ID 3.3.3.3, seq 0x8000002F 23:32:23: OSPF: Dead event ignored for 1.1.1.1 on demand circuit OSPF_VL0 r3.3.3.3#
r3.3.3.3# debug ip ospf adj 23:48:06: OSPF: Interface OSPF_VL1 going Up 23:48:06: OSPF: Send with youngest Key 0 23:48:07: OSPF: Build router LSA for area 0, router ID 3.3.3.3, seq 0x80000001 23:48:07: OSPF: Build router LSA for area 2, router ID 3.3.3.3, seq 0x80000033 23:48:07: OSPF: Build router LSA for area 1, router ID 3.3.3.3, seq 0x80000030 23:48:14: OSPF: 2 Way Communication to 1.1.1.1 on OSPF_VL1, state 2WAY 23:48:14: OSPF: Send DBD to 1.1.1.1 on OSPF_VL1 seq 0x1EA opt 0x62 flag 0x7 len32 23:48:14: OSPF: Send with youngest Key 1 23:48:14: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL1 seq 0x3FB opt 0x62 flag 0x7 len 32 mtu 0 state EXSTART 23:48:14: OSPF: First DBD and we are not SLAVE 23:48:16: OSPF: Send with youngest Key 1 23:48:19: OSPF: Send DBD to 1.1.1.1 on OSPF_VL1 seq 0x1EA opt 0x62 flag 0x7 len 32 23:48:19: OSPF: Send with youngest Key 1 23:48:19: OSPF: Retransmitting DBD to 1.1.1.1 on OSPF_VL1 [1] 23:48:19: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL1 seq 0x3FB opt 0x62 flag 0x7 len 32 mtu 0 state EXSTART 23:48:19: OSPF: First DBD and we are not SLAVE 23:48:19: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL1 seq 0x1EA opt 0x62 flag 0x2 len 172 mtu 0 state EXSTART 23:48:19: OSPF: NBR Negotiation Done. We are the MASTER 23:48:19: OSPF: Send DBD to 1.1.1.1 on OSPF_VL1 seq 0x1EB opt 0x62 flag 0x3 len 112 23:48:19: OSPF: Send with youngest Key 1 23:48:19: OSPF: Send with youngest Key 1 23:48:19: OSPF: Database request to 1.1.1.1 23:48:19: OSPF: sent LS REQ packet to 5.0.0.1, length 48 23:48:19: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL1 seq 0x1EB opt 0x62 flag 0x0 len 32 mtu 0 state EXCHANGE 23:48:19: OSPF: Send DBD to 1.1.1.1 on OSPF_VL1 seq 0x1EC opt 0x62 flag 0x1 len 32 23:48:19: OSPF: Send with youngest Key 1 23:48:19: OSPF: Build router LSA for area 0, router ID 3.3.3.3, seq 0x80000030 23:48:19: OSPF: Rcv DBD from 1.1.1.1 on OSPF_VL1 seq 0x1EC opt 0x62 flag 0x0 len 32 mtu 0 state EXCHANGE 23:48:19: OSPF: Exchange Done with 1.1.1.1 on OSPF_VL1 23:48:19: OSPF: Synchronized with 1.1.1.1 on OSPF_VL1, state FULL !--- This indicates the establishment of neighbor adjacency. 23:48:19: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on OSPF_VL1 from LOADING to FULL, Loading Done
修訂 | 發佈日期 | 意見 |
---|---|---|
1.0 |
15-Aug-2005 |
初始版本 |