OSPFV2首要职责不是对数据进行转发,而是通过路由器之间的互相更新信息来构成新的路由表的
1.区域明文、密文认证
区域密文认证:
R1(config-router)#area 1 authentication message-digest
R1(config-if)#ip osp message-digest-key 1 md5 123
区域明文认证:
R1(config-router)#area 1 authentication
R1(config-router)#in g 0/0
R1(config-if)#ip osp authentication-key 123
在路由器R1和R2上配置基于区域的明文认证(以R1为例)
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 10.1.1.0 0.0.0.255 area 1
R1(config-router)#network 10.1.2.0 0.0.0.255 area 1
R1(config-router)#network 10.0.12.0 0.0.0.255 area 1
R1(config-router)#area 1 authentication
R1(config-router)#interface gigabitEthernet 0/0
R1(config-if)#ip ospf authentication-key cisco
在路由器R3和R4上配置基于接口的MD5认证(以R3为例)
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 10.0.23.0 0.0.0.255 area 0
R3(config-router)#network 10.0.34.0 0.0.0.255 area 2
R3(config-router)#interface gigabitEthernet 0/0
R3(config-if)#ip ospf authentication message-digest
R3(config-if)#ip ospf message-digest-key 1 md5 cisco
2.介于接口之间的区域认证
1.接口之间的明文认证
R1(config)#in g 0/1
R1(config-if)#ip ospf authentication
R1(config-if)#ip ospf authentication-k
R1(config-if)#ip ospf authentication-key 123
R1(config-if)#e
2.接口之间的密文认证
R1(config)#in g 0/1
R1(config-if)#ip ospf authentication me
R1(config-if)#ip ospf authentication message-digest
R1(config-if)#ip ospf me
R1(config-if)#ip ospf message-digest-key 1 m
R1(config-if)#ip ospf message-digest-key 1 md5 123
R1(config-if)#