在高級資料鏈路控制(HDLC)和點對點協定(PPP)等點對點鏈路上,開放最短路徑優先(OSPF)作為點對點網路型別運行。預設情況下啟用此網路型別。本文檔顯示了點對點鏈路上的OSPF配置示例。OSPF支援的其它網路型別包括點對多點、廣播和非廣播。若要檢查運行OSPF的介面的網路型別,請發出show ip ospf interface 命令。
本文檔中介紹的示例同時適用於HDLC和PPP封裝。
本文檔的讀者應具備有關OSPF路由協定的一些基本知識。有關OSPF路由協定的詳細資訊,請參閱開放最短路徑優先文檔。
本檔案中的資訊適用於這些軟體和硬體版本。
Cisco 2500路由器
在路由器上執行的Cisco IOS®軟體版本12.2(27)
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
本節提供可用於配置運行OSPF並通過點對點串列鏈路連線的路由器的資訊,這些路由器使用HDLC封裝,在串列介面上配置IP地址。
注意:要查詢有關本文檔使用的命令的更多資訊,請使用命令查詢工具(僅限註冊客戶)。
本節使用這些配置。
Router1 |
---|
Router1 ! interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Serial0 ip address 1.1.1.2 255.255.255.0 ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 !--- Configures the Serial Interface S0 under OSPF area 0. ! |
Router2 |
---|
Router2 ! interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 ip address 1.1.1.1 255.255.255.0 clockrate 2000000 ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 !--- Configures the Serial Interface S0 under OSPF area 0.. |
本節為您提供了一些資訊,您可以使用這些資訊來配置運行OSPF作為路由協定並且通過PPP封裝和未編號串列介面的點對點串列鏈路連線的路由器。未編號的串列介面是沒有自己的IP地址的介面。這些介面從配置了IP地址的路由器上的另一個介面借用IP地址。有關未編號串列介面的詳細資訊,請參閱瞭解和配置ip unnumbered命令。
注意:要查詢有關本文檔使用的命令的更多資訊,請使用命令查詢工具(僅限註冊客戶)。
本節使用這些配置。
Router1 |
---|
! interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Serial0 ip unnumbered loopback 0 !--- Configures Serial 0 as an unnumbered interface. encapsulation ppp !--- Configures the Encapsulation on the interface as PPP. ! router ospf 1 network 3.3.3.0 0.0.0.255 area 0 !--- Configures the Loopback Interface L0 under OSPF area 0. ! |
Router2 |
---|
! interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 ip unnumbered loopback 0 !--- Configures Serial 0 as an unnumbered interface. encapsulation ppp !--- Configures the Encapsulation on the interface as PPP. ! router ospf 1 network 2.2.2.0 0.0.0.255 area 0 !--- Configures the Loopback Interface L0 under OSPF area 0.. ! |
本節提供的資訊可用於確認您的組態是否正常運作。
輸出直譯器工具(僅供註冊客戶使用)支援某些show命令,此工具可讓您檢視show命令輸出的分析。
這是Router1上發出的show ip ospf neighbor命令輸出。
Router1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/ - 00:00:32 1.1.1.1 Serial 0
此輸出顯示,Router1有一個路由器ID為2.2.2.2的鄰居,並且已與該鄰居建立完全鄰接關係。地址1.1.1.1是Router2上Serial0介面的IP地址。
有關show ip ospf neighbor命令的其他資訊,請參閱show ip ospf neighbor命令顯示什麼?
這是Router1上的show ip ospf interface serial 0命令的輸出。此輸出將介面Serial0的OSPF網路型別顯示為點對點。
Router1# show ip ospf interface serial 0 Serial0 is up, line protocol is up Internet Address 1.1.1.2/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 64 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:05 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 Suppress hello for 0 neighbor(s)
同樣,此示例顯示Router2上的show ip ospf neighbor和show ip ospf interface命令的輸出。
Router2# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/ - 00:00:32 1.1.1.2 Serial0 Router2# show ip ospf interface serial 0 Serial0 is up, line protocol is up Internet Address 1.1.1.1/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 64 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:05 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 3.3.3.3 Suppress hello for 0 neighbor(s)
Router1和Router2上的show ip ospf neighbor命令可確認完全鄰接關係。此輸出將介面Serial0的OSPF網路型別顯示為點對點。您還可以看到兩台路由器上的串列介面的Internet地址為0.0.0.0。這是因為藉由ip unnumbered指令從回送介面借用IP位址(在本案例中)。
Router1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/ - 00:00:37 2.2.2.2 Serial0 Router1# show ip ospf interface serial 0 Serial0 is up, line protocol is up Internet Address 0.0.0.0/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 64 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:08 Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 Suppress hello for 0 neighbor(s)
此示例顯示Router2上show ip ospf neighbor和show ip ospf interface serial 0命令的輸出。
Router2#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/ - 00:00:30 3.3.3.3 Serial0 Router2# show ip ospf interface serial 0 Serial0 is up, line protocol is up Internet Address 0.0.0.0/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 64 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:08 Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 3.3.3.3 Suppress hello for 0 neighbor(s)
此範例顯示使用PPP封裝的Router1上的show ip route 命令的輸出及未編號介面的使用。
Router1#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, su - IS-IS summary, 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 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Serial0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0
此範例顯示使用封裝PPP和使用未編號介面的Router 2上show ip route命令的輸出。
Router2#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, su - IS-IS summary, 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 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Serial0
此範例顯示使用HDLC封裝的Router1上的show ip route命令的輸出及未編號介面的使用。
Router1#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, su - IS-IS summary, 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 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 2.2.2.2, 00:00:08, Serial0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0
此示例顯示封裝為HDLC的Router2上的show ip route命令的輸出以及未編號介面的使用。
Router1#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, su - IS-IS summary, 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 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/65] via 3.3.3.3, 00:01:28, Serial0
注意:在串列介面上使用IP未編號配置時,show ip route命令的輸出可能不同於PPP封裝和HDLC封裝。PPP將主機路由安裝到作為直連網路的另一端串列介面上使用的IP地址。如果通過OSPF也學習了與此配置相同的字首,則它只顯示為連線的路由(如此show ip route輸出所示)。 這是因為連線的路由比OSPF具有更小的管理距離,而且更優先。您可以在串列介面下發出no peer neighbor-route 命令時更改此行為,該命令會阻止安裝主機路由並將其視為OSPF路由。
HDLC不是這種情況,因為它不安裝主機路由。當使用IP未編號時,HDLC為另一端的地址安裝OSPF路由。
有關如何排除OSPF問題的資訊,請參閱排除OSPF故障。
修訂 | 發佈日期 | 意見 |
---|---|---|
1.0 |
06-Jul-2007 |
初始版本 |