1.  认证概述

   为什么要有认证?

    防止非法路由器接入企业内网的ospf路由器,保护内网安全

2.  认证方式

     认证方式分为接口认证和区域认证,接口认证和区域认证没有本质的区别,接口认证是当区域内链路过多的情况下,接口认证配置较为繁琐,容易出错,此时可以采用区域认证,配置量更少。

3.  认证位置
  - 接口认证
  - 区域认证

  注:如果同时配置了接口认证和区域认证,则接口人证优先于区域认证

4. 认证模式

     认证报文携带在hello报文中,通过hello包进行协商,所有认证模式和认证密码两端必须一致,如果认证方式或认证密码协商不一致,会导致邻居关系建立失败

  认证模式分为:

  - simple  明文认证,密码在传输过程中是明文的,抓包可见
  - MD5   密文认证,密码在传输的过程中是加密的,抓包不可见

5.  配置认证:   

注意:simple/md5:表示OSPF报文在传输过程中是否加密              邻居两端必须一致

           cipher/plain:表示秘钥信息在本地存储是否加密                     邻居两端可以不一致

- 接口认证

 需求:1) 企业内部运营OSPF多区域

            2) 禁止区域0内有非法用户接入

            3)AR2与AR3、AR3与AR4接口下配置明文认证、AR4与AR5接口下配置密文认证

    拓扑:

ospf区域认证作用 ospf区域认证和接口认证_网络安全

 配置命令:
接口认证配置:(邻居设备的认证类型、认证密码必须一致,如何不一致邻居会断开)
AR2和AR3之间配置simple 认证模式:
AR2:
interface GigabitEthernet0/0/0
  ip address 192.168.23.2 255.255.255.0 
  ospf authentication-mode simple cipher hcip
  
AR3: 
interface GigabitEthernet0/0/1
  ip address 192.168.23.3 255.255.255.0 
  ospf authentication-mode simple cipher hcip 
  

AR3和AR4之间配置simple 认证模式:
AR3: 
interface GigabitEthernet0/0/0
ip address 192.168.34.3 255.255.255.0 
ospf authentication-mode simple cipher hcip 
  
AR4:
interface GigabitEthernet0/0/1

ip address 192.168.34.4 255.255.255.0 
ospf authentication-mode simple cipher hcip  
  
AR4和AR5之间配置md5 认证模式:
AR4:
interface GigabitEthernet0/0/0
ip address 192.168.45.4 255.255.255.0 
ospf authentication-mode md5 1 cipher hcip

AR5:
interface GigabitEthernet0/0/1
ip address 192.168.45.5 255.255.255.0 
ospf authentication-mode md5 1 cipher hcip

 

- 区域认证

 需求:1) 企业内部运营OSPF多区域

            2) 禁止区域12内有非法用户接入,要求认证密码不可见,本地存储秘钥信息显示加密

 拓扑:

ospf区域认证作用 ospf区域认证和接口认证_安全_02

 配置命令:
实验一:配置区域认证
1)OSPF区域认证配置:
AR2:
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
 network 192.168.23.0 0.0.0.255 
  
 area 0.0.0.12 
 authentication-mode md5 1 cipher hcie
  
AR1:
ospf 1 router-id 1.1.1.1
 area 0.0.0.12 
 authentication-mode md5 1 cipher hcie
 network 192.168.12.0 0.0.0.255

实验二:验证接口认证优先于区域认证:

1)OSPF区域12认证配置:
AR2:
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
 network 192.168.23.0 0.0.0.255 
  
 area 0.0.0.12 
 authentication-mode md5 1 cipher hcie
  
AR1:
ospf 1 router-id 1.1.1.1
 area 0.0.0.12 
 authentication-mode md5 1 cipher hcie
  network 192.168.12.0 0.0.0.255
  
 区域认证配置成功后,邻居关系正常,现在修改接口认证模式不一致,
 如果邻居断开说明接口认证优先于区域认证
 
2)配置R1的区域12的接口认证模式为明文
interface GigabitEthernet0/0/0
  ip address 192.168.12.1 255.255.255.0 
  ospf authentication-mode simple plain ntd
  
配置R2的区域12的接口认证模式为密文
interface GigabitEthernet0/0/1
  ip address 192.168.12.2 255.255.255.0 
  ospf authentication-mode md5 1 plain 345
  
  经验证发现,当接口认证不一致时,邻居断开,结论同时配置了接口认证和区域认证,
  接口认证优先于区域认证