初始配置
R1
interface Loopback0
ip address 1.1.1.1 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/0
ip address 192.168.12.1 255.255.255.0
ip ospf 1 area 0
R2
interface Loopback0
ip address 2.2.2.2 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/2
ip address 192.168.23.2 255.255.255.0
ip ospf 1 area 1
R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
ip ospf 1 area 1
!
interface Ethernet0/1
ip address 192.168.23.3 255.255.255.0
ip ospf 1 area 1
1. 区域号码不一致
在R3修改区域号码,OSPF状态Down
R3(config)#int e0/1
R3(config-if)#ip os 1 area 2
R3(config-if)#
*Jan 8 03:04:25.868: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.12.2 on Ethernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
排错
R3#sh ip os int e0/1
Ethernet0/1 is up, line protocol is up
Internet Address 192.168.23.3/24, Area 2, Attached via Interface Enable
Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10
Topology-MTID Cost Disabled Shutdown Topology Name
0 10 no no Base
Enabled by interface config, including secondary ip addresses
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 3.3.3.3, Interface address 192.168.23.3
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:08
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 1/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 1
Last flood scan time is 1 msec, maximum is 1 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
R2#debug ip os adj
OSPF adjacency debugging is on
R2#
*Jan 8 04:00:54.910: OSPF-1 ADJ Et0/1: Rcv pkt from 192.168.23.3, area 0.0.0.1, mismatched area 0.0.0.2 in the header
R2#
*Jan 8 04:01:04.725: OSPF-1 ADJ Et0/1: Rcv pkt from 192.168.23.3, area 0.0.0.1, mismatched area 0.0.0.2 in the header
R2#
*Jan 8 04:01:13.860: OSPF-1 ADJ Et0/1: Rcv pkt from 192.168.23.3, area 0.0.0.1, mismatched area 0.0.0.2 in the header
2. 特殊区域(如stub,nssa等)区域类型不匹配
在R3修改区域为nssa,OSPF状态Down
R3(config)#router ospf 1
R3(config-router)#area
R3(config-router)#area 1 ns
R3(config-router)#area 1 nssa
R3(config-router)#
*Jan 8 04:37:53.174: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.12.2 on Ethernet0/1 from FULL to DOWN, Neighbor Down: Adjacency forced to reset
排错
R3#debug ip ospf hello
OSPF hello debugging is on
R3#
*Jan 8 04:38:07.580: OSPF-1 HELLO Et0/1: Rcv hello from 192.168.12.2 area 1 192.168.23.2
*Jan 8 04:38:07.580: OSPF-1 HELLO Et0/1: Hello from 192.168.23.2 with mismatched NSSA option bit
R3#
*Jan 8 04:38:09.188: OSPF-1 HELLO Et0/1: Send hello to 224.0.0.5 area 1 from 192.168.23.3
R3#
*Jan 8 04:38:17.275: OSPF-1 HELLO Et0/1: Rcv hello from 192.168.12.2 area 1 192.168.23.2
*Jan 8 04:38:17.275: OSPF-1 HELLO Et0/1: Hello from 192.168.23.2 with mismatched NSSA option bit
R3#
*Jan 8 04:38:18.813: OSPF-1 HELLO Et0/1: Send hello to 224.0.0.5 area 1 from 192.168.23.3
R3#
*Jan 8 04:38:27.081: OSPF-1 HELLO Et0/1: Rcv hello from 192.168.12.2 area 1 192.168.23.2
*Jan 8 04:38:27.081: OSPF-1 HELLO Et0/1: Hello from 192.168.23.2 with mismatched NSSA option bit
R3#sh ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.12.2 1 DOWN/DROTHER - 192.168.23.2 Ethernet0/1
R3#sh run | section router ospf
router ospf 1
area 1 nssa
3. Hello/dead 间隔不匹配
在R3修改Hello间隔,OSPF状态Down
R3(config)#int e0/1
R3(config-if)#ip os
R3(config-if)#ip ospf he
R3(config-if)#ip ospf hello-interval 20
R3(config-if)#end
R3#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R3#
*Jan 8 04:47:42.173: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.12.2 on Ethernet0/1 from FULL to DOWN, Neighbor Down: Dead timer expired
排错
R3#debug ip ospf hello
OSPF hello debugging is on
R3#
R3#debug ip ospf hello
OSPF hello debugging is on
R3#
*Jan 8 04:49:03.322: OSPF-1 ADJ Et0/1: end of Wait on interface
*Jan 8 04:49:03.322: OSPF-1 ADJ Et0/1: DR/BDR election
*Jan 8 04:49:03.322: OSPF-1 ADJ Et0/1: Elect BDR 3.3.3.3
*Jan 8 04:49:03.322: OSPF-1 ADJ Et0/1: Elect DR 3.3.3.3
*Jan 8 04:49:03.322: OSPF-1 ADJ Et0/1: Elect BDR 0.0.0.0
*Jan 8 04:49:03.322: OSPF-1 ADJ Et0/1: Elect DR 3.3.3.3
*Jan 8 04:49:03.322: OSPF-1 ADJ Et0/1: DR: 3.3.3.3 (Id) BDR: none
R3#
*Jan 8 04:49:05.690: OSPF-1 HELLO Et0/1: Rcv hello from 192.168.12.2 area 1 192.168.23.2
*Jan 8 04:49:05.690: OSPF-1 HELLO Et0/1: Mismatched hello parameters from 192.168.23.2
*Jan 8 04:49:05.690: OSPF-1 HELLO Et0/1: Dead R 40 C 80, Hello R 10 C 20 Mask R 255.255.255.0 C 255.255.255.0
R3#
*Jan 8 04:49:15.191: OSPF-1 HELLO Et0/1: Rcv hello from 192.168.12.2 area 1 192.168.23.2
*Jan 8 04:49:15.191: OSPF-1 HELLO Et0/1: Mismatched hello parameters from 192.168.23.2
*Jan 8 04:49:15.191: OSPF-1 HELLO Et0/1: Dead R 40 C 80, Hello R 10 C 20 Mask R 255.255.255.0 C 255.255.255.0
R3#sh ip os int e0/1
Ethernet0/1 is up, line protocol is up
Internet Address 192.168.23.3/24, Area 1, Attached via Interface Enable
Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10
Topology-MTID Cost Disabled Shutdown Topology Name
0 10 no no Base
Enabled by interface config, including secondary ip addresses
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 3.3.3.3, Interface address 192.168.23.3
No backup designated router on this network
Timer intervals configured, Hello 20, Dead 80, Wait 80, Retransmit 5
oob-resync timeout 80
Hello due in 00:00:00
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 1
Last flood scan time is 0 msec, maximum is 1 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
4. 认证方式或密码不匹配
在R3配置区域认证,OSPF状态Down
R3(config)#router ospf 1
R3(config-router)#area 1 authentication message-digest
R3(config-router)#exit
R3(config)#int e0/1
R3(config-if)#ip ospf authentication message-digest
R3(config-if)#ip ospf message-digest-key 1 md5
*Jan 8 04:54:51.351: %OSPF-4-NOVALIDKEY: No valid authentication send key is available on interface Ethernet0/1
R3(config-if)#ip ospf message-digest-key 1 md5 cisco
排错
R3#debug ip ospf adj
OSPF adjacency debugging is on
R3#
*Jan 8 04:58:12.257: OSPF-1 ADJ Et0/1: Rcv pkt from 192.168.23.2 : Mismatched Authentication type. Input packet specified type 0, we use type 2
R3#
*Jan 8 04:58:13.328: OSPF-1 ADJ Et0/1: Send with youngest Key 1
R3#
*Jan 8 04:58:21.753: OSPF-1 ADJ Et0/1: Rcv pkt from 192.168.23.2 : Mismatched Authentication type. Input packet specified type 0, we use type 2
*Jan 8 04:58:22.693: OSPF-1 ADJ Et0/1: Send with youngest Key 1
R3#sh run | section router ospf
router ospf 1
area 0 authentication message-digest
R3#
R3#sh run int e0/1
Building configuration...
Current configuration : 165 bytes
!
interface Ethernet0/1
ip address 192.168.23.3 255.255.255.0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 cisco
ip ospf 1 area 1
end
5. router-id相同
修改R2和R3的router-id为2.2.2.2,OSPF状态Down
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
R2(config-router)#end
*Jan 8 05:02:48.575: %SYS-5-CONFIG_I: Configured from console by console
R2#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R3(config)#router ospf 1
R3(config-router)#router-id 2.2.2.2
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
R3(config-router)#end
*Jan 8 05:07:09.695: %SYS-5-CONFIG_I: Configured from console by console
R3#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R3#
*Jan 8 05:07:14.608: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Ethernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
R3#
*Jan 8 05:07:17.077: %OSPF-4-DUP_RTRID_NBR: OSPF detected duplicate router-id 2.2.2.2 from 192.168.23.2 on interface Ethernet0/1
排错
R3#
*Jan 8 05:10:31.171: %OSPF-4-DUP_RTRID_NBR: OSPF detected duplicate router-id 2.2.2.2 from 192.168.23.2 on interface Ethernet0/1
R3#sh ip os int e0/1
Ethernet0/1 is up, line protocol is up
Internet Address 192.168.23.3/24, Area 1, Attached via Interface Enable
Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 10
Topology-MTID Cost Disabled Shutdown Topology Name
0 10 no no Base
Enabled by interface config, including secondary ip addresses
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 2.2.2.2, Interface address 192.168.23.3
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:02
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
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 1 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
R3#sh run | section router ospf
router ospf 1
router-id 2.2.2.2
6. mtu不匹配
修改R3的mtu为1499,OSPF状态Exstart/Exstart或Exstart/Exchange
参考链接:
http://network.51cto.com/art/201312/422711.htm
R3(config)#int e0/1
R3(config-if)#ip mtu 1499
R3(config-if)#end
R3#clear ip ospf process
Reset ALL OSPF processes? [no]: y
排错
R2#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:38 192.168.12.1 Ethernet0/0
3.3.3.3 1 EXCHANGE/DR 00:00:38 192.168.23.3 Ethernet0/1
R3#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 EXSTART/DR 00:00:39 192.168.23.2 Ethernet0/1
R3#debug ip ospf adj
OSPF adjacency debugging is on
R3#
*Jan 8 05:18:33.977: OSPF-1 ADJ Et0/1: Send DBD to 2.2.2.2 seq 0x5 opt 0x52 flag 0x7 len 32
*Jan 8 05:18:33.977: OSPF-1 ADJ Et0/1: Retransmitting DBD to 2.2.2.2 [6]
*Jan 8 05:18:33.979: OSPF-1 ADJ Et0/1: Rcv DBD from 2.2.2.2 seq 0x5 opt 0x52 flag 0x2 len 192 mtu 1500 state EXSTART
*Jan 8 05:18:33.979: OSPF-1 ADJ Et0/1: Nbr 2.2.2.2 has larger interface MTU
R3#sh ip int e0/1
Ethernet0/1 is up, line protocol is up
Internet address is 192.168.23.3/24
Broadcast address is 255.255.255.255
Address determined by setup command
MTU is 1499 bytes
Helper address is not set
Directed broadcast forwarding is disabled
Multicast reserved groups joined: 224.0.0.5 224.0.0.6
可以设置忽略mtu值来建立邻居
参考链接:
https://www.cisco.com/c/zh_cn/support/docs/ip/open-shortest-path-first-ospf/119384-technote-ospf-00.html
R3(config)#int e0/1
R3(config-if)#ip ospf mtu-ignore
*Jan 8 05:25:30.527: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Ethernet0/1 from LOADING to FULL, Loading Done
R3(config-if)#end
R3#sh ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:00:39 192.168.23.2 Ethernet0/1
7. 优先级都为0
修改R2和R3的priority为0,OSPF状态2WAY
R2(config)#int e0/1
R2(config-if)#ip os priority 0
R3(config)#int e0/1
R3(config-if)#ip os priority 0
排错
R2#sh ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/BDR 00:00:36 192.168.12.1 Ethernet0/0
3.3.3.3 0 2WAY/DROTHER 00:00:36 192.168.23.3 Ethernet0/1
R3#sh ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 2WAY/DROTHER 00:00:37 192.168.23.2 Ethernet0/1
R3#sh run int e0/1
Building configuration...
Current configuration : 106 bytes
!
interface Ethernet0/1
ip address 192.168.23.3 255.255.255.0
ip ospf priority 0
ip ospf 1 area 1
end
8. 掩码不一致
修改R3的ip地址为192.168.23.3 255.255.255.248,OSPF状态DOWN
R3(config)#int e0/1
R3(config-if)#ip add 192.168.23.3 255.255.255.248
排错
R3#debug ip os hello
OSPF hello debugging is on
R3#
*Jan 8 15:02:37.667: OSPF-1 HELLO Et0/1: Send hello to 224.0.0.5 area 1 from 192.168.23.3
R3#
*Jan 8 15:02:43.381: OSPF-1 HELLO Et0/1: Rcv hello from 2.2.2.2 area 1 192.168.23.2
*Jan 8 15:02:43.382: OSPF-1 HELLO Et0/1: Mismatched hello parameters from 192.168.23.2
*Jan 8 15:02:43.382: OSPF-1 HELLO Et0/1: Dead R 40 C 40, Hello R 10 C 10 Mask R 255.255.255.0 C 255.255.255.248
邻居关系不能建立的原因:
OSPF需要对接收到的Hello报文做网络掩码检查,当接收到的Hello报文中携带的网络掩码和本设备不一致时,则丢弃这个Hello报文,即不能建立邻居关系。
参考链接:
https://cshihong.github.io/2017/10/20/OSPF%E5%91%BD%E4%BB%A4%E8%A1%8C%E9%85%8D%E7%BD%AE/
9 接口下OSPF网络类型不匹配
9.1 修改R3的网络类型为NON_BROADCAST,OSPF状态DOWN
R3(config)#int e0/1
R3(config-if)#ip ospf network non-broadcast
排错
R3#sh ip os int e0/1
Ethernet0/1 is up, line protocol is up
Internet Address 192.168.23.3/24, Area 1, Attached via Interface Enable
Process ID 1, Router ID 3.3.3.3, Network Type NON_BROADCAST, Cost: 10
R3#debug ip ospf hello
OSPF hello debugging is on
*Jan 8 15:16:57.077: OSPF-1 HELLO Et0/1: Rcv hello from 2.2.2.2 area 1 192.168.23.2
*Jan 8 15:16:57.077: OSPF-1 HELLO Et0/1: Mismatched hello parameters from 192.168.23.2
*Jan 8 15:16:57.077: OSPF-1 HELLO Et0/1: Dead R 40 C 120, Hello R 10 C 30 Mask R 255.255.255.0 C 255.255.255.0
9.2 修改R3的网络类型为POINT_TO_POINT ,OSPF状态FULL
R3(config)#int e0/1
R3(config-if)#ip ospf network POINT_TO_POINT
排错
R3#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - 00:00:33 192.168.23.2 Ethernet0/1
R3#sh ip route os
Codes: L - local, C - connected, S - static, 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
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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is not set
R3#
*Jan 8 15:39:28.271: OSPF-1 ADJ Et0/1: Nbr 2.2.2.2: Clean-up dbase exchange
R3#sh ip os int e0/1
Ethernet0/1 is up, line protocol is up
Internet Address 192.168.23.3/24, Area 1, Attached via Interface Enable
Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 10
造成此现象的原因:
是因为OSPF路由设备需要LSDB来构建Shortest Path Tree,本区域内的路由计算依靠的是Router LSA,而P2P和广播网络类型虽然Link Data都是接口IP,但是Link ID中P2P是对端的RID,而广播链路的Link ID是DR的IP,这样一来路由是无法计算出来的。
来源:
http://support.huawei.com/enterprise/KnowledgebaseReadAction.action?contentId=KB1000052810
http://blog.sina.com.cn/s/blog_c53f936c0102w8lq.html
10. passive-interface
修改R3的端口为passive-interface,OSPF状态DOWN
R3(config)#router os 1
R3(config-router)#passive-interface e0/1
R3(config-router)#end
*Jan 9 01:33:47.019: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Ethernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
排错
R3# sh ip os int e0/1
Ethernet0/1 is up, line protocol is up
Internet Address 192.168.23.3/24, Area 1, Attached via Interface Enable
Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10
Topology-MTID Cost Disabled Shutdown Topology Name
0 10 no no Base
Enabled by interface config, including secondary ip addresses
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 3.3.3.3, Interface address 192.168.23.3
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
No Hellos (Passive interface)
R3#debug ip ospf packet
OSPF packet debugging is on
R3#
R3#
R3#
*Jan 9 05:36:40.315: OSPF-1 PAK Et0/1: Drop packet, OSPF not running or passive
R3#
*Jan 9 05:36:49.843: OSPF-1 PAK Et0/1: Drop packet, OSPF not running or passive
11. Hello包被ACL deny
在R3做ACL,OSPF状态INIT
R3(config)# access-list 1 deny 2.2.2.2 log
R3(config)#int e0/1
R3(config-if)#ip access-group 1 in
排错
R2#sh ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:36 192.168.12.1 Ethernet0/0
3.3.3.3 1 INIT/DROTHER 00:00:34 192.168.23.3 Ethernet0/1
R2#debug ip os hello
OSPF hello debugging is on
R2#
*Jan 9 06:31:13.927: OSPF-1 HELLO Et0/0: Send hello to 224.0.0.5 area 0 from 192.168.12.2
R2#
*Jan 9 06:31:17.623: OSPF-1 HELLO Et0/1: Send hello to 224.0.0.5 area 1 from 192.168.23.2
R2#
*Jan 9 06:31:20.817: OSPF-1 HELLO Et0/1: Rcv hello from 3.3.3.3 area 1 192.168.23.3
*Jan 9 06:31:20.817: OSPF-1 HELLO Et0/1: No more immediate hello for nbr 3.3.3.3, which has been sent on this intf 2 times
*Jan 9 06:31:20.877: OSPF-1 HELLO Et0/0: Rcv hello from 1.1.1.1 area 0 192.168.12.1
R2#
*Jan 9 06:31:23.283: OSPF-1 HELLO Et0/0: Send hello to 224.0.0.5 area 0 from 192.168.12.2
R2#
*Jan 9 06:31:27.452: OSPF-1 HELLO Et0/1: Send hello to 224.0.0.5 area 1 from 192.168.23.2
R2#
*Jan 9 06:31:29.924: OSPF-1 HELLO Et0/0: Rcv hello from 1.1.1.1 area 0 192.168.12.1
*Jan 9 06:31:30.152: OSPF-1 HELLO Et0/1: Rcv hello from 3.3.3.3 area 1 192.168.23.3
*Jan 9 06:31:30.152: OSPF-1 HELLO Et0/1: No more immediate hello for nbr 3.3.3.3, which has been sent on this intf 2 times
参考链接:
http://blog.sina.com.cn/s/blog_140ab62490102xj06.html
http://blog.sina.com.cn/s/blog_d04b04270101h3r4.html