第二十五讲:OSPF路由协议邻居认证配置

      在相同OSPF区域的路由器上启用身份验证的功能,只有经过身份验证的同一区域的路由器才能互相通告路由信息。这样做不但可以增加网络安全性,对OSPF重新配置时,不同口令可以配置在新口令和旧口令的路由器上,防止它们在一个共享的公共广播网络的情况下互相通信。

实验拓扑图如下所示

操作步骤:

步骤1:如图1所示,连接网络拓扑图。

步骤2:配置路由器A的主机名称和接口IP地址

Router>enable

Router#config

Router_config#hostname Router-A

Router-A_config#int s0/1

Router-A_config_s0/1#ip add 172.16.24.1 255.255.255.0

Router-A_config_s0/1#no shutdown

Router-A_config_s0/1#int loopback 0

Router-A_config_l0#ip add 10.10.10.1 255.255.255.0

步骤3:配置路由器B的主机名称和接口IP地址

Router_config#hostname Router-B

Router-B_config#

Router-B_config#int s0/2

Router-B_config_s0/2#ip add 172.16.24.2 255.255.255.0

Router-B_config_s0/2#physical-layer speed 64000

Router-B_config_s0/2#no shutdown

Router-B_config_s0/2# int loopback 0

Router-B_config_l0#ip add 11.10.10.1  255.255.255.0

步骤4:将Router-A、B相应接口按照拓扑加入area0。

Router-A_config#router ospf 1

Router-A_config_ospf_1#network 172.16.24.0 255.255.255.0 area 0

Router-B_config#router ospf 1

Router-B_config_ospf_1#network 172.16.24.0 255.255.255.0 area 0

步骤5:为Router-A接口配置MD5密文验证。

Router-A:

Router-A_config# interface S0/1

Router-A_config_s0/1#ip ospf message-digest-key 1 md5 DCNU

           !采用MD5加密,密码为DCNU

Router-A_config_s0/1#ip ospf authentication message-digest

在RA上配置好后,启用debug ip ospf packet可以看到:

2002-1-1 00:02:39 OSPF: Send HELLO to 224.0.0.5 on Serial0/2

2002-1-1 00:02:39       HelloInt 10 Dead 40 Opt 0x2 Pri 1 len 44

2002-1-1 00:02:49 OSPF: Recv IP_SOCKET_RECV_PACKET message

2002-1-1 00:02:49 OSPF: Entering ospf_recv

2002-1-1 00:02:49 OSPF: Recv a packet from source: 172.16.24.2 dest 224.0.0.5

2002-1-1 00:02:49 OSPF: ERR recv PACKET, auth type not match

2002-1-1 00:02:49 OSPF: ERROR! events 21

这是因为RA发送了key-id为1的key,但是RB还上没有配置验证,所以会出现验证类型不匹配的错误。

步骤6:为Router-B接口配置MD5密文验证。

Router-B_config# interface S0/2

Router-B_config_s0/2#ip ospf message-digest-key 1 md5 DCNU    

            !定义key和密码

Router-B_config_s0/2#ip ospf authentication message-digest      

            !定义认证类型为MD5

步骤7:查看邻居关系。

                  Router-A#sh ip ospf neighbor

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

OSPF process: 1

                                      AREA: 0

Neighbor ID     Pri   State            DeadTime   Neighbor Addr   Interface

11.10.10.1      1     FULL/-           37         172.16.24.2     Serial0/2

                                                                                     !邻居关系已经建立。

步骤8:删除掉接口认证的配置,然后进行OSPF区域密文验证。

Router-A:

Router-A_config_ospf_1#area 0 authentication message-digest

Router-B:

Router-B_config_ospf_1#area 0 authentication message-digest

步骤9:查看邻居关系。

                  Router-A#sh ip ospf neighbor

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

OSPF process: 1

                                      AREA: 0

Neighbor ID     Pri   State            DeadTime   Neighbor Addr   Interface

11.10.10.1      1     FULL/-           37         172.16.24.2     Serial0/2

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

                                                                                          !邻居关系已经建立。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北方的流星

你的鼓励是我创作最大动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值