Created on 05-19-2011 10:20 AM
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
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1742 | |
1113 | |
759 | |
447 | |
241 |
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.