区域认证首先在OSPF进程下执行区域认证,然后在接口模式配置message-digest-key,配置如下:


R1:

router ospf 100
router-id 1.1.1.1
area 0 authentication message-digest启用区域认证
network 1.1.1.0 0.0.0.255 area 0
network 12.1.1.0 0.0.0.255 area 0


interface FastEthernet 0/0
ip address 12.1.1.1 255.255.255.0
ip ospf message-digest-key 1 md5 cisco  配置认证密钥,此处的密钥串“1"两端需一致

R2:

router ospf 100
router-id 2.2.2.2
area 0 authentication message-digest
network 2.2.2.0 0.0.0.255 area 0
network 12.1.1.0 0.0.0.255 area0
network 23.1.1.0 0.0.0.255 area 1


interface FastEthernet 0/1
ipaddress 12.1.1.2 255.255.255.0
ip ospf message-digest-key 1 md5 cisco


---------------------------------------------------------------


接口认证首先在接口模式下启用接口认证,然后在接口模式配置message-digest-key,配置如下:


R2:

interface FastEthernet 0/0
ip address 23.1.1.2 255.255.255.0
ip ospf authentication message-digest  在接口启用认证模式
ip ospf message-digest-key 1 md5 cisco123  在接口配置密钥,注意密钥串“1”两端一致


R3:

interface FastEthernet 0/1
ip address 23.1.1.3 255.255.255.0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 cisco123



show ip ospf neighbor查看OSPF邻居表


R2邻居表:

Neighbor ID  Pri State DeadTime  Address  Interface
1.1.1.1  1  FULL/BDR  00:00:30  12.1.1.1  FastEthernet 0/1
3.3.3.3  1  FULL/DR   00:00:39  23.1.1.3  FastEthernet 0/0


实验结束!