1》R1的配置
Router(config)#router ospf 1
Router(config-router)#router-id 1.1.1.1
Router(config-router)#network 1.1.1.0 0.0.0.255 area 0
Router(config-router)#network 192.168.12.0 0.0.0.255 area 0
Router(config)#interface s0/3/0
Router(config-if)#ip ospf authentication message-digest
Router(config-if)#ip ospf message-digest-key 1 md5 cisco
2》R2做同样的配置,二者的密码一定要一致
3》调试
Router#show ip ospf interface s0/3/0
Serial0/3/0 is up, line protocol is up
Internet address is 192.168.12.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type POINT-TO-POINT, Cost: 781
Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
No designated router on this network
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:00
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 0 msec
Neighbor Count is 1 , Adjacent neighbor count is 1
Adjacent with neighbor 2.2.2.2
Suppress hello for 0 neighbor(s)
Message digest authentication enabled
Youngest key id is 1
输出的最后两行表明该接口启用了MD5认证,而且密钥ID为1.