影響OSPF鄰居建立的因素有:
<1>路由器ID --header
a.相鄰路由器的router-id 不能相同,相同不能建立鄰居
b.同一個區域不相鄰設備的router-id可以相同,但是影響路由學習
c.不同區域不相鄰的設備的router-id可以相同,不會影響路由學習
2 : Router id confusion
<AR1>
Feb 23 2019 16:00:58-08:00 AR1 %%01OSPF/4/CONFLICT_ROUTERID_INTF(l)[3]:OSPF Router id conflict is detected on interface. (ProcessId=256, RouterId=1.1.1.11, AreaId=0.0.0.0, InterfaceName=Serial4/0/1, IpAddr=1.1.1.12, PacketSrcIp=2.1.1.12)
<2>接口的區域ID ---header 報文
相鄰的直連接口區域ID一定要相同
3 : Bad area id
<3>接口的地址掩碼(如果是MA網絡) ---hello報文
a.接口網絡類型如果是Broadcast,MA網絡,掩碼長度必須一致
b.接口網絡類型如果是P2P,P2P網絡,掩碼長度可以不同
c.接口網絡類型如果是P2MP,P2MP網絡,掩碼長度可以不同(通過在接口下配置ospf p2mp-mask-ignore命令忽略檢查掩碼長度)
interface Serial4/0/1
link-protocol ppp
ip address 12.1.1.1 255.255.255.0
ospf network-type p2mp //修改網絡類型爲P2MP
ospf p2mp-mask-ignore //忽略檢查掩碼長度
15 : Netmask mismatch
<AR3>dis ospf error pac
<AR3>dis ospf error packet
Bad packet index: 1 Received time: 2019-02-23 16:26:43-08:00
Src 10.1.1.2 -> Dst 224.0.0.5, interface GigabitEthernet0/0/1, length 64
45 c0 40 00 06 cf 00 00 01 59 c6 ce 0a 01 01 02
e0 00 00 05 02 01 00 2c 16 01 01 01 00 00 00 01
d9 a8 00 00 00 00 00 00 00 00 00 00 ff ff ff f0
00 0a 02 01 00 00 00 28 0a 01 01 02 00 00 00 00
FileId 0, Line 5550.
Error Reason: NetMask ERROR !
<4>接口的認證 ----header報文
<5>接口的 hello interval and dead interval ----hello報文
兩端設備的hello時間和dead 時間必須相同
dead時間是hello時間的4倍關係。
當修改hello時間dead 時間自動變化,爲hello時間的4倍
如果只修改dead時間,hello時間是不會自動變化的。
interface Serial4/0/1
ospf timer hello 5 //修改hello時間爲5s dead time 20s
interface Serial4/0/1
ospf timer dead 20 //修改dead time,hello時間不會變化
[AR1]dis ospf int s4/0/1
OSPF Process 1 with Router ID 11.1.1.1
Interfaces
Interface: 12.1.1.1 (Serial4/0/1) --> 12.1.1.2
Cost: 48 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 5 , Dead 20 , Poll 120 , Retransmit 5 , Transmit Delay 1
34 : Hello timer mismatch
4 : Dead timer mismatch
<6>OPTION字段的E位和N位,即area type
OSPF的特殊區域有STUB和NSSA,分別對應如下的情況:
STUB區域:E 比特位= 0
NSSA區域:E 比特位= 0 N比特位=1
DD報文中影響OSPF鄰居建立的因素有:
<7>接口MTU不同(華爲設備默認不檢查MTU,可手工開啓檢查)
幀中繼環境中影響OSPF鄰居建立的因素有:
<8>幀中繼map映射缺少broadcast關鍵字
<9> silent-interface 靜默端口
不發送且不接收hello報文,但是不會影響路由的通告
一般配置在連接終端設備的接口,千萬不要配置在路由器相直連的接口
[AR3]dis ospf brief
Interface: 10.1.1.3 (GigabitEthernet0/0/1)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 10.1.1.3
Backup Designated Router: 0.0.0.0
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Silent interface, No hellos
<10> ACL 過濾
過濾OSPF 流量
acl number 3000
rule 10 deny ospf //過濾OSPF流量,放行其他所有
rule 20 permit ip
interface GigabitEthernet0/0/1
traffic-filter inbound acl 3000 //在in方向進行調用ACL
<AR3>dis acl all
Total quantity of nonempty ACL number is 1
Advanced ACL 3000, 2 rules
Acl's step is 5
rule 10 deny ospf (4 matches)
rule 20 permit ip (19 matches)
<11> 網絡類型是NBMA時候,必須手工指定鄰居關係,兩端設備都需要制定
AR2:
interface GigabitEthernet0/0/1
ospf network-type nbma
ospf 1 router-id 22.1.1.1
peer 10.1.1.3 //手工指定鄰居
=======================================================
<AR1>reset ospf counters
<AR2>dis ospf error
OSPF Process 1 with Router ID 11.1.1.1
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
<AR1>terminal debugging
Info: Current terminal debugging is on.
<AR1>
<AR1>terminal monitor
Info: Current terminal monitor is on.
<AR1>debug ospf packet
Feb 23 2019 16:00:38.621.2-08:00 AR1 RM/6/RMDEBUG: Source Address: 12.1.1.1
<AR1>
Feb 23 2019 16:00:38.621.3-08:00 AR1 RM/6/RMDEBUG: Destination Address: 224.0.0.5
<AR1>
Feb 23 2019 16:00:38.621.4-08:00 AR1 RM/6/RMDEBUG: Ver# 2, Type: 1 (Hello)
<AR1>
Feb 23 2019 16:00:38.621.5-08:00 AR1 RM/6/RMDEBUG: Length: 44, Router: 11.1.1.1
<AR1>
Feb 23 2019 16:00:38.621.6-08:00 AR1 RM/6/RMDEBUG: Area: 0.0.0.0, Chksum: f09c
<AR1>
Feb 23 2019 16:00:38.621.7-08:00 AR1 RM/6/RMDEBUG: AuType: 00
<AR1>
Feb 23 2019 16:00:38.621.8-08:00 AR1 RM/6/RMDEBUG: Key(ascii): * * * * * * * *
<AR1>
Feb 23 2019 16:00:38.621.9-08:00 AR1 RM/6/RMDEBUG: Net Mask: 255.255.255.0
<AR1>
Feb 23 2019 16:00:38.621.10-08:00 AR1 RM/6/RMDEBUG: Hello Int: 10, Option: _E_
<AR1>
Feb 23 2019 16:00:38.621.11-08:00 AR1 RM/6/RMDEBUG: Rtr Priority: 1, Dead Int: 40
<AR1>
Feb 23 2019 16:00:38.621.12-08:00 AR1 RM/6/RMDEBUG: DR: 0.0.0.0
<AR1>
Feb 23 2019 16:00:38.621.13-08:00 AR1 RM/6/RMDEBUG: BDR: 0.0.0.0