Thursday, April 10, 2008

IPSEC VPNs - Advanced NAT

Here are some pointers for when you are trying to build an IPSEC VPN to a remote organization and they NAT the remote host due to address overlap.

For example:

Remote Host:
Translated Public IP:
Remote Firewall: (Cisco 3000 Series VPN Concentrator/PIX/ASA)

Local Firewall: (Fortigate)
Local Network: (NAT traffic to external firewall interface)

Begin by reading this previous post: Advanced IPSEC with Phase 2 Quick Mode Selectors
The one change to note is that you need to configure this scenario in policy mode. There is either a bug or a "feature" which prevents the NAT from working correctly in interface mode. I am currently investigating.

The challenge for the above scenario is typically to select the correct phase 2 source and destination addresses to match the remote access lists. In the above example your local configuration should look similar to the following:

config firewall address
edit "net-"
set subnet
edit "host -"
set subnet
edit "host-"
set subnet

config firewall addrgrp
edit "encdom-local-remote"
set member "net-" "host-"

config vpn ipsec phase1

edit "Remote_Firewall"
set interface "external"
set dpd disable
set nattraversal enable
set dhgrp 2
set proposal 3des-md5
set keylife 86400
set remote-gw

config vpn ipsec phase2
edit "Remote_Tunnel"
set phase1name "Remote_Firewall"
set proposal 3des-md5
set src-addr-type name
set src-name "encdom-local-remote"
set dst-addr-type name
set dst-name "host-"
set keylifeseconds 28800

config firewall policy
edit 1
set srcintf "internal"
set dstintf "external"
set srcaddr "n-"
set dstaddr "h-"
set action ipsec
set schedule "always"
set service "ANY"
set profile-status enable
set logtraffic enable
set profile "scan"
set outbound enable
set natoutbound enable # Hide traffic behind firewall's external interface
set vpntunnel "Remote_Firewall"

Here is what you are telling the firewall: Take my traffic from and send it through the VPN tunnel to the remote firewall. NAT the traffic so it appears to be coming from my firewall's external interface
Notice that in the phase 2 quick mode selectors you specify both as well as your local network Otherwise the phase 2 parameters sent to the peer do not match.


anmol said...

Hi frined ,
waht whould have happend if you have selected only in the phase 2 quick mode selector ,
as my confusion is remote sys or peer will come to know that packet is comming with SRC of local outboubd interface only bec we are natting .

Guru Prasad said...
This comment has been removed by a blog administrator.