ospf邻接关系不能建立总结

2018年6月30日00:54:12 发表评论 1,713 views

一、OSPF不能正确接收报文

(1)接口上没有激活OSPF

(2)物理层或者链路层协议down

(3)OSPF的组播地址被ACL block

(4)建立邻居的接口被passive 

实验 

实验准备:R1和R2运行OSPF,passive R2的F0/0

实验配置:

R1:

interface FastEthernet0/0

 ip address 192.168.12.1 255.255.255.0

router ospf 100

 router-id 1.1.1.1

 log-adjacency-changes

 network 192.168.12.1 0.0.0.0 area 0

R2:

interface FastEthernet0/0

 ip address 192.168.12.2 255.255.255.0

router ospf 100

 router-id 2.2.2.2

 log-adjacency-changes

 passive-interface FastEthernet0/0

 network 192.168.12.2 0.0.0.0 area 0

实验结果:

在R2上查看OSPF端口状态

R2#sh ip ospf interface f0/0

FastEthernet0/0 is up, line protocol is up

No Hellos (Passive interface)

在R2上debug:

*Mar  1 00:17:47.087: IP: s=192.168.12.1 (FastEthernet0/0), d=224.0.0.5, len 76, rcvd 0

R2上收到了R1发来的hello包,但不接受也不发送

结论:

被置于passive的接口不发送和接受任何信息

 

二、hello包信息不匹配

(1)hello时间间隔不匹配 

实验准备:R1和R2运行OSPF,更改R2的f0/0口hello时间为20s

实验配置:

R1:

interface FastEthernet0/0

 ip address 192.168.12.1 255.255.255.0

router ospf 100

 router-id 1.1.1.1

 log-adjacency-changes

 network 192.168.12.1 0.0.0.0 area 0

R2:

interface FastEthernet0/0

 ip address 192.168.12.2 255.255.255.0

ip ospf hello-interval 20

router ospf 100

 router-id 2.2.2.2

 log-adjacency-changes

network 192.168.12.2 0.0.0.0 area 0

实验结果:

R1和R2不能建立邻接关系

在R1上debug ip ospf hello

R1#debug ip ospf hello

OSPF hello events debugging is on

R1#

*Mar  1 00:41:07.795: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.12.1

*Mar  1 00:41:17.795: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.12.1

*Mar  1 00:41:19.859: OSPF: Rcv hello from 2.2.2.2 area 0 from FastEthernet0/0 192.168.12.2

*Mar  1 00:41:19.859: OSPF: Mismatched hello parameters from 192.168.12.2

*Mar  1 00:41:19.863: OSPF: Dead R 80 C 40, Hello R 20 C 10  Mask R 255.255.255.0 C 255.255.255.0

说明:

1. 如果修改了hello时间,则dead时间和wait时间会自动修改成修改参数的4倍。

2. 如果修改dead时间或者wait时间, hello时间不发生变化,而wait时间发生变化。

3. 不能修改wait时间

(2)区域ID不匹配

实验准备:R1的f0/0在area 0,R2的f0/0在area 1

实验配置:

R1:

router ospf 100

 router-id 1.1.1.1

 log-adjacency-changes

 network 192.168.12.1 0.0.0.0 area 0

R2:

router ospf 100

 router-id 2.2.2.2

 log-adjacency-changes

network 192.168.12.2 0.0.0.0 area 1

实验结果:

R1和R2不能建立邻接关系

在R1上debug

R1#

*Mar  1 01:13:41.151: OSPF: Rcv pkt from 192.168.12.2, FastEthernet0/0, area 0.0.0.0  mismatch area 0.0.0.1 in the header

(3)Stub/transit/NSSA 区域类型不匹配

实验准备:R1的f0/0在area1,R2的f0/0在area 1且为stub

实验配置:

R1:

router ospf 100

 router-id 1.1.1.1

 log-adjacency-changes

 network 192.168.12.1 0.0.0.0 area 1

R2:

router ospf 100

 router-id 2.2.2.2

 log-adjacency-changes

network 192.168.12.2 0.0.0.0 area 1

area 1 stub

实验结果:

R1和R2不能建立邻接关系

在R1上debug ip ospf events

R1#debug ip ospf events

OSPF events debugging is on

R1#

*Mar  1 01:27:33.179: OSPF: Send hello to 224.0.0.5 area 1 on FastEthernet0/0 from 192.168.12.1

*Mar  1 01:27:33.363: OSPF: Rcv hello from 2.2.2.2 area 1 from FastEthernet0/0 192.168.12.2

*Mar  1 01:27:33.363: OSPF: Hello from 192.168.12.2 with mismatched Stub/Transit area option bit

(4)认证方式或者认证密码不匹配

实验准备:R1和R2运行OSPF,R1和R2的认证方式不一致

实验配置:

R1:

interface FastEthernet0/0

 ip address 192.168.12.1 255.255.255.0

 ip ospf authentication

 ip ospf authentication-key 1 cisco

R2:

interface FastEthernet0/0

 ip address 192.168.12.2 255.255.255.0

 ip ospf authentication message-digest

 ip ospf message-digest-key 1 md5 cisco

实验结果:

R1和R2不能建立邻接关系

在R1上debug ip ospf adj

R1#debug ip ospf adj

OSPF adjacency events debugging is on

R1#

*Mar  1 01:47:33.531: OSPF: Rcv pkt from 192.168.12.2, FastEthernet0/0 : Mismatch Authentication type. Input packet specified type 2, we use type 1

(5)广播链路上子网掩码不匹配

实验准备:R1和R2运行OSPF,R1和R2的f0/0掩码分别为24位和30位

实验配置:

R1:

interface FastEthernet0/0

 ip address 192.168.12.1 255.255.255.0

R2:

interface FastEthernet0/0

 ip address 192.168.12.2 255.255.255.252

实验结果:

R1和R2 OSPF不能建立邻接关系

R1#debug ip ospf hello

OSPF hello events debugging is on

R1#

*Mar  1 01:55:22.687: OSPF: Send hello to 224.0.0.5 area 1 on FastEthernet0/0 from 192.168.12.1

*Mar  1 01:55:23.539: OSPF: Rcv hello from 2.2.2.2 area 1 from FastEthernet0/0 192.168.12.2

*Mar  1 01:55:23.539: OSPF: Mismatched hello parameters from 192.168.12.2

*Mar  1 01:55:23.543: OSPF: Dead R 40 C 40, Hello R 10 C 10  Mask R 255.255.255.252 C 255.255.255.0

 

三、用Secondary地址建邻居

实验准备:R1和R2运行OSPF,配置172.16.12.0/24为R1和R2的secondary地址,用辅助地址建立邻接关系

实验配置:

R1:

interface FastEthernet0/0

 ip address 192.168.12.1 255.255.255.0

 ip address 172.16.12.1 255.255.255.0 secondary

router ospf 100

 router-id 2.2.2.2

 log-adjacency-changes

 network 172.16.12.1 0.0.0.0 area 0

R2:

interface FastEthernet0/0

 ip address 192.168.12.2 255.255.255.0

 ip address 172.16.12.2 255.255.255.0 secondary

router ospf 100

 router-id 2.2.2.2

 log-adjacency-changes

 network 172.16.12.2 0.0.0.0 area 0

实验结果:

R1和R2不能建立邻接关系

在R2上debug ip ospf hello

可以发现:虽然已经将172.16.12.0/24宣告到ospf 100,但是没有任何hello发出。

在R1和R2上宣告主地址192.168.12.0/24,R1和R2建立正常的邻接关系

在R2上debug ip ospf hello

*R2#debug ip ospf hello

OSPF hello events debugging is on

R2#

*Mar  1 00:06:26.991: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.12.2

*Mar  1 00:06:30.503: OSPF: Rcv hello from 1.1.1.1 area 0 from FastEthernet0/0 192.168.12.1

*Mar  1 00:06:30.503: OSPF: End of hello processing

结论:

OSPF把辅助地址看着是末梢网络,从而不会在这些网络发送hello报文。因此,在辅助地址上无法建立邻接关系。

四、Router-id相同

实验准备:R1和R2运行OSPF,R1和R2的router-id都为1.1.1.1

实验配置:

R1:

router ospf 100

 router-id 1.1.1.1

 log-adjacency-changes

 network 192.168.12.1 0.0.0.0 area 0

R2:

router ospf 100

 router-id 1.1.1.1

 log-adjacency-changes

 network 192.168.12.2 0.0.0.0 area 0

实验结果:

R1和R2不能建立邻接关系

OSPF detected duplicate router-id 1.1.1.1 from 192.168.12.1 on interface FastEthernet0/0

提示router-id一样

若router-id一样,在广播链路上不能确定DR和BDR;在点到点链路上master和slave关系不能确定。

五、在广播链路上优先级都是0

实验准备:R1和R2运行OSPF,R1和R2的f0/0口OSPF优先级都配置为0

实验配置:

R1:

interface FastEthernet0/0

 ip address 192.168.12.1 255.255.255.0

ip ospf priority 0

R2:

interface FastEthernet0/0

 ip address 192.168.12.2 255.255.255.0

ip ospf priority 0

实验结果:

R1和R2停留在2way状态

在R2上debug ip ospf event

R2#debug ip ospf adj

OSPF adjacency events debugging is on

*Mar  1 04:23:18.542: OSPF: Cannot see ourself in hello from 1.1.1.1 on FastEthernet0/0, state INIT

*Mar  1 04:23:18.542: OSPF: Neighbor change Event on interface FastEthernet0/0

*Mar  1 04:23:18.546: OSPF: DR/BDR election on FastEthernet0/0

*Mar  1 04:23:18.546: OSPF: Elect BDR 0.0.0.0

*Mar  1 04:23:18.546: OSPF: Elect DR 0.0.0.0

*Mar  1 04:23:18.546:        DR: none    BDR: none

*Mar  1 04:23:19.046: OSPF: Reset old DR on FastEthernet0/0

*Mar  1 04:23:19.046: OSPF: Build router LSA for area 0, router ID 2.2.2.2, seq 0x80000003, process 10

*Mar  1 04:23:28.530: OSPF: 2 Way Communication to 1.1.1.1 on FastEthernet0/0, state 2WAY

结论:由于优先级都为0,均不能成为DR和BDR,只能停留在2WAY状态

六、MTU不匹配

实验准备:R1和R2运行OSPF,R2的f0/0口MTU为1000

实验配置:

R2:

interface FastEthernet0/0

 ip address 192.168.12.2 255.255.255.0

ip mtu 1000

实验结果:

R1和R2邻接关系无法正常建立,OSPF的状态机一直处理Exstart和Down之间来回跳转。

在R2上debug ip ospf event

*Mar  1 04:45:20.358: OSPF: Rcv DBD from 1.1.1.1 on FastEthernet0/0 seq 0x1F6B opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART

*Mar  1 04:45:20.358: OSPF: Nbr 1.1.1.1 has larger interface MTU

结论:

在Exstart阶段进行DBD包协商主从关系时会比较MTU值,如果两边DBD报文中的MTU参数相互之间不符合将会协商不成功。在DBD报文中进行MTU的比较的原因主要是由于DBD报文的内容比较大,如果两边的MTU值不一致的话很可能会造成DBD包丢弃,所以会在Exstart过程中增加MTU的协商过程。所以对OSPF邻居关系的端口MTU一致性进行检查。

解决方法:

把MTU大的改小,或者在MTU小的一端执行ip ospf mtu-ignore(忽略检查OSPF的MTU)。

 

转自http://blog.sina.com.cn/s/blog_6dc951ef01011k3o.html

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: