IPSec NAT穿越原理_ipsec配置为什么要配置nat

[FW1]firewall zone trust
[FW1-zone-trust]add interface g1/0/1
[FW1-zone-trust]quit
[FW1]firewall zone untrust
[FW1-zone-untrust]add interface g1/0/0
[FW1-zone-untrust]quit

[FW1]acl number 3000
[FW1-acl-adv-3000]rule 5 permit ip source 192.168.0.0 0.0.0.255 destination 172.16.1.0 0.0.0.255

[FW1]ike proposal 10

[FW1]ipsec proposal pro1
[FW1-ipsec-proposal-pro1]transform esp
[FW1-ipsec-proposal-pro1]quit

[FW1]ike peer fenzhi
[FW1-ike-peer-fenzhi]undo version 2
[FW1-ike-peer-fenzhi]pre-shared-key test
Info: The password you entered does not meet the minimum complexity requirement.
The password is suggested to contain at least three types of characters from the
 following four groups: Uppercase letters <A-Z>; Lowercase letters <a-z>; Numera
ls <0-9>; Symbols (all characters not defined as letters or numerals), such as !
,$,#, and %.
[FW1-ike-peer-fenzhi]ike-proposal 10
[FW1-ike-peer-fenzhi]nat traversal 
[FW1-ike-peer-fenzhi]remote-address 2.2.2.10
[FW1-ike-peer-fenzhi]remote-address authentication-address 172.16.0.2

[FW1]ipsec policy policy1 1 isakmp
Info: The ISAKMP policy sequence number should be smaller than the template poli
cy sequence number in the policy group. Otherwise, the ISAKMP policy does not ta
ke effect.
[FW1-ipsec-policy-isakmp-policy1-1]security acl 3000
[FW1-ipsec-policy-isakmp-policy1-1]proposal pro1
[FW1-ipsec-policy-isakmp-policy1-1]ike-peer fenzhi
[FW1-ipsec-policy-isakmp-policy1-1]quit
[FW1]interface g1/0/0
[FW1-GigabitEthernet1/0/0]ipsec policy policy1

[FW1]ip route-static 0.0.0.0 0 1.1.1.2

[FW2]acl number 3000
[FW2-acl-adv-3000]rule 5 permit ip source 172.16.1.0 0.0.0.255 destination 192.168.0.0 0.0.0.255

[FW2-acl-adv-3000]quit
[FW2]ike proposal 10
[FW2-ike-proposal-10]display this
2024-03-10 11:17:22.240 
#
ike proposal 10
 encryption-algorithm aes-256
 dh group14
 authentication-algorithm sha2-256
 authentication-method pre-share
 integrity-algorithm hmac-sha2-256
 prf hmac-sha2-256
#
return
[FW2-ike-proposal-10]quit

[FW2]ipsec proposal pro1
[FW2-ipsec-proposal-pro1]transform esp
[FW2-ipsec-proposal-pro1]quit

[FW2]ike peer zongbu
[FW2-ike-peer-zongbu]undo version 2
[FW2-ike-peer-zongbu]pre-shared-key test
Info: The password you entered does not meet the minimum complexity requirement.
The password is suggested to contain at least three types of characters from the
 following four groups: Uppercase letters <A-Z>; Lowercase letters <a-z>; Numera
ls <0-9>; Symbols (all characters not defined as letters or numerals), such as !
,$,#, and %.
[FW2-ike-peer-zongbu]ike-proposal 10
[FW2-ike-peer-zongbu]remote-address 1.1.1.1
[FW2-ike-peer-zongbu]nat traversal
[FW2-ike-peer-zongbu]quit

[FW2]ipsec policy policy1 1 isakmp
Info: The ISAKMP policy sequence number should be smaller than the template poli
cy sequence number in the policy group. Otherwise, the ISAKMP policy does not ta
ke effect.
[FW2-ipsec-policy-isakmp-policy1-1]security acl 3000
[FW2-ipsec-policy-isakmp-policy1-1]proposal pro1
[FW2-ipsec-policy-isakmp-policy1-1]ike-peer zongbu
[FW2-ipsec-policy-isakmp-policy1-1]quit

[FW2]interface g1/0/0
[FW2-GigabitEthernet1/0/0]ipsec policy policy1
[FW2-GigabitEthernet1/0/0]quit

[FW2]ip route-static 0.0.0.0 0 172.16.0.1
[FW1-policy-security]display this
2024-03-10 12:55:27.460 
#
security-policy
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 2.2.2.0 mask 255.255.255.0
  destination-address 1.1.1.0 mask 255.255.255.0
  action permit
 rule name untr_to_tr
  source-zone untrust
  destination-zone trust
  source-address 172.16.1.0 mask 255.255.255.0
  destination-address 192.168.0.0 mask 255.255.255.0
  action permit
#
return

[FW2]security-policy
[FW2-policy-security]display this
2024-03-10 12:03:26.930 
#
security-policy
 rule name tr_to_untr
  source-zone trust
  destination-zone untrust
  source-address 172.16.1.0 mask 255.255.255.0
  destination-address 192.168.0.0 mask 255.255.255.0
  action permit
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 1.1.1.0 mask 255.255.255.0
  destination-address 172.16.0.0 mask 255.255.255.0
  action permit
 rule name local_to_untr
  source-zone local
  destination-zone untrust
  source-address 172.16.0.0 mask 255.255.255.0
  destination-address 1.1.1.0 mask 255.255.255.0
  action permit
#
return
[NAT]acl 2001
[NAT-acl-basic-2001]rule permit source 172.16.1.0 0.0.0.255
[NAT-acl-basic-2001]rule permit source 172.16.0.0 0.0.0.255
[NAT-acl-basic-2001]quit
[NAT]nat address-group 1 2.2.2.10 2.2.2.10
[NAT]interface g0/0/2
[NAT-GigabitEthernet0/0/2]nat outbound 2001 address-group 1

测试并抓包分析(防火墙G1/0/0抓包,此处源IP地址还未转换)。

抓包可知,主模式下,ISAKMP协商交换的包6个。(防火墙G1/0/0抓包,此处源IP地址还未转换

第一阶段会互相发送标识NAT穿越功能的Vendor ID载荷,用于检查通信双方是否支持 NAT-T。当双方都在各自的消息中包含了该载荷时,才会进行相关的 NAT-T 协商。(防火墙G1/0/0抓包,此处源IP地址还未转换

主模式消息3和消息4中发送NAT-D ( NAT Discovery )载荷。NAT-D载荷用于探测两个要建立IPSec隧道的网关之间是否存在NAT设备以及NAT设备的位置。

Remote HASH: 指将发送报文中的目的IP地址和端口号进行HASH运算后的数值。

Local HASH: 指将发送报文中的源IP地址和端口号进行HASH运算后的数值。

通过对比Remote HASH和Local HASH值,可以判断网关之间是否存在NAT设备以及NAT网关的位置。

FW2:

FW1:

一、网安学习成长路线图

网安所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。
在这里插入图片描述

二、网安视频合集

观看零基础学习视频,看视频学习是最快捷也是最有效果的方式,跟着视频中老师的思路,从基础到深入,还是很容易入门的。
在这里插入图片描述

三、精品网安学习书籍

当我学到一定基础,有自己的理解能力的时候,会去阅读一些前辈整理的书籍或者手写的笔记资料,这些笔记详细记载了他们对一些技术点的理解,这些理解是比较独到,可以学到不一样的思路。
在这里插入图片描述

四、网络安全源码合集+工具包

光学理论是没用的,要学会跟着一起敲,要动手实操,才能将自己的所学运用到实际当中去,这时候可以搞点实战案例来学习。
在这里插入图片描述

五、网络安全面试题

最后就是大家最关心的网络安全面试题板块
在这里插入图片描述在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值