基于OSPF的IPSec配置案例

CISCO-基于OSPF的IPSec配置案例

CISCO-基于OSPF的IPSec配置案例_网络技术

项目背景:某大型企业异地架设分公司,分公司的业务服务器需按时向总公司的备份服务器备份数据,实现数据的安全和冗余,在数据的备份过程中,需保证数据的安全性,因此利用IPSec技术保证数据传输的安全性。

IP地址接口规划表:

本端设备

接口

IP地址

对端设别

接口

IP地址

Router1

Se0/0/0

140.10.1.5/30

Router2

Se0/0/0

140.10.1.6/30

Router1

Fa0/0

192.168.200.1/24

Server0

Fa0

192.168.200.100/24

R3

Se0/0/0

150.10.1.6/30

R2

Se0/0/0

150.10.1.5/30

R3

Fa0/0

172.25.150.1/24

Server1

Fa0

172.25.150.200/24

R1

loopback 0

1.1.1.1/32

R2

loopback 0

2.2.2.2/32

R3

loopback 0

3.3.3.3/32

配置步骤;

  • 配置各接口IP地址
  • 配置OSPF路由协议,实现网络互通
  • 配置IKE安全提议,配置协商加密算法
  • 配置IPSec安全提议,配置数据加密算法
  • 定义被保护数据流,实现对数据的捕获
  • 配置IPSec策略,应用于接口

项目实施:

壹、配置各接口IP地址

R1(config)#interface Loopback0
R1(config-if)# ip address 1.1.1.1 255.255.255.255
!
R1(config-if)#interface FastEthernet0/0
R1(config-if)# ip address 192.168.200.1 255.255.255.0
!
R1(config-if)#interface Serial0/0/0
R1(config-if)# ip address 140.10.1.5 255.255.255.252
R2(config)#interface Loopback0
R2(config-if)# ip address 2.2.2.2 255.255.255.255
!
R2(config-if)#interface Serial0/0/0
R2(config-if)# ip address 140.10.1.6 255.255.255.252
!
R2(config-if)#interface Serial0/0/1
R2(config-if)# ip address 150.10.1.5 255.255.255.252
R3(config)#interface Loopback0
R3(config-if)# ip address 3.3.3.3 255.255.255.255
!
R3(config-if)#interface FastEthernet0/0
R3(config-if)# ip address 172.25.150.1 255.255.255.0
!
R3(config-if)#interface Serial0/0/1
R3(config-if)# ip address 150.10.1.6 255.255.255.252

贰、配置OSPF路由协议

R1(config)#router ospf 1                                    # 进入OSPF进程1视图
R1(config-router)# router-id 1.1.1.1 # 配置Router-id为 1.1.1.1
R1(config-router)# network 140.10.1.4 0.0.0.3 area 0 #在区域0(area 0),宣告140.10.1.4网段
R1(config-router)# network 192.168.200.0 0.0.0.255 area 0 #在区域0(area 0),宣告192.168.200.0网段
R1(config-router)# network 1.1.1.1 0.0.0.0 area 0 #在区域0(area 0),宣告1.1.1.1网段
R2(config)#router ospf 1                                    # 进入OSPF进程1视图
R2(config-router)# router-id 2.2.2.2 # 配置Router-id为 2.2.2.2
R2(config-router)# network 140.10.1.4 0.0.0.3 area 0 #在区域0(area 0),宣告140.10.1.4网段
R2(config-router)# network 2.2.2.2 0.0.0.0 area 0 #在区域0(area 0),宣告2.2.2.2网段
R2(config-router)# network 150.10.1.4 0.0.0.3 area 1 #在区域1(area 1),宣告150.10.1.4网段
R3(config)#router ospf 1                                    # 进入OSPF进程1视图
R3(config-router)# router-id 3.3.3.3 # 配置Router-id为 3.3.3.3
R3(config-router)# network 150.10.1.4 0.0.0.3 area 1 #在区域1(area 1),宣告150.10.1.4网段
R3(config-router)# network 172.25.150.0 0.0.0.255 area 1 #在区域1(area 1),宣告172.25.150.0网段
R3(config-router)# network 3.3.3.3 0.0.0.0 area 1 #在区域1(area 1),宣告3.3.3.3网段

叁、配置IKE安全提议

R1(config)#crypto isakmp policy 10                          #进入ike提案数为10的视图
R1(config-isakmp)# encr aes #配置对称加密算法 AES,加密位数为默认
R1(config-isakmp)# authentication pre-share #配置认证方式为预共享密钥
R1(config-isakmp)# group 5 #配置DH加密组,为版本5
!
R1(config-isakmp)#crypto isakmp key China44cisco address 150.10.1.6 #配置预共享密钥,配置对端IP地址
R3(config)#crypto isakmp policy 10                          #进入ike提案数为10的视图
R3(config-isakmp)# encryption aes #配置对称加密算法 AES,加密位数为默认
R3(config-isakmp)# authentication pre-share #配置认证方式为预共享密钥
R3(config-isakmp)# group 5 #配置DH加密组,为版本5
!
R3(config-isakmp)#crypto isakmp key China44cisco address 140.10.1.5 #配置预共享密钥,配置对端IP地址

肆、配置IPSec安全提议

R1(config)#crypto ipsec transform-set R1toR3 esp-aes esp-sha-hmac #配置IPsec安全提议,配置数据加密算法
R3(config)#crypto ipsec transform-set R3toR1 esp-aes esp-sha-hmac #配置IPsec安全提议,配置数据加密算法

伍、配置IP访问控制列表,定义被保护的数据流

R1(config)#ip access-list extended R1toR3                                #配置拓展ACL,名称为R1toR3
R1(config-ext-nacl)# permit ip host 192.168.200.100 host 172.25.150.200 #定义192.168.200.100去往172.25.150.200的数据流
R3(config)#ip access-list extended R3toR1                               #配置拓展ACL,名称为R3toR1
R3(config-ext-nacl)# permit ip host 172.25.150.200 host 192.168.200.100 #定义172.25.150.200去往192.168.200.100的数据流

陆、配置IPSec策略,应用于接口

R1(config)#crypto map R1toR3 10 ipsec-isakmp                    #配置IPSec安全提议,应用ike提案10
R1(config-crypto-map)# set peer 150.10.1.6 #配置对端设备地址
R1(config-crypto-map)# set transform-set R1toR3 #应用IPSec提议
R1(config-crypto-map)# match address R1toR3 #应用ACL
!
R1(config-if)#crypto map R1toR3 #应用IPSec策略
*Jan 3 07:16:26.785: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON
R3(config)#crypto map R3toR1 10 ipsec-isakmp                    #配置IPSec安全提议,应用ike提案10
R3(config-crypto-map)# set peer 140.10.1.5 #配置对端设备地址
R3(config-crypto-map)# set transform-set R3toR1 #应用IPSec提议
R3(config-crypto-map)# match address R3toR1 #应用ACL
!
R3(config-if)#crypto map R3toR1 #应用IPSec策略
*Jan 3 07:16:26.785: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON

项目验证:

总部服务器与分公司服务器实现互通:

CISCO-基于OSPF的IPSec配置案例_IP_02

抓包验证IKE协商和数据加密:

CISCO-基于OSPF的IPSec配置案例_R3_03

CISCO-基于OSPF的IPSec配置案例_R3_04