Cisco实验ospf协议中接口与区域验证配置及区域中特殊性虚电路配置

ospf支持简单口令认证和MD5验证,认证分两种:
1)接口验证:明文和密文:可以按照直连来做
2)区域验证:明文和密文:一个区域内的所有设备都得做
注:区域验证中虚电路属于区域0.

一、 接口与区域验证

配置条件:接口与区域验证需要用到两个及以上路由器,本次实验以三个为基准,分别为R1、R2和R3.一字连接,其中R1与R2之间为区域0,用来做接口与区域明文验证,R2与R3之间为区域1,用来做接口与区域密文验证。例图解析如下
在这里插入图片描述
其中各地址条件(标记为第三节条件):
R1:lo0:1.1.1.1 s0/0:12.1.1.1
R2:lo0:2.2.2.2 s0/0:12.1.1.2 s0/1:23.1.1.2
R3:lo0:3.3.3.3 s0/1:23.1.1.3 s0/2:34.1.1.3
R4:lo0:4.4.4.4 s0/2:34.1.1.4

在这里插入图片描述

1.接口明文验证

对R1进行基本配置
R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int s0/0
R1(config-if)#ip add 12.1.1.1 255.255.255.0
R1(config-if)#no sh

R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#network 12.1.1.1 0.0.0.0 area 0

对R2进行基本配置
R2(config)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s0/0
R2(config-if)#ip add 12.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s0/1
R2(config-if)#ip add 23.1.1.2 255.255.255.0
R2(config-if)#no sh

R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R2(config-router)#network 12.1.1.2 0.0.0.0 area 0
R2(config-router)#network 23.1.1.2 0.0.0.0 area 1

接口明文配置:
R1(config)#int s0/0
R1(config-if)#ip ospf authentication//开启OSPF接口明文验证
R1(config-if)#ip ospf authentication-key fuckcisc//明文验证的密码

R2(config)#int s0/0
R2(config-if)#ip ospf authentication
R2(config-if)#ip ospf authentication-key fuckcisc

当只对R1或R2其中一个配置,就会出现下面如图所示(下图为只对R1进行配置)配置前进行show IP router 展示图片上半部,但中间会显示==*Mar 1 00:49:08.187: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0 from FULL to DOWN, Neighbor Down: Dead timer expired。==说明R2接口从FULL到DOWN,因此下面继续show IP router的表不再包含R2地址。
在这里插入图片描述
下面继续对R2进行配置
在这里插入图片描述
配置完成后在R2上show ip route会显示R1所有的地址
在这里插入图片描述
再接着看R1的路由条目,会发现消失的R2地址会重新出现。
在这里插入图片描述
所以我们此时在R1、R2的s0/0端口进行了明文验证,即两边密文都是cisco都为一样,所以可以连通。且大家可以试一下密文不同,两个路由器之间也并不会连通。

2.接口密文验证

密文配置与明文配置方法几乎不变,改变的是上面明文配置下的代码:
接口密文验证:
R2(config)#int s0/1
R2(config-if)#ip ospf authentication message-digest//开启密文验证
R2(config-if)#ip ospf message-digest-key 1 md5 fuckcisco//密文验证的密码,注意 key ID要一样

R3(config)#int s0/1
R3(config-if)#ip ospf authentication message-digest
R3(config-if)#ip ospf message-digest-key 1 md5 fuckcisco

3.区域明文验证

R1(config)#router ospf 1
R1(config-router)#area 0 authentication
R1(config)#int s0/0
R1(config-if)#ip ospf authentication-key cisco

R2(config)#router ospf 1
R2(config-router)#area 0 authentication
R2(config)#int s0/0
R2(config-if)#ip ospf authentication-key cisco

4.区域密文验证

R2(config)#router ospf 1
R2(config-router)#area 1 authentication message-digest
R2(config)#int s0/1
R2(config-if)#ip ospf message-digest-key 1 md5 cisco

R3(config)#router ospf 1
R3(config-router)#area 1 authentication message-digest
R3(config)#int s0/1
R3(config-if)#ip ospf message-digest-key 1 md5 cisco

==2.3.4与1中配置一样,唯一改变的就是在ospf协议下命令的不同,上面把不同的命令都给出来,大家可以尝试一下。

二、 区域下虚电路验证

在这里插入图片描述
切记:虚电路是属于区域0的
对R1~R4进行验证配置
虚电路验证配置是在R2、R3上的。
虚电路明文验证:
R2(config)#router ospf 1
R2(config-router)#area 1 virtual-link 3.3.3.3 authentication
R2(config-router)#area 1 virtual-link 3.3.3.3 authentication-key cisco

R3(config)#router ospf 1
R3(config-router)#area 1 virtual-link 2.2.2.2 authentication
R3(config-router)#area 1 virtual-link 2.2.2.2 authentication-key cisco

虚电路密文验证:
R2(config-router)#
R2(config-router)#area 1 virtual-link 3.3.3.3 authentication message-digest
R2(config-router)#area 1 virtual-link 3.3.3.3 message-digest-key 1 md5 cisco

R3(config-router)#area 1 virtual-link 2.2.2.2 authentication message-digest
R3(config-router)#area 1 virtual-link 2.2.2.2 message-digest-key 1 md5 cisco

对R2进行明文配置
在这里插入图片描述
对R3进行明文配置
在这里插入图片描述
以R4为例,下面两张图分别为配置验证密码前后通信路由条目。明显可见,虚电路实现验证后,R4能够收到其他路由条目。密文配置同样。
在这里插入图片描述
R1配置地址有问题,不影响实验操作完成

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值