前晚做了个实验,本来是OSPF与RIP双出口重分配的实验,在配置OSPF接口认证时意外的发现了一个问题,便把其记下,以便日后复习参考。
R2#show run
interface Serial1/1
description DCE,OSPF area 0,connected to R3's S1/0,ip 172.16.255.2/30
ip address 172.16.255.1 255.255.255.252
ip ospf message-digest-key 1 md5 a0_key
serial restart-delay 0
description DCE,OSPF area 0,connected to R3's S1/0,ip 172.16.255.2/30
ip address 172.16.255.1 255.255.255.252
ip ospf message-digest-key 1 md5 a0_key
serial restart-delay 0
router ospf 100
router-id 2.2.2.2
log-adjacency-changes
area 0 authentication message-digest
redistribute rip subnets
network 172.16.255.0 0.0.0.3 area 0
!
router-id 2.2.2.2
log-adjacency-changes
area 0 authentication message-digest
redistribute rip subnets
network 172.16.255.0 0.0.0.3 area 0
!
/////////////////////////////////////////////////////////////////
R3(config-if)#do show run
interface Serial1/0
description DTE,OSPF area 0,connected to R2's S1/1,ip 172.16.255.1/30
ip address 172.16.255.2 255.255.255.252
ip ospf message-digest-key 1 md5 a0_key
serial restart-delay 0
!
description DTE,OSPF area 0,connected to R2's S1/1,ip 172.16.255.1/30
ip address 172.16.255.2 255.255.255.252
ip ospf message-digest-key 1 md5 a0_key
serial restart-delay 0
!
router ospf 100
router-id 3.3.3.3
log-adjacency-changes
area 0 authentication message-digest
network 172.16.0.0 0.0.255.255 area 0
!
router-id 3.3.3.3
log-adjacency-changes
area 0 authentication message-digest
network 172.16.0.0 0.0.255.255 area 0
!
检查发现R2的接口没有配置时钟速率,加上一句:
R2(config-if)#clock rate 9600
开始检查,发现R3没有标志为E2的路由。说明RIP根本没有重分配到OSPF。
检查邻居:
R2#show ip ospf nei
R2#
R2没有与R3建立邻居关系。
比较两者的配置,没有任何差别。无奈只好进行debug。对于这种故障排除,推荐debug events。
R2#debug ip ospf events
OSPF events debugging is on
R2#
*May 9 00:20:49.283: OSPF: Send with youngest Key 1
*May 9 00:20:49.283: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/1 from 172.16.255.1
R2#
*May 9 00:20:55.771: OSPF: Rcv pkt from 172.16.255.2, Serial1/1 : Mismatch Authentication Key - Message Digest Key 1
R2#
OSPF events debugging is on
R2#
*May 9 00:20:49.283: OSPF: Send with youngest Key 1
*May 9 00:20:49.283: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/1 from 172.16.255.1
R2#
*May 9 00:20:55.771: OSPF: Rcv pkt from 172.16.255.2, Serial1/1 : Mismatch Authentication Key - Message Digest Key 1
R2#
R3进行debug adj
R3#debug ip ospf adj
OSPF adjacency events debugging is on
R3#
*May 9 00:24:26.499: OSPF: Send with youngest Key 1
*May 9 00:24:26.555: OSPF: Send with youngest Key 1
R3#
*May 9 00:24:30.027: OSPF: Rcv pkt from 172.16.255.1, Serial1/0 : Mismatch Authentication Key - Message Digest Key 1
R3#
OSPF adjacency events debugging is on
R3#
*May 9 00:24:26.499: OSPF: Send with youngest Key 1
*May 9 00:24:26.555: OSPF: Send with youngest Key 1
R3#
*May 9 00:24:30.027: OSPF: Rcv pkt from 172.16.255.1, Serial1/0 : Mismatch Authentication Key - Message Digest Key 1
R3#
同样是报mesmatch authentication key,但是完全看不出任何问题。
baidu了一下该错误提示,发现是key的内容不匹配,需要重新建立key
由于之前修改过S1/1的配置,加了时钟频率,故可能是s1/1的md5与之前交换的md5码不同了,对R2的S1/1口进行处理。
R2(config)#in s1/1
R2(config-if)#no ip ospf me 1 m a0_key
R2(config-if)#ip ospf me 1 m a0_key
R2(config-if)#no ip ospf me 1 m a0_key
R2(config-if)#ip ospf me 1 m a0_key
*May 9 00:31:56.095: %OSPF-5-ADJCHG: Process 100, Nbr 3.3.3.3 on Serial1/1 from LOADING to FULL, Loading Done
可能是R2中的MD5码从输入开始就进行了交换,其中包括了接口的各种特征值,由于之后配了clock rate,因而算出来的MD5与之前交换的MD5不同,导致R3拒绝了这些认证包,导致了无法进行建立邻居。奉劝各位日后配置OSPF认证时,待确认端口配置无误时再输入配置信息,否则会造成两次算出的MD5值有差别,而导致毗邻关系建立失败。
本文转自 gole_huang 51CTO博客,原文链接:http://blog.51cto.com/golehuang/76203