1. 程式人生 > 實用技巧 >3. OSPF鄰居關係排錯以及網路型別

3. OSPF鄰居關係排錯以及網路型別

1. OSPF的鄰居/鄰接關係排錯(troubleshooing)

1. hello間隔和dead 間隔不同
2. 介面下OSPF網路型別不匹配。
3. 區域號碼不一致;
4. 特殊區域(如stub,nssa等)區域型別不匹配;
5. 認證型別或密碼不一致; 
6. 路由器 router-id 相同; 
7. 鏈路上的 MTU 不匹配;(前提:開啟MTU)
8. 在broadcast鏈路上的子網掩碼不匹配
9. 在MA 網路中,沒有DR
10. 介面設定為silent-interface

dis ospf error //多次使用該命令來判斷問題

1.1 相鄰裝置的RID相同

  • 相鄰裝置的RID不能相同,否則不會有鄰居狀態

  • 同一區域,不相鄰裝置的RID衝突,缺少路由

  • 解決方案:保證整個AS內部的RID唯一

  • LSA 1,2,3,4,7類 6類 mospf 8類 ipv6 ospfv3 9,10,11MPLS TE

<R3>
Jun  5 2018 19:32:52-08:00 R3 %%01OSPF/4/CONFLICT_ROUTERID_INTF(l)[2]:OSPF Router id conflict is detected on interface. (ProcessId=256, RouterId=4.4.0.0,AreaId=34.0.0.0, InterfaceName=Serial2/0/0,  IpAddr=3.34.1.10, PacketSrcIp=4.34.1.10)
//在s2/0/0介面上檢測到了RID衝突

<R3>dis ospf error

         OSPF Process 1 with Router ID 0.0.4.4
                 OSPF error statistics 
General packet errors:
 0     : IP: received my own packet     0     : Bad packet
 0     : Bad version                    0     : Bad checksum
 0     : Bad area id                    0     : Drop on unnumbered interface
 0     : Bad virtual link               0     : Bad authentication type
 0     : Bad authentication key         0     : Packet too small
 0     : Packet size > ip length        0     : Transmit error
 0     : Interface down                 0     : Unknown neighbor
 0     : Bad net segment                0     : Extern option mismatch
 33    : Router id confusion //表明RID衝突

//補充一點:如果同一區域的不相鄰裝置RID衝突,則缺少路由


<SW1>dis cu conf ospf
#
ospf 1 router-id 0.0.4.4
 area 0.0.0.34
#
interface Vlanif30
 ip address 10.1.30.10 255.255.255.0
 ospf enable 1 area 0.0.0.34

//解決方案:整個AS內部RID保持唯一
[SW1]ospf router-id 10.10.10.10
Info: The configuration succeeded. You need to restart the OSPF process to validate the new router ID.

<SW1>reset ospf process 
Warning: The OSPF process will be reset. Continue? [Y/N]:y

1.2 鏈路上區域ID不匹配

[R3]dis ospf error

         OSPF Process 1 with Router ID 33.1.1.1
                 OSPF error statistics 
General packet errors:
 0     : IP: received my own packet     0     : Bad packet
 0     : Bad version                    0     : Bad checksum
 4     : Bad area id                    0     : Drop on unnumbered interface
 0     : Bad virtual link               0     : Bad authentication type
 0     : Bad authentication key         0     : Packet too small
 0     : Packet size > ip length        0     : Transmit error
 1     : Interface down                 0     : Unknown neighbor
 0     : Bad net segment                0     : Extern option mismatch
 0     : Router id confusion

1.3 Hello和死亡時間都需要匹配

什麼場景下會修改時間呢?

​ 在沒有其他檢測機制的前提下(BFD),協議本身為了加速檢測鄰居時間和收斂時間

interface Serial2/0/0
     link-protocol ppp
     ip address 10.1.34.4 255.255.255.0 
     ospf timer hello 1
     ospf timer dead 2
     ospf enable 1 area 0.0.0.34
 
 
[R3]dis ospf error

         OSPF Process 1 with Router ID 33.1.1.1
                 OSPF error statistics 
General packet errors:
 0     : IP: received my own packet     303   : Bad packet
 0     : Bad version                    0     : Bad checksum
 38    : Bad area id                    0     : Drop on unnumbered interface
 0     : Bad virtual link               0     : Bad authentication type
 0     : Bad authentication key         0     : Packet too small
 0     : Packet size > ip length        0     : Transmit error
 1     : Interface down                 0     : Unknown neighbor
 0     : Bad net segment                0     : Extern option mismatch
 0     : Router id confusion

HELLO packet errors:
 0     : Netmask mismatch               303   : Hello timer mismatch //先檢測Hello,死亡時間暫時不關心
 0     : Dead timer mismatch            0     : Virtual neighbor unknown
 0     : NBMA neighbor unknown          0     : Invalid Source Address



[R3]dis cu int s2/0/0
#
interface Serial2/0/0
     link-protocol ppp
     ip address 10.1.34.3 255.255.255.0 
     ospf timer hello 1 //Hello相同,但死亡時間依舊mismatch
     ospf enable 1 area 0.0.0.34 

[R3]dis ospf error   

         OSPF Process 1 with Router ID 33.1.1.1
                 OSPF error statistics 
General packet errors:
 0     : IP: received my own packet     453   : Bad packet
 0     : Bad version                    0     : Bad checksum
 38    : Bad area id                    0     : Drop on unnumbered interface
 0     : Bad virtual link               0     : Bad authentication type
 0     : Bad authentication key         0     : Packet too small
 0     : Packet size > ip length        0     : Transmit error
 1     : Interface down                 0     : Unknown neighbor
 0     : Bad net segment                0     : Extern option mismatch
 0     : Router id confusion

HELLO packet errors:
 0     : Netmask mismatch               350   : Hello timer mismatch
 103   : Dead timer mismatch            0     : Virtual neighbor unknown
 0     : NBMA neighbor unknown          0     : Invalid Source Address
 
 
[R3-Serial2/0/0]ospf timer dead 1
Error: The dead interval must be greater than the hello interval. //華為裝置不能把死亡時間配置的小於等於hello時間!

int s1/0/0
	ospf timer dead
		 hello
		 ldp-sync       //ldp和IGP同步的時間
		 poll			  // 在NBMA網路中傳送hello的時間
		 setransmit     //重傳間隔

1.4 多點接入網路的掩碼一致(2類LSA)

  • MA網路(預設的乙太網,FR 和 ATM)要求掩碼一致
  • 點到點網路並不要求掩碼一致,也不受子網影響(Hello報文掩碼為0.0.0.0,即不檢測)
[SW1-Vlanif30]ip address 10.1.30.10 28            
[SW1-Vlanif30]ping 10.1.30.3
  PING 10.1.30.3: 56  data bytes, press CTRL_C to break
    Reply from 10.1.30.3: bytes=56 Sequence=1 ttl=255 time=70 ms
    Reply from 10.1.30.3: bytes=56 Sequence=2 ttl=255 time=40 ms


[SW1-Vlanif30]dis ospf error
HELLO packet errors:
 26    : Netmask mismatch               0     : Hello timer mismatch
 0     : Dead timer mismatch            0     : Virtual neighbor unknown
 0     : NBMA neighbor unknown          0     : Invalid Source Address


//多點接入網路不一致:
[SW1-Vlanif30]dis ospf error

         OSPF Process 1 with Router ID 10.10.10.10
                 OSPF error statistics 
General packet errors:
 0     : IP: received my own packet     56    : Bad packet
 0     : Bad version                    0     : Bad checksum
 0     : Bad area id                    0     : Drop on unnumbered interface
 0     : Bad virtual link               0     : Bad authentication type
 0     : Bad authentication key         0     : Packet too small
 0     : Packet size > ip length        0     : Transmit error
 6     : Interface down                 0     : Unknown neighbor
 24    : Bad net segment //錯誤的網段


//點到點網路不受掩碼的影響(Hello中掩碼位會顯示0.0.0.0即不檢測)
[R3-Serial2/0/0]ip address 10.1.34.2 28
[R3-Serial2/0/0]dis ospf peer bri

         OSPF Process 1 with Router ID 33.1.1.1
                  Peer Statistic Information
----------------------------------------------------------------------------

 Area Id          Interface                        Neighbor id      State    
 0.0.0.34         GigabitEthernet0/0/1             10.10.10.10      Full        
 0.0.0.34         Serial2/0/0                      0.0.4.4          Full

// 請問點到點網路建立OSPF鄰居受子網影響麼?在點到點的OSPF網路,掩碼、子網並不要求,可以完成鄰居關係

// 請問如果一個介面沒有配置IP地址可以建立鄰居麼?
[R4-Serial2/0/0]ip address unnumbered interface LoopBack 0 //串列埠借用環回介面的地址作為源傳送報文,通常會用到廣域網IP地址匱乏的環境中

//點對點子網掩碼最好配成30位

1.5 MTU一致性檢測

預設情況下華為裝置上不檢測MTU一致性,除非兩端都開啟

[SW1-Vlanif30]ospf mtu-enable
[SW1-Vlanif30]dis th
#
interface Vlanif30
     ip address 10.1.30.10 255.255.255.0
     ospf mtu-enable
     ospf enable 1 area 0.0.0.34

[R3]dis cu int g0/0/1
#
interface GigabitEthernet0/0/1
     mtu 1504
     ip address 10.1.30.4 255.255.255.0 
     ospf mtu-enable
     ospf enable 1 area 0.0.0.34
     
     
     
[R3]dis ospf peer brief

         OSPF Process 1 with Router ID 33.1.1.1
                  Peer Statistic Information
----------------------------------------------------------------------------

 Area Id          Interface                        Neighbor id      State    
 0.0.0.34         GigabitEthernet0/0/1             10.10.10.10      ExStart     
 0.0.0.34         Serial2/0/0                      0.0.4.4          Full 
 
//會卡到exstart/exchange狀態,注意並不是2-way


dis ospf error
DD packet errors:
 0     : Neighbor state low             0     : Unknown LSA type
 2     : MTU option mismatch

1.6 標誌位的一致性

// 特殊區域(如stub,nssa等)區域型別不匹配

E=1代表可以接受外部路由,E=0
NP 和 NSSA特殊區域有關
DN 在MPLS種講

1.7 網路型別不一致

2. OSPF的鄰接/OSPF的網路型別

2.1有鄰居但是缺少路由條目:

  • DR/BDR引發的

  • 同一區域的不相鄰裝置RID衝突

  • 網路型別問題

2.2 物理介質封裝型別:

  • 乙太網

  • 幀中繼(ATM)

  • PPP/HDLC

用命令驗證:

[R3-Serial2/0/0]link-protocol ?
  fr    Select FR as line protocol
  hdlc  Enable HDLC protocol
  lapb  LAPB(X.25 level 2 protocol)
  ppp   Point-to-Point protocol 
  sdlc  SDLC(Synchronous Data Line Control) protocol 
  x25   X.25 protocol

2.3 OSPF的網路型別

  • 為了適應不同介質的封裝型別
[R3-Serial2/0/0]ospf network-type ?
  broadcast  Specify OSPF broadcast network //廣播
  nbma       Specify OSPF NBMA network //非廣播多路訪問
  p2mp       Specify OSPF point-to-multipoint network //點到多點
  p2p        Specify OSPF point-to-point network //點到點

2.3.1 目的:

用技術手段解決物理介質問題

2.3.2 三個方面考慮問題:

  • 能否自動通過組播發現鄰居

  • 時間(hello和dead)

  • DR和BDR

2.3.3 四種網路型別:

  • P2P網路(PPP,HDLC,幀中繼子介面) //點到點也是通過組播發現鄰居

    ​ 時間:hello間隔:10s 40s deadtime

    ​ 不需要DR/BDR

  • 廣播型網路(乙太網) // 組播發現鄰居

    ​ 時間:10s hello間隔 40s deadtime

    ​ 需要DR/BDR

  • NBMA網路(幀中繼的物理介面,ATM,DSVPN中) // 單播發現鄰居

    ​ 時間:30s hello間隔 120s deadtime

    ​ 需要DR/BDR

  • P2MP網路(多個點到點網路的集合) // 組播自動發現鄰居

    ​ 時間:30s hello間隔 120s deadtime

    ​ 不需要DR/BDR

2.3.4 MA網路中的問題

  • 點到點同步LSA成本小

  • 多點接入網路同步LSA,成本大---DR/BDR

  • n x (n-1)/2 個鄰接關係,管理複雜

  • 重複的LSA泛紅,造成資源浪費

2.3.5 網路型別的應用

根據網路設計調整網路型別

網路型別的應用:根據網路設計調整網路型別

//需求1:請在除了區域15和區域0之外的網路,配置特定的命令使得網路可以儘快的收斂。
  方法:把區域34、區域35、區域56的ospf的建立鄰居的介面修改為p2p
	ospf network-type p2p
	
//需求2:使得各個區域的資料可以通訊

作業:

請驗證OSPF的4種錯誤的鄰居關係(1.1,1.3,1.4,1.5),用dis ospf error去摸排錯誤