采用手工方式建立IPSec隧道示例

配置采用手工方式建立IPSec隧道示例

一、组网需求

如图所示,HX为企业分支网关,GY为企业总部网关,分支与总部通过公网建立通信。分支子网为10.1.2.0/24,总部子网为10.1.1.0/24。GY和HX两个站点用户均可以正常访问互联网2.2.2.2。

企业希望对分支子网与总部子网之间相互访问的流量进行安全保护。分支与总部通过公网建立通信,可以在分支网关与总部网关之间建立一个IPSec隧道来实施安全保护。由于维护网关较少,可以考虑采用手工方式建立IPSec隧道。

二、操作步骤

1、分别在GY和HX上配置接口的IP地址和默认路由

2、分别在GY和HX上配置ACL,定义各自要保护的数据流

3、分别在GY和HX上创建IPSec安全提议

4、分别在GY和HX上创建安全策略,并引用ACL和IPSec安全提议,确定对何种数据流采取何种保护方法。

5、分别在GY和HX的接口上引用各自的安全策略,使接口具有IPSec的保护功能

 三、配置文件

1、GY相关配置文件

#
 sysname GY
#
 acl number 3101  
 rule 5 permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255 
acl number 3102  
 rule 10 deny ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255 
 rule 20 permit ip 
#
ipsec proposal tran1
 esp authentication-algorithm sha2-256 
 esp encryption-algorithm aes-128
#
ipsec policy map1 10 manual
 security acl 3101
 proposal tran1
 tunnel local 100.1.1.1
 tunnel remote 200.1.1.1
 sa spi inbound esp 54321
 sa string-key inbound esp cipher %$%$HqV9'^.AY<;@@wEMv,CQ,.2n%$%$
 sa spi outbound esp 12345
 sa string-key outbound esp cipher %$%$HqV9'^.AY<;@@wEMv,CQ,.2n%$%$
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 10.1.1.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 100.1.1.1 255.255.255.252 
 ipsec policy map1
 nat outbound 3102

2、HX相关配置文件

sysname HX
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent 
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
 drop illegal-mac alarm
#
 undo info-center enable
#
 wlan ac-global carrier id other ac id 0
#
 set cpu-usage threshold 80 restore 75
#
acl number 3101  
 rule 5 permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 
acl number 3102  
 rule 10 deny ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 
 rule 20 permit ip 
#
ipsec proposal tran1
 esp authentication-algorithm sha2-256 
 esp encryption-algorithm aes-128
#
ipsec policy use1 10 manual
 security acl 3101
 proposal tran1
 tunnel local 200.1.1.1
 tunnel remote 100.1.1.1
 sa spi inbound esp 12345
 sa string-key inbound esp cipher %$%$HqV9'^.AY<;@@wEMv,CQ,.2n%$%$
 sa spi outbound esp 54321
 sa string-key outbound esp cipher %$%$HqV9'^.AY<;@@wEMv,CQ,.2n%$%$
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 10.1.2.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 200.1.1.1 255.255.255.252 
 ipsec policy use1
 nat outbound 3102

3、ISP相关文件

#
interface GigabitEthernet0/0/0
 ip address 100.1.1.2 255.255.255.252 
#
interface GigabitEthernet0/0/1
 ip address 200.1.1.2 255.255.255.252 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255 

 

posted @ 2024-04-12 13:21  dachenyi  阅读(18)  评论(0编辑  收藏  举报