有没有关于nat和VPN解决方法的案例,在网上看教程好多都没有结合nat做实验
有没有关于nat和VPN解决方法的案例,在网上看教程好多都没有结合nat做实验
(0)
最佳答案
目录
MSR V5平台和MSR V7平台路由器IPSec VPN对接典型配置(野蛮模式) 1
本案例提到的MSR v5平台路由器是指Comware V5 软件平台MSR WiNet系列路由器,如MSR830-WiNet 、MSR 830-10-WiNet 、MSR 930-WiNet 、MSR 930-10-WiNet 、MSR 930-WiNet-W 、MSR 2600-10-WiNet等
本案例提到的MSR V7平台路由器是指Comware V7平台的MSR830-WiNet系列路由器,如MSR830-10BEI-WiNet 、MSR830-6EI-WiNet 、MSR830-5BEI-WiNet 、MSR830-6BHI-WiNet 、MSR830-10BHI-WiNet等
MSR V5路由器采用PPPoE拨号方式上网,IP地址不固定,MSR V7路由器外网口G0/1的地址为2.2.2.2(模拟运营商公网固定地址环境)。要实现对MSR V5所在的内网(192.168.1.0/24)与MSR V7路由器所在的内网(172.16.1.0/24)之间的数据流进行安全保护,实现两端内网终端通过IPsec VPN 隧道进行互访。
#路由器基本上网配置省略,MSR V5路由器的上网具体设置步骤请参考“2.1.1 路由器外网使用拨号上网配置方法”章节中“MSR830[930][2600]系列路由器基本上网(PPPoE拨号)命令行配置(V5)”案例,MSR V7路由器的上网具体设置步骤请参考“2.1.2 路由器外网使用固定IP地址上网配置方法”章节中“MSR830-WiNet系列路由器基本上网(静态IP)命令行配置(V7)”案例
# 配置一个访问控制列表3000,定义由子网192.168.1.0/24去子网172.16.1.0/24的数据流。
<H3C>system-view
[H3C]acl number 3000
[H3C-acl-adv-3000]rule 0 permit ip source 192.168.1.0 0.0.0.255 destination 172.16.1.0 0.0.0.255
[H3C-acl-adv-3000]quit
#配置公网口NAT要关联的ACl 3001,作用是把IPSec感兴趣流从NAT转换的数据流deny掉,防止IPSec数据流被NAT优先转换
[H3C]acl number 3001
[H3C-acl-adv-3001]rule 0 deny ip source 192.168.1.0 0.0.0.255 destination 172.16.1.0 0.0.0.255
[H3C-acl-adv-3001]rule 1 permit ip
[H3C-acl-adv-3001]quit
#配置本端安全网关的名字
[H3C]ike local-name v5
# 创建一条IKE提议1,指定IKE提议使用的认证算法为MD5,加密算法为3des-cbc
[H3C]ike proposal 1
[H3C-ike-proposal-1]authentication-algorithm md5
[H3C-ike-proposal-1]encryption-algorithm 3des-cbc
[H3C-ike-proposal-1]quit
# 配置IPSec安全提议v5,配置ESP协议采用的加密算法为3des,采用的认证算法md5
[H3C]ipsec transform-set v5
[H3C-ipsec-transform-set-v5]encapsulation-mode tunnel
[H3C-ipsec-transform-set-v5]transform esp
[H3C-ipsec-transform-set-v5]esp encryption-algorithm 3des
[H3C-ipsec-transform-set-v5]esp authentication-algorithm md5
[H3C-ipsec-transform-set-v5]quit
# 创建IKE对等体v5,配置IKE第一阶段的协商模式为野蛮模式,预共享密钥为123456,引用之前创建的IKE安全提议1,选择IKE第一阶段的协商过程中使用ID的类型为name,配置对端地址为对端公网接口地址2.2.2.2,配置对端安全网关的名字为v7,配置本端安全网关的名字为v5
[H3C]ike peer v5
[H3C-ike-peer-v5]exchange-mode aggressive
[H3C-ike-peer-v5]pre-shared-key 123456
[H3C-ike-peer-v5]proposal 1
[H3C-ike-peer-v5]id-type name
[H3C-ike-peer-v5]remote-address 2.2.2.2
[H3C-ike-peer-v5]remote-name v7
[H3C-ike-peer-v5]local-name v5
[H3C-ike-peer-v5]quit
# 创建一条IPSec安全策略v5,协商方式为isakmp。引用之前创建的感兴趣数据流ACL3000,引用之前创建的对等体v5,引用之前的IPSec安全提议v5
[H3C]ipsec policy v5 1 isakmp
[H3C-ipsec-policy-isakmp-v5-1]security acl 3000
[H3C-ipsec-policy-isakmp-v5-1]ike-peer v5
[H3C-ipsec-policy-isakmp-v5-1]transform-set v5
[H3C-ipsec-policy-isakmp-v5-1]quit
#设置外网口(在本例中假设拨号口为Dialer 10)做NAT转换的时候关联ACL 3001 (如果之前已经在外网口配置了 nat outbound,需要先undo掉),并将IPSec安全策略v5应用在外网接口,
[H3C]interface Dialer 10
[H3C-Dialer10]undo nat outbound
[H3C-Dialer10]nat outbound 3001
[H3C-Dialer10]ipsec policy v5
[H3C-Dialer10]quit
# 配置一个访问控制列表,定义由子网172.16.1.0/24去子网192.168.1.0/24的数据流。
<H3C>system-view
[H3C]acl advanced 3000
[H3C-acl-ipv4-adv-3000]rule 0 permit ip source 172.16.1.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
[H3C-acl-ipv4-adv-3000]quit
#配置公网口NAT要关联的ACl 3001,作用是把IPSec感兴趣流从NAT转换的数据流deny掉,防止IPSec数据流被NAT优先转换
[H3C]acl advanced 3001
[H3C-acl-ipv4-adv-3001]rule 0 deny ip source 172.16.1.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
[H3C-acl-ipv4-adv-3001]rule 1 permit ip
[H3C-acl-adv-3001]quit
# 创建一条IKE提议1,指定IKE提议使用的认证算法为MD5,加密算法为3des-cbc
[H3C]ike proposal 1
[H3C-ike-proposal-1]authentication-algorithm md5
[H3C-ike-proposal-1]encryption-algorithm 3des-cbc
[H3C-ike-proposal-1]quit
#配置本端FQDN名称为v7
[H3C]ike identity fqdn v7
[H3C]ike keychain v7
#配置对端IP地址为0.0.0.0(由于对端地址不固定,所以配置对端地址为0.0.0.0,其目的是匹配所有地址),使用的预共享密钥为明文123456
[H3C-ike-keychain-v7]pre-shared-key address 0.0.0.0 0.0.0.0 key simple 123456
[H3C-ike-keychain-v7]quit
# 创建并配置IKE profile,名称为v7,引用上面配置的keychain v7,配置IKE第一阶段的协商模式为野蛮模式,本端身份类型为FQDN且取值为v7,指定需要匹配对端身份类型为FQDN且取值v5,引用之前配置IKE提议1
[H3C]ike profile v7
[H3C-ike-profile-v7]keychain v7
[H3C-ike-profile-v7]exchange-mode aggressive
[H3C-ike-profile-v7]local-identity fqdn v7
[H3C-ike-profile-v7]match remote identity fqdn v5
[H3C-ike-profile-v7]proposal 1
[H3C-ike-profile-v7]quit
# 配置IPsec安全提议v7,ESP协议采用的加密算法为3des-cbc,认证算法为md5
[H3C]ipsec transform-set v7
[H3C-ipsec-transform-set-v7]encapsulation-mode tunnel
[H3C-ipsec-transform-set-v7]esp encryption-algorithm 3des-cbc
[H3C-ipsec-transform-set-v7]esp authentication-algorithm md5
[H3C-ipsec-transform-set-v5]quit
# 创建一个模板名字为1,顺序号为1的安全策略模板,引用之前创建的ACL3000,引用之前创建的IKE profile v7,引用之前的IPSec安全提议v7
[H3C]ipsec policy-template 1 1
[H3C-ipsec-policy-template-1-1]transform-set v7
[H3C-ipsec-policy-template-1-1]security acl 3000
[H3C-ipsec-policy-template-1-1]ike-profile v7
[H3C-ipsec-policy-template-1-1]quit
# 引用IPSec策略模板1,创建名字为policy v7、顺序号为1的IPsec安全策略
[H3C] ipsec policy v7 1 isakmp template 1
#设置外网口做NAT转换的时候关联ACL 3001 (如果之前已经在外网口配置了 nat outbound,需要先undo掉),并将IPSec安全策略v7应用在外网接口
[H3C]interface GigabitEthernet 0/1
[H3C-GigabitEthernet0/1]undo nat outbound
[H3C-GigabitEthernet0/1]nat outbound 3001
[H3C-GigabitEthernet0/1]ipsec apply policy v7
[H3C-GigabitEthernet0/1]quit
#配置完成之后,由拨号端主动发起访问,触发建立IPSec隧道,在MSR V5路由器上带源ping MSR V7路由器内网网关地址
(0)
有链接吗兄弟你的图没了
以下是IPSEC VPN 穿越NAT的配置举例,请参考:
组网说明:
本案例采用H3C HCL模拟器的F1060防火墙来模拟IPSEC NAT穿越的典型组网配置。在网络拓扑图中存在子网1和子网2.为了保障子网1和子网2相互传输数据的安全性,因此需要在FW1与FW2采用建立IPSEC VPN隧道,由于FW1的出接口地址不固定且ISP为子网1的NAT设备,因此采用IKE野蛮模式。
1、按照网络拓扑图正确配置IP地址
2、ISP配置NAT
3、FW1与FW2的互联接口加入安全域,并放通域间策略
4、FW1与FW2建立IPSEC VPN隧道,采用IKE野蛮模式
ISP:
System View: return to User View with Ctrl+Z.
[H3C]sysname ISP
[ISP]int gi 0/0
[ISP-GigabitEthernet0/0]des
[ISP-GigabitEthernet0/0]ip address 202.1.100.1 24
[ISP-GigabitEthernet0/0]dhcp server apply ip-pool 1
[ISP-GigabitEthernet0/0]quit
[ISP]acl basic 2000
[ISP-acl-ipv4-basic-2000]rule 0 permit source any
[ISP-acl-ipv4-basic-2000]quit
[ISP]int gi 0/1
[ISP-GigabitEthernet0/1]des
[ISP-GigabitEthernet0/1]ip address 202.2.100.1 30
[ISP-GigabitEthernet0/1]nat outbound 2000
[ISP-GigabitEthernet0/1]quit
[ISP]ip route-static 192.168.1.0 255.255.255.0 202.1.100.2
[ISP]ip route-static 172.16.1.0 255.255.255.0 202.2.100.2
[ISP]dhcp enable
[ISP]dhcp server ip-pool 1
[ISP-dhcp-pool-1]network 202.1.100.0 mask 255.255.255.0
[ISP-dhcp-pool-1]gateway-list 202.1.100.1
[ISP-dhcp-pool-1]quit
FW1:
System View: return to User View with Ctrl+Z.
[H3C]sysname FW1
[FW1]int gi 1/0/3
[FW1-GigabitEthernet1/0/3]ip address 192.168.1.1 24
[FW1-GigabitEthernet1/0/3]quit
[FW1]int gi 1/0/2
[FW1-GigabitEthernet1/0/2]des
[FW1-GigabitEthernet1/0/2]ip address dhcp-alloc
[FW1-GigabitEthernet1/0/2]quit
[FW1]ip route-static 0.0.0.0 0.0.0.0 202.1.100.1
[FW1]security-zone name Trust
[FW1-security-zone-Trust]import interface GigabitEthernet 1/0/3
[FW1-security-zone-Trust]quit
[FW1]security-zone name Untrust
[FW1-security-zone-Untrust]import interface GigabitEthernet 1/0/2
[FW1-security-zone-Untrust]quit
[FW1]acl basic 2001
[FW1-acl-ipv4-basic-2001]rule 0 permit source any
[FW1-acl-ipv4-basic-2001]quit
[FW1]
[FW1]zone-pair security source trust destination untrust
[FW1-zone-pair-security-Trust-Untrust]packet-filter 2001
[FW1-zone-pair-security-Trust-Untrust]quit
[FW1]
[FW1]zone-pair security source untrust destination trust
[FW1-zone-pair-security-Untrust-Trust]packet-filter 2001
[FW1-zone-pair-security-Untrust-Trust]quit
[FW1]
[FW1]zone-pair security source trust destination local
[FW1-zone-pair-security-Trust-Local]packet-filter 2001
[FW1-zone-pair-security-Trust-Local]quit
[FW1]
[FW1]zone-pair security source local destination trust
[FW1-zone-pair-security-Local-Trust]packet-filter 2001
[FW1-zone-pair-security-Local-Trust]quit
[FW1]
[FW1]zone-pair security source untrust destination local
[FW1-zone-pair-security-Untrust-Local]packet-filter 2001
[FW1-zone-pair-security-Untrust-Local]quit
[FW1]
[FW1]zone-pair security source local destination untrust
[FW1-zone-pair-security-Local-Untrust]packet-filter 2001
[FW1-zone-pair-security-Local-Untrust]quit
FW1 IPSEC+IKE野蛮模式关键配置点:
[FW1]acl advanced 3000
[FW1-acl-ipv4-adv-3000]rule 0 permit ip source 192.168.1.0 0.0.0.255 destination 172.16.1.0 0.0.0.255
[FW1-acl-ipv4-adv-3000]quit
[FW1]ike identity fqdn fw1
[FW1]ike keychain james
[FW1-ike-keychain-james]pre-shared-key address 202.2.100.2 255.255.255.252 key simple james
[FW1-ike-keychain-james]quit
[FW1]ike proposal 1
[FW1-ike-proposal-1]quit
[FW1]ike profile james
[FW1-ike-profile-james]keychain james
[FW1-ike-profile-james]proposal 1
[FW1-ike-profile-james]match remote identity address 202.2.100.2 255.255.255.252
[FW1-ike-profile-james]exchange-mode aggressive
[FW1-ike-profile-james]quit
[FW1]ipsec transform-set james
[FW1-ipsec-transform-set-james]protocol esp
[FW1-ipsec-transform-set-james]encapsulation-mode tunnel
[FW1-ipsec-transform-set-james]esp authentication-algorithm md5
[FW1-ipsec-transform-set-james]esp encryption-algorithm des-cbc
[FW1-ipsec-transform-set-james]quit
[FW1]ipsec policy james 1 isakmp
[FW1-ipsec-policy-isakmp-james-1]security acl 3000
[FW1-ipsec-policy-isakmp-james-1]transform-set james
[FW1-ipsec-policy-isakmp-james-1]ike-profile james
[FW1-ipsec-policy-isakmp-james-1]remote-address 202.2.100.2
[FW1-ipsec-policy-isakmp-james-1]quit
[FW1]int gi 1/0/2
[FW1-GigabitEthernet1/0/2]ipsec apply policy james
[FW1-GigabitEthernet1/0/2]quit
FW2:
System View: return to User View with Ctrl+Z.
[H3C]sysname FW2
[FW2]int gi 1/0/3
[FW2-GigabitEthernet1/0/3]ip address 172.16.1.1 24
[FW2-GigabitEthernet1/0/3]quit
[FW2]int gi 1/0/2
[FW2-GigabitEthernet1/0/2]des
[FW2-GigabitEthernet1/0/2]ip address 202.2.100.2 30
[FW2-GigabitEthernet1/0/2]quit
[FW2]ip route-static 0.0.0.0 0.0.0.0 202.2.100.1
[FW2]security-zone name Untrust
[FW2-security-zone-Untrust]import interface GigabitEthernet 1/0/2
[FW2-security-zone-Untrust]quit
[FW2]security-zone name Trust
[FW2-security-zone-Trust]import interface GigabitEthernet 1/0/3
[FW2-security-zone-Trust]quit
[FW2]zone-pair security source trust destination untrust
[FW2-zone-pair-security-Trust-Untrust]packet-filter 2001
[FW2-zone-pair-security-Trust-Untrust]quit
[FW2]
[FW2]zone-pair security source untrust destination trust
[FW2-zone-pair-security-Untrust-Trust]packet-filter 2001
[FW2-zone-pair-security-Untrust-Trust]quit
[FW2]
[FW2]zone-pair security source trust destination local
[FW2-zone-pair-security-Trust-Local]packet-filter 2001
[FW2-zone-pair-security-Trust-Local]quit
[FW2]
[FW2]zone-pair security source local destination trust
[FW2-zone-pair-security-Local-Trust]packet-filter 2001
[FW2-zone-pair-security-Local-Trust]quit
[FW2]
[FW2]zone-pair security source untrust destination local
[FW2-zone-pair-security-Untrust-Local]packet-filter 2001
[FW2-zone-pair-security-Untrust-Local]quit
[FW2]
[FW2]zone-pair security source local destination untrust
[FW2-zone-pair-security-Local-Untrust]packet-filter 2001
[FW2-zone-pair-security-Local-Untrust]quit
FW2 IPSEC+IKE野蛮模式关键配置点:
[FW2]acl advanced 3000
[FW2-acl-ipv4-adv-3000]rule 0 permit ip source 172.16.1.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
[FW2-acl-ipv4-adv-3000]quit
[FW2]ike identity fqdn fw2
[FW2]ike proposal 1
[FW2-ike-proposal-1]quit
[FW2]ike keychain james
[FW2-ike-keychain-james]pre-shared-key hostname fw1 key simple james
[FW2-ike-keychain-james]quit
[FW2]ike profile james
[FW2-ike-profile-james]keychain james
[FW2-ike-profile-james]proposal 1
[FW2-ike-profile-james]match remote identity fqdn fw1
[FW2-ike-profile-james]exchange-mode aggressive
[FW2-ike-profile-james]quit
[FW2]ipsec transform-set james
[FW2-ipsec-transform-set-james]protocol esp
[FW2-ipsec-transform-set-james]encapsulation-mode tunnel
[FW2-ipsec-transform-set-james]esp authentication-algorithm md5
[FW2-ipsec-transform-set-james]esp encryption-algorithm des-cbc
[FW2-ipsec-transform-set-james]quit
[FW2]ipsec policy-template james 1
[FW2-ipsec-policy-template-james-1]security acl 3000
[FW2-ipsec-policy-template-james-1]transform-set james
[FW2-ipsec-policy-template-james-1]ike-profile james
[FW2-ipsec-policy-template-james-1]quit
[FW2]ipsec policy james 1 isakmp template james
[FW2]int gi 1/0/2
[FW2-GigabitEthernet1/0/2]ipsec apply policy james
[FW2-GigabitEthernet1/0/2]quit
测试:
物理机都填写IP地址:
PC之间可以相互PING通:
查看FW1的IPSEC显示信息:
查看FW1出接口配置及获取到的IP地址:
查看ISP DHCP分配出去的地址:
查看FW2的IPSEC显示信息:
(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
有链接吗兄弟你的图没了