华三模拟器(防火墙)实现IPSEC穿越NAT实验

本文档详细记录了一次IPSec穿越NAT的配置过程,包括FW1和FW2两台防火墙的ACL、IPsec安全提议、IKEkeychain、IKEprofile、IPsec安全策略的配置,并在接口上应用策略。通过实验,作者解决了PC_5访问PC_4不通的问题,最终实现两端私网地址的互通。实验结果显示IPSec配置成功,通过显示IKESA和IPSECSA进行验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实验拓扑

在这里插入图片描述


接口及路由配置省略,FW1和FW2配置默认路由即可实现公网互通(测试两端公网互通即可开始操作)

另外防火墙的策略问题我是用的 any to any,接下来直接上IPSEC的配置

FW1

步骤一:在FW1上创建感兴趣流,匹配两端私网地址网段
[FW1] acl advanced 3002
[FW1] rule 5 permit ip source 192.168.1.0 0.0.0.255 destination 172.16.1.0 0.0.0.255


步骤二:配置IPsec安全提议
[FW1] ipsec transform-set tran1											创建IPsec安全提议tran1
[FW1-ipsec-transform-set-tran1] encapsulation-mode tunnel				配置安全协议对IP报文的封装形式为隧道模式
[FW1-ipsec-transform-set-tran1] protocol esp							配置采用的安全协议为ESP。
[FW1-ipsec-transform-set-tran1] esp encryption-algorithm aes-cbc-128	配置ESP协议采用的加密算法为128比特的AES
[FW1-ipsec-transform-set-tran1] esp authentication-algorithm sha1		认证算法为HMAC-SHA1。
[FW1-ipsec-transform-set-tran1] quit

步骤三:配置IKE keychain
[FW1] ike keychain keychain1			创建IKE keychain,名称为keychain1,指定对端公网地址,预共享密钥为123456
[FW1-ike-keychain-keychain1] pre-shared-key address 2.2.2.2 255.255.255.0 key simple 123456
[FW1-ike-keychain-keychain1] quit

步骤四:配置IKE profile 
[FW1] ike profile profile1								创建并配置IKE profile,名称为profile1
[FW1-ike-profile-profile1] keychain keychain1		
[FW1-ike-profile-profile1] match remote identity address 2.2.2.2 255.255.255.0	#指定对端公网地址
[FW1-ike-profile-profile1] quit

步骤五:配置IPsec安全策略			
[FW1] ipsec policy map1 10 isakmp						创建IKE协商方式的IPsec安全策略,名称为map1,序列号为10。
[FW1-ipsec-policy-isakmp-map1-10] security acl 3002						指定引用感兴趣流的ACL 3002
[FW1-ipsec-policy-isakmp-map1-10] transform-set tran1					指定引用的安全提议为tran1
[FW1-ipsec-policy-isakmp-map1-10] local-address 1.1.1.1					指定IPsec隧道的本端IP地址为1.1.1.1
[FW1-ipsec-policy-isakmp-map1-10] remote-address 2.2.2.2				指定IPsec隧道的对端IP地址为2.2.2.2
[FW1-ipsec-policy-isakmp-map1-10] ike-profile profile1					指定引用的IKE profile为profile1。
[FW1-ipsec-policy-isakmp-map1-10] quit
 
                           
步骤六:在接口上应用IPsec安全策略    
[FW1-GigabitEthernet1/0/0] ipsec apply policy map1                       

FW2配置

步骤一:在FW1上创建感兴趣流,匹配两端私网地址网段
[FW2] acl advanced 3002
[FW2] rule 5 permit ip source 172.16.1.0 0.0.0.255 destination 192.168.1.0 0.0.0.255


步骤二:配置IPsec安全提议
[FW2] ipsec transform-set tran1											创建IPsec安全提议tran1
[FW2-ipsec-transform-set-tran1] encapsulation-mode tunnel				配置安全协议对IP报文的封装形式为隧道模式
[FW2-ipsec-transform-set-tran1] protocol esp							配置采用的安全协议为ESP。
[FW2-ipsec-transform-set-tran1] esp encryption-algorithm aes-cbc-128	配置ESP协议采用的加密算法为128比特的AES
[FW2-ipsec-transform-set-tran1] esp authentication-algorithm sha1		认证算法为HMAC-SHA1。
[FW2-ipsec-transform-set-tran1] quit

步骤三:配置IKE keychain
[FW2] ike keychain keychain1			创建IKE keychain,名称为keychain1,指定对端公网地址,预共享密钥为123456
[FW2-ike-keychain-keychain1] pre-shared-key address 1.1.1.1 255.255.255.0 key simple 123456
[FW2-ike-keychain-keychain1] quit

步骤四:配置IKE profile 			
[FW2] ike profile profile1								创建并配置IKE profile,名称为profile1。
[FW2-ike-profile-profile1] keychain keychain1		
[FW2-ike-profile-profile1] match remote identity address 1.1.1.1 255.255.255.0	#指定对端公网地址
[FW2-ike-profile-profile1] quit

步骤五:配置IPsec安全策略			
[FW2] ipsec policy use1 10 isakmp						创建IKE协商方式的IPsec安全策略,名称为use1,序列号为10。
[FW2-ipsec-policy-isakmp-map1-10] security acl 3002						指定引用感兴趣流的ACL 3002
[FW2-ipsec-policy-isakmp-map1-10] transform-set tran1					指定引用的安全提议为tran1
[FW2-ipsec-policy-isakmp-map1-10] local-address 2.2.2.2					指定IPsec隧道的本端IP地址为2.2.2.2
[FW2-ipsec-policy-isakmp-map1-10] remote-address 1.1.1.1				指定IPsec隧道的对端IP地址为1.1.1.1
[FW2-ipsec-policy-isakmp-map1-10] ike-profile profile1					指定引用的IKE profile为profile1。
[FW2-ipsec-policy-isakmp-map1-10] quit
 
                           
步骤六:在接口上应用IPsec安全策略    
[FW2-GigabitEthernet1/0/0] ipsec apply policy use1                     

测试

用PC_5去访问PC_4发现不通,还是一样的原因,需要拒绝ipsec的感兴趣流

在这里插入图片描述

FW1上修改
rule 4 deny ip source 192.168.1.0 0.0.0.255 destination 172.16.1.0 0.0.0.255 (2 times matched)
rule 5 permit ip source 192.168.1.0 0.0.0.255 (3 times matched)

FW2修改
rule 4 deny ip source 172.16.1.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
rule 5 permit ip source 172.16.1.0 0.0.0.255 (2 times matched)

实验结果

用PC_5去访问PC_4发现可以成功访问

在这里插入图片描述

ike sa

[FW1]display  ike sa

在这里插入图片描述

ipsec sa

display ipsec sa

在这里插入图片描述

到此防火墙的ipsec穿越NAT实验结束,其实很简单很简单昨天搞了一天不知道啥原因,今天早上上课按照手册在敲一遍就通了挺兴奋的

写个博客记录下以后可能会用到(毕设)

实验报告下载地址

链接:https://pan.baidu.com/s/1lz2-U0fyXhkxKHVrgfFrVw 
提取码:tpen
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值