OSPF虚链路+链路区域认证
OSPF网络中Aera0为骨干区域,其它Aera为非骨干区域,非骨干区域必须与骨干区域直接相连,根据拓扑图可看到R3所在的Aera1将两个骨干Aera0分隔开,这种情况下需要在R2和R5之间创建一条虚链路使将不连续的Aera0连接起来。
虚链路配置
R1
interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface Ethernet0/0 description R1-R2 ip address 12.0.0.1 255.255.255.0 ! router ospf 1 router-id 1.1.1.1 network 1.1.1.0 0.0.0.255 area 0 宣告R1回环接口 network 12.0.0.0 0.0.0.255 area 0 宣告R1-R2直连接口网段
R2
interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Ethernet0/0 description R2-R1 ip address 12.0.0.2 255.255.255.0 ! interface Ethernet0/1 description R2-R3 ip address 23.0.0.1 255.255.255.0 ! router ospf 1 router-id 2.2.2.2 area 1 virtual-link 5.5.5.5 创建虚链路到R5 network 2.2.2.0 0.0.0.255 area 0 宣告R2回环接口 network 12.0.0.0 0.0.0.255 area 0 宣告R2-R1直连网段 network 23.0.0.0 0.0.0.255 area 1 宣告R2-R3直连网段
R3
interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Ethernet0/0 description R3-R5 ip address 35.0.0.1 255.255.255.0 ! interface Ethernet0/1 description R3-R2 ip address 23.0.0.2 255.255.255.0 ! router ospf 1 router-id 3.3.3.3 network 3.3.3.0 0.0.0.255 area 1 宣告R3回环接口 network 23.0.0.0 0.0.0.255 area 1 宣告R3-R2直连网段 network 35.0.0.0 0.0.0.255 area 1 宣告R3-R5直连网段
R4
interface Loopback0 ip address 4.4.4.4 255.255.255.255 ! interface Ethernet0/1 description R4-R5 ip address 45.0.0.1 255.255.255.0 ! router ospf 1 router-id 4.4.4.4 network 4.4.4.0 0.0.0.255 area 0 宣告R4回环接口 network 45.0.0.0 0.0.0.255 area 0 宣告R4-R5直连网段
R5
interface Loopback0 ip address 5.5.5.5 255.255.255.255 ! interface Ethernet0/0 description R5-R3 ip address 35.0.0.2 255.255.255.0 ! interface Ethernet0/1 description R5-R4 ip address 45.0.0.2 255.255.255.0 ! router ospf 1 router-id 5.5.5.5 area 1 virtual-link 2.2.2.2 创建虚链路到R2 network 5.5.5.0 0.0.0.255 area 0 宣告R5回环接口 network 35.0.0.0 0.0.0.255 area 1 宣告R5-R3直连网段
验证虚链路
显示虚链路信息
如果删除掉R5的虚链路配置或者配置错误
OSPF虚链路认证
在R5上设置一下虚链路认证,明文密钥为cisco,R2不设置
R5(config-router)#area 1 virtual-link 2.2.2.2 authentication-key cisco
然后R5上就会收到验证密钥不合法的提示,之后FULL状态会变为DOWN
OSPF链路和区域认证
在R1和R2之间的直连接口上先开启认证并输入密钥
R1(config)#int e0/0 R1(config-if)#ip ospf authentication-key cisco
然后在R1的ospf进程中启动认证
R1(config)#router os 1 R1(config-router)#area 0 authentication
之后重启ospf进程,PING R2的回环地址就无法ping通
在R2上可收到因为密钥不匹配而认证错误的提示
因为刚配置的为明文认证,在R1上show ip ospf interface可以在最后看到Simple password authentication enable
在R2上也启用相同的认证后,在R1上show ip ospf neighbor可以看到和R2的状态为FULL,相互ping回环也都可以ping通
R1和R2之间OSPF认证使用加密密钥
R1(config)#int e0/0 R1(config-if)#ip ospf authentication message-digest R1(config-if)#ip ospf message-digest-key 1 md5 huawei R1(config)#router os 1 R1(config-router)#area 0 authentication message-digest
配置好后再次show ip ospf interface会看到Cryptographic authentication enabled
R2未配置为加密,neighbor关系解除
本站所有文章均可随意转载,转载时请保留原文链接及作者。