# Clone Existing IPsec VPN

# <span class="lia-message-unread lia-message-unread-windows">[Technical Tip: Cloning IPsec tunnel for other WAN interface](https://community.fortinet.com/t5/FortiGate/Technical-Tip-Cloning-IPsec-tunnel-for-other-WAN-interface/ta-p/359480)</span>

<div class="lia-message-body-wrapper lia-component-message-view-widget-body" id="bkmrk-description-this-art"><div class="lia-message-body" id="bkmrk-description-this-art-1" itemprop="text"><div class="lia-message-body-content"><table cellpadding="2px" cellspacing="2px" class="default-tkb-table" width="99.94755244755245%"><tbody><tr><td width="10%">Description</td><td width="89.94755244755245%"><span style="font-family: arial,helvetica,sans-serif;">This article provides an example of how to clone a site to site IPsec tunnel when one tunnel is created for a wan interface and need clone same for other wan interface.</span>

</td></tr><tr><td width="10%"><span style="font-family: arial,helvetica,sans-serif;">Scope</span></td><td width="89.94755244755245%">FortiGate.</td></tr><tr class="dt-solution-row"><td width="10%"><span style="font-family: arial,helvetica,sans-serif;">Solution</span></td><td width="89.94755244755245%"><span style="font-family: arial,helvetica,sans-serif;">There may be a situation where an IPsec tunnel that has already been established with one WAN interface needs to be replicated for another WAN interface.</span>

<span style="font-family: arial,helvetica,sans-serif;">In order to accomplish this, either use the wizard or recreate the tunnel by entering all the information anew or follow the below document where using cli recreate the tunnel by pasting information which would be a faster method to replicate the tunnel.</span>

<span style="font-family: arial,helvetica,sans-serif;">Firstly, need to gather all the information about this IPsec tunnel from Cli and paste it on a notepad:</span>

<span style="font-family: arial,helvetica,sans-serif;">Phase1 information:</span>

**<span style="font-family: courier new,courier;">config vpn ipsec phase1-interface</span>**

<span style="font-family: courier new,courier;"> edit "IPsecTunnel"</span>

<span style="font-family: courier new,courier;"> set interface "port1"</span>

<span style="font-family: courier new,courier;"> set peertype any</span>

<span style="font-family: courier new,courier;"> set net-device disable</span>

<span style="font-family: courier new,courier;"> set proposal aes128-sha256 aes256-sha256 aes128-sha1 aes256-sha1</span>

<span style="font-family: courier new,courier;"> set comments "VPN: IPsecTunnel (Created by VPN wizard)"</span>

<span style="font-family: courier new,courier;"> set remote-gw x.x.x.x</span>

<span style="font-family: courier new,courier;"> set psksecret ENC cKEiJTnk9PJH1fNS9j7BDqFqUmgiLT4EOqqzJKRlrhMIVnTdYvHmqZHRaRM3p1sz/BjYqCLv0YEZplWjECN6HvzOE2jwY1JU0IPRcFGRkmE2yvMrjltUQEThZNPq73Q9wMOT+vM/M0eW6</span>

<span style="font-family: courier new,courier;">3wEQj/wqpgatsXrRnBxhniXcDp6LssBLsq9MlvwYb3rhAEl7puEOdwYzw==</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

<span style="font-family: arial,helvetica,sans-serif;">Phase2 information:</span>

**<span style="font-family: courier new,courier;">config vpn ipsec phase2-interface</span>**

<span style="font-family: courier new,courier;"> edit "IPsecTunnel"</span>

<span style="font-family: courier new,courier;"> set phase1name "IPsecTunnel"</span>

<span style="font-family: courier new,courier;"> set proposal aes128-sha1 aes256-sha1 aes128-sha256 aes256-sha256 aes128gcm aes256gcm chacha20poly1305</span>

<span style="font-family: courier new,courier;"> set comments "VPN: IPsecTunnel (Created by VPN wizard)"</span>

<span style="font-family: courier new,courier;"> set src-addr-type name</span>

<span style="font-family: courier new,courier;"> set dst-addr-type name</span>

<span style="font-family: courier new,courier;"> set src-name "IPsecTunnel\_local"</span>

<span style="font-family: courier new,courier;"> set dst-name "IPsecTunnel\_remote"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

<span style="font-family: arial,helvetica,sans-serif;">Now, on a notepad make the following changes, Once this is done, paste the content on to cli:</span>

**<span style="font-family: courier new,courier;">config vpn ipsec phase1-interface</span>**

<span style="font-family: courier new,courier;"> edit "IPsecTunnel2" </span>&lt;- Change the Tunnel name. <span style="font-family: courier new,courier;">  
</span>

<span style="font-family: courier new,courier;"> set interface "port5" </span>&lt;- Change port to the desired WAN port.

<span style="font-family: courier new,courier;"> set peertype any</span>

<span style="font-family: courier new,courier;"> set net-device disable</span>

<span style="font-family: courier new,courier;"> set proposal aes128-sha256 aes256-sha256 aes128-sha1 aes256-sha1</span>

<span style="font-family: courier new,courier;"> set comments "VPN: IPsecTunnel (Created by VPN wizard)"</span>

<span style="font-family: courier new,courier;"> set remote-gw x.x.x.x</span>

<span style="font-family: courier new,courier;"> set psksecret ENC "</span>

<span style="font-family: courier new,courier;">cKEiJTnk9PJH1fNS9j7BDqFqUmgiLT4EOqqzJKRlrhMIVnTdYvHmqZHRaRM3p1sz/BjYqCLv0YEZplWjECN6HvzOE2jwY1JU0IPRcFGRkmE2yvMrjltUQEThZNPq73Q9wMOT+vM/M0eW6</span>

<span style="font-family: courier new,courier;">3wEQj/wqpgatsXrRnBxhniXcDp6LssBLsq9MlvwYb3rhAEl7puEOdwYzw==</span>

<span style="font-family: courier new,courier;">"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

<span style="font-family: arial,helvetica,sans-serif;">For the PSK part, follow the instructions shown in the screenshot below to paste it:</span>

<span class="lia-inline-image-display-wrapper lia-image-align-center"><span class="lia-message-image-wrapper lia-message-image-actions-narrow lia-message-image-actions-below">![pskclon.PNG](https://community.fortinet.com/t5/image/serverpage/image-id/64264i30ED79791D902256/image-dimensions/649x363/is-moderation-mode/true?v=v2 "pskclon.PNG")</span></span>

**<span style="font-family: courier new,courier;">config vpn ipsec phase2-interface</span>**

<span style="font-family: courier new,courier;"> edit "IPsecTunnel2" -&gt;&gt;&gt;Change the Tunnel name </span>

<span style="font-family: courier new,courier;"> set phase1name "IPsecTunnel2" -&gt;&gt;&gt;Change the Tunnel name </span>

<span style="font-family: courier new,courier;"> set proposal aes128-sha1 aes256-sha1 aes128-sha256 aes256-sha256 aes128gcm aes256gcm chacha20poly1305</span>

<span style="font-family: courier new,courier;"> set comments "VPN: IPsecTunnel (Created by VPN wizard)"</span>

<span style="font-family: courier new,courier;"> set src-addr-type name</span>

<span style="font-family: courier new,courier;"> set dst-addr-type name</span>

<span style="font-family: courier new,courier;"> set src-name "IPsecTunnel\_local"</span>

<span style="font-family: courier new,courier;"> set dst-name "IPsecTunnel\_remote"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

<span style="font-family: arial,helvetica,sans-serif;">After, verify that the tunnel has been created from the GUI:</span>

<span class="lia-inline-image-display-wrapper lia-image-align-center"><span class="lia-message-image-wrapper lia-message-image-actions-narrow lia-message-image-actions-below">![ipsectunnels.PNG](https://community.fortinet.com/t5/image/serverpage/image-id/64241iC2EBD0C936BB8C7E/image-dimensions/650x145/is-moderation-mode/true?v=v2 "ipsectunnels.PNG")</span></span>

 Before cloning the tunnel

<span class="lia-inline-image-display-wrapper lia-image-align-center"><span class="lia-message-image-wrapper">![IPsectunnels2.PNG](https://community.fortinet.com/t5/image/serverpage/image-id/64242i43015656C4320A40/image-dimensions/651x71/is-moderation-mode/true?v=v2 "IPsectunnels2.PNG")</span></span>

After cloning the tunnel:

<span style="font-family: arial,helvetica,sans-serif;">Get the information for static route and firewall policy:</span>

**<span style="font-family: courier new,courier;">config router static</span>**

<span style="font-family: courier new,courier;"> edit 2</span>

<span style="font-family: courier new,courier;"> set device "IPsecTunnel"</span>

<span style="font-family: courier new,courier;"> set comment "VPN: IPsecTunnel (Created by VPN wizard)"</span>

<span style="font-family: courier new,courier;"> set dstaddr "IPsecTunnel\_remote"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

**<span style="font-family: courier new,courier;">config firewall policy</span>**

<span style="font-family: courier new,courier;"> edit 2</span>

<span style="font-family: courier new,courier;"> set name "vpn\_IPsecTunnel\_remote\_0"</span>

<span style="font-family: courier new,courier;"> set uuid 7e44106e-a776-51ef-dedb-e06d8c3a0afb</span>

<span style="font-family: courier new,courier;"> set srcintf "IPsecTunnel"</span>

<span style="font-family: courier new,courier;"> set dstintf "port2"</span>

<span style="font-family: courier new,courier;"> set action accept</span>

<span style="font-family: courier new,courier;"> set srcaddr "IPsecTunnel\_remote"</span>

<span style="font-family: courier new,courier;"> set dstaddr "IPsecTunnel\_local"</span>

<span style="font-family: courier new,courier;"> set schedule "always"</span>

<span style="font-family: courier new,courier;"> set service "ALL"</span>

<span style="font-family: courier new,courier;"> set comments "VPN: IPsecTunnel (Created by VPN wizard)"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

**<span style="font-family: courier new,courier;">config firewall policy</span>**

<span style="font-family: courier new,courier;"> edit 1</span>

<span style="font-family: courier new,courier;"> set name "vpn\_IPsecTunnel\_local\_0"</span>

<span style="font-family: courier new,courier;"> set uuid 7e35bbcc-a776-51ef-5990-8db56fd0e567</span>

<span style="font-family: courier new,courier;"> set srcintf "port2"</span>

<span style="font-family: courier new,courier;"> set dstintf "IPsecTunnel"</span>

<span style="font-family: courier new,courier;"> set action accept</span>

<span style="font-family: courier new,courier;"> set srcaddr "IPsecTunnel\_local"</span>

<span style="font-family: courier new,courier;"> set dstaddr "IPsecTunnel\_remote"</span>

<span style="font-family: courier new,courier;"> set schedule "always"</span>

<span style="font-family: courier new,courier;"> set service "ALL"</span>

<span style="font-family: courier new,courier;"> set comments "VPN: IPsecTunnel (Created by VPN wizard)"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

<span style="font-family: arial,helvetica,sans-serif;">After, clone/copy the firewall policies for the tunnel and change the tunnel interface to a new tunnel.</span>

<span style="font-family: arial,helvetica,sans-serif;">CLI:</span>

**<span style="font-family: courier new,courier;">config firewall policy</span>**

<span style="font-family: courier new,courier;">clone 1 to 3</span>

<span style="font-family: courier new,courier;">clone 2 to 4</span>

<span style="font-family: courier new,courier;">end</span>

<span style="font-family: arial,helvetica,sans-serif;">After, change the IPsec tunnel interface from the GUI or just paste the copied firewall policy with a modified IPsec tunnel:</span>

**<span style="font-family: courier new,courier;">config firewall policy</span>**

<span style="font-family: courier new,courier;"> edit 2</span>

<span style="font-family: courier new,courier;"> set name "vpn\_IPsecTunnel\_remote\_0"</span>

<span style="font-family: courier new,courier;"> set uuid 7e44106e-a776-51ef-dedb-e06d8c3a0afb</span>

<span style="font-family: courier new,courier;"> set srcintf "IPsecTunnel2" </span>&lt;- Change the Tunnel name.

<span style="font-family: courier new,courier;"> set dstintf "port2"</span>

<span style="font-family: courier new,courier;"> set action accept</span>

<span style="font-family: courier new,courier;"> set srcaddr "IPsecTunnel\_remote"</span>

<span style="font-family: courier new,courier;"> set dstaddr "IPsecTunnel\_local"</span>

<span style="font-family: courier new,courier;"> set schedule "always"</span>

<span style="font-family: courier new,courier;"> set service "ALL"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

**<span style="font-family: courier new,courier;">config firewall policy</span>**

<span style="font-family: courier new,courier;"> edit 1</span>

<span style="font-family: courier new,courier;"> set name "vpn\_IPsecTunnel\_local\_0"</span>

<span style="font-family: courier new,courier;"> set uuid 7e35bbcc-a776-51ef-5990-8db56fd0e567</span>

<span style="font-family: courier new,courier;"> set srcintf "port2"</span>

<span style="font-family: courier new,courier;"> set dstintf "IPsecTunnel2" </span>&lt;- Change the Tunnel name.

<span style="font-family: courier new,courier;"> set action accept</span>

<span style="font-family: courier new,courier;"> set srcaddr "IPsecTunnel\_local"</span>

<span style="font-family: courier new,courier;"> set dstaddr "IPsecTunnel\_remote"</span>

<span style="font-family: courier new,courier;"> set schedule "always"</span>

<span style="font-family: courier new,courier;"> set service "ALL"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

<span style="font-family: arial,helvetica,sans-serif;">GUI:</span>

<span class="lia-inline-image-display-wrapper lia-image-align-center"><span class="lia-message-image-wrapper">![clone firewalll policy.PNG](https://community.fortinet.com/t5/image/serverpage/image-id/64243i22E8AB665FB5711A/image-dimensions/651x99/is-moderation-mode/true?v=v2 "clone firewalll policy.PNG")</span></span>

 Clone method

<span class="lia-inline-image-display-wrapper lia-image-align-center"><span class="lia-message-image-wrapper">![clonefirewallpolicy.PNG](https://community.fortinet.com/t5/image/serverpage/image-id/64244i6A52D9B687C2A3C4/image-dimensions/647x151/is-moderation-mode/true?v=v2 "clonefirewallpolicy.PNG")</span></span>  
<span style="font-family: arial,helvetica,sans-serif;">Similarly, clone or copy the static route and set the interface to the new Tunnel interface.</span>

<span style="font-family: arial,helvetica,sans-serif;">CLI:</span>

**<span style="font-family: courier new,courier;">config router static</span>**

<span style="font-family: courier new,courier;"> edit 3</span>

<span style="font-family: courier new,courier;"> set device "IPsecTunnel2" </span>&lt;- Change the Tunnel name.

<span style="font-family: courier new,courier;"> set dstaddr "IPsecTunnel\_remote"</span>

<span style="font-family: courier new,courier;"> next</span>

<span style="font-family: courier new,courier;">end</span>

<span style="font-family: arial,helvetica,sans-serif;">GUI:</span>

<span class="lia-inline-image-display-wrapper lia-image-align-center"><span class="lia-message-image-wrapper lia-message-image-actions-narrow lia-message-image-actions-below">![clone static route.PNG](https://community.fortinet.com/t5/image/serverpage/image-id/64245i4425F7EDA2DF4ABD/image-dimensions/651x86/is-moderation-mode/true?v=v2 "clone static route.PNG")</span></span>

<span class="lia-inline-image-display-wrapper lia-image-align-center"><span class="lia-message-image-wrapper lia-message-image-actions-narrow lia-message-image-actions-below">![clonedstaticroute2.PNG](https://community.fortinet.com/t5/image/serverpage/image-id/64246iB051073114ECD7D3/image-dimensions/650x274/is-moderation-mode/true?v=v2 "clonedstaticroute2.PNG")</span></span></td></tr></tbody></table>

</div></div></div>