Created on ‎05-19-2011 10:20 AM
) and have a fortigate that I am working with. I want all traffic going across a site to site vpn tunnel to be nat' d outbound to appear to be the inside IP address of the Fortigate.
VPN Tunnel is already active, but we have changed some internal IPs and figured it might be easier to do this than deal with the remote site' s IT folks.
Any assistance is appreciated.
config vpn ipsec phase1
edit " Tun.xTESTx"
set interface " port2"
set nattraversal disable
set dhgrp 2
set proposal 3des-md5
set remote-gw xx.xx.xx.xx
set psksecret ENC blah-blah-blah (This is your encoded key, do not alter)
next
end
config vpn ipsec phase2
edit " Tun.xTESTx"
set keepalive enable
set phase1name " Tun.xTESTx"
set proposal 3des-md5
set src-addr-type ip
set dhgrp 2
set dst-subnet xx.xx.xx.0 255.255.255.0
set keylifeseconds 28800
set src-start-ip xx.xx.xx.xx
next
end
config firewall policy
edit 58
set srcintf " port1"
set dstintf " port2"
set srcaddr " Server"
set dstaddr " Remote.Sub.xTESTx"
set action ipsec
set schedule " always"
set service " ANY"
set logtraffic enable
set inbound enable
set outbound enable
set vpntunnel " Tun.xTESTx"
next
endEither from the CLI or the GUI, delete the policy(s) that are attached to the tunnel. (#58 here)
config firewall policy
delete 58
endEither from the CLI or the GUI, delete the phase2 and phase1 definitions for the tunnel in that order.
config vpn ipsec phase2
delete " Tun.xTESTx"
end
config vpn ipsec phase1
delete " Tun.xTESTx"
endNext, go into the snippets of the code (above) and make the following changes (in green:(
config vpn ipsec phase1-interface
edit " Int.xTESTx"
set interface " port2"
set nattraversal disable
set dhgrp 2
set proposal 3des-md5
set remote-gw xx.xx.xx.xx
set psksecret ENC blah-blah-blah
next
end
config vpn ipsec phase2-interface
edit " Int.xTESTx"
set keepalive enable
set phase1name " Int.xTESTx"
set proposal 3des-md5
set src-addr-type ip
set dhgrp 2
set dst-subnet xx.xx.xx.0 255.255.255.0
set keylifeseconds 28800
set src-start-ip xx.xx.xx.xx
next
end
config firewall policy
edit 58
set srcintf " port1"
set dstintf " Int.xTESTx"
set srcaddr " Server"
set dstaddr " Remote.Sub.xTESTx"
set action accept <-No longer " ipsec"
set schedule " always"
set service " ANY"
set logtraffic enable
set inbound enable <-REMOVE THIS
set outbound enable <-REMOVE THIS
set vpntunnel " Tun.xTESTx" <-REMOVE THIS
next
endGo to the CLI widget or open an SSH session and paste in the changed configuration sections. In addition to the above changes, you will need a policy from the outside in as well as a static route(s) to the remote subnet(s). With the code changes in place prior, all this cutting and pasting should take under five minutes. Also a side note: I changed the name from a prefix of " Tun." for policy based to " Int." for interface based. Just something I do. Also if the tunnel doesn' t come up right away, have the far end drop their connection so the tunnel can re-key.
Hope that works for you.
Good luck
Bob - self proclaimed posting junkie!
See my Fortigate related scripts at: http://fortigate.camerabob.com
Created on ‎05-23-2011 05:03 AM
config vpn ipsec phase1
edit " XXXXX"
set type static
set interface " wan1"
set local-gw 0.0.0.0
set dpd enable
set nattraversal enable
set dhgrp 1 5
set proposal des-md5 3des-sha1 aes128-md5
set keylife 86400
set authmethod psk
set peertype any
set xauthtype disable
set mode main
set localid ' '
set localid-type auto
set remote-gw XXXXX
set dpd-retrycount 3
set dpd-retryinterval 5
set psksecret ENC XXXXX set keepalive 10
next
end
config vpn ipsec phase2
edit " XXXXXX-p2-1"
set auto-negotiate disable
set dst-addr-type subnet
set dst-port 0
set encapsulation tunnel-mode
set keepalive disable
set keylife-type both
set pfs disable
set phase1name " XXXX"
set proposal des-md5 3des-sha1 aes128-sha1
set protocol 0
set replay disable
set selector-match auto
set src-addr-type subnet
set src-port 0
set use-natip enable
set dst-subnet XXXX 255.255.255.0
set keylifekbs 8192
set keylifeseconds 86400
set src-subnet XXXXX 255.255.255.0
next
edit " XXXX-p2-2"
set auto-negotiate disable
set dst-addr-type subnet
set dst-port 0
set encapsulation tunnel-mode
set keepalive disable
set keylife-type both
set pfs disable
set phase1name " XXXXX"
set proposal des-md5 3des-sha1 aes128-sha1
set protocol 0
set replay disable
set selector-match auto
set src-addr-type subnet
set src-port 0
set use-natip enable
set dst-subnet XXX 255.255.255.0
set keylifekbs 8192
set keylifeseconds 86400
set src-subnet XXXXX 255.255.255.0
next
edit " XXXX-p2-3"
set auto-negotiate disable
set dst-addr-type subnet
set dst-port 0
set encapsulation tunnel-mode
set keepalive disable
set keylife-type both
set pfs disable
set phase1name " XXXX"
set proposal des-md5 3des-sha1 aes128-null
set protocol 0
set replay disable
set selector-match auto
set src-addr-type subnet
set src-port 0
set use-natip enable
set dst-subnet XXXX 255.255.255.0
set keylifekbs 8192
set keylifeseconds 86400
set src-subnet XXXX 255.255.255.0
next
end
config vpn ipsec phase2-interface
edit " XXXXXX-p2-1"
set auto-negotiate disable
set dst-addr-type subnet
set dst-port 0
set encapsulation tunnel-mode
set keepalive disable
set keylife-type both
set pfs disable
set phase1name " XXXX"
set proposal des-md5 3des-sha1 aes128-sha1
set protocol 0
set replay disable
set selector-match auto
set src-addr-type subnet
set src-port 0
set use-natip enable
set dst-subnet XXXX 255.255.255.0
set keylifekbs 8192
set keylifeseconds 86400
set src-subnet XXXXX 255.255.255.0
next
edit " XXXX-p2-2"
set auto-negotiate disable
set dst-addr-type subnet
set dst-port 0
set encapsulation tunnel-mode
set keepalive disable
set keylife-type both
set pfs disable
set phase1name " XXXXX"
set proposal des-md5 3des-sha1 aes128-sha1
set protocol 0
set replay disable
set selector-match auto
set src-addr-type subnet
set src-port 0
set use-natip enable
set dst-subnet XXX 255.255.255.0
set keylifekbs 8192
set keylifeseconds 86400
set src-subnet XXXXX 255.255.255.0
next
edit " XXXX-p2-3"
set auto-negotiate disable
set dst-addr-type subnet
set dst-port 0
set encapsulation tunnel-mode
set keepalive disable
set keylife-type both
set pfs disable
set phase1name " XXXX"
set proposal des-md5 3des-sha1 aes128-null
set protocol 0
set replay disable
set selector-match auto
set src-addr-type subnet
set src-port 0
set use-natip enable
set dst-subnet XXXX 255.255.255.0
set keylifekbs 8192
set keylifeseconds 86400
set src-subnet XXXX 255.255.255.0
next
end
Bob - self proclaimed posting junkie!
See my Fortigate related scripts at: http://fortigate.camerabob.com
| User | Count |
|---|---|
| 2750 | |
| 1419 | |
| 812 | |
| 741 | |
| 455 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.