Cisco思科路由器配置OSPF认证的简单例子

需求:
两台路由器之间配置OSPF认证,只有通过认证才能建立OSPF邻居关系。

实验拓扑:
拓扑图
配置:

1. 配置各端口的IP地址
R1:
R1(config)#int loopback1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#int e0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit

R2:
R2(config)#int loopback1
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#int e0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit

2. 配置OSPF协议
R1:
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 1.1.1.0 0.0.0.255 area 0
R1(config-router)#network 192.168.12.0 0.0.0.255 area 0
R1(config-router)#exit

R2:
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 2.2.2.0 0.0.0.255 area 0
R2(config-router)#network 192.168.12.0 0.0.0.255 area 0
R2(config-router)#exit

3.配置OSPF明文认证(第3.4步骤选一条配置即可)
R1:
R1(config)#int e0/0
R1(config-if)#ip ospf authentication-key cisco		//cisco是密码
R1(config-if)#ip ospf authentication				//基于接口开启认证
R1(config-if)#exit
//以下是基于整个区域0开启认证
//R1(config)#router ospf 1
//R1(config-router)#area 0 authentacation	

R2:
R2(config)#int e0/0
R2(config-if)#ip ospf authentication-key cisco		//两边密码必须一致才能建立邻居关系
R2(config-if)#ip ospf authentication
R2(config-if)#exit

4. 配置密文密码认证(第3.4步骤选一条配置即可)
R1:
R1(config)#int e0/0
R1(config-if)#ip ospf message-digest-key 1 md5 cisco		//指定为MD5加密,Key ID为1, 密码为cisco
R1(config-if)#ip ospf authentication message-digest			//基于接口开启认证,同样也可以基于区域开启,命令如3一样,不做复述
R1(config-if)#exit

R2:
R2(config)#int e0/0
R2(config-if)#ip ospf message-digest-key 1 md5 cisco
R2(config-if)#ip ospf authentication message-digest
R2(config-if)#exit

当我只完成R1的认证配置时,会发现如下信息:
在这里插入图片描述说明R1和R2之间建立的OSPF邻居关系不存在了,也可以用show ip ospf neighbor查看,此时发现一已经没有邻居关系。

接下来继续完成R2的认证配置后,会发现邻居又重新建立了。
在这里插入图片描述
检查邻居关系:
在这里插入图片描述在这里插入图片描述

本文原创,转载请注明出处

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章