FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
Gab_FTNT
Staff
Staff
Article Id 242267
Description This article describes how to configure an IPsec tunnel with Overlapping Subnets using vips.
Scope FortiGate.
Solution

This method is used as a workaround if changing the subnet is not possible.
The real fix for this issue is to change the subnet on one side.

Only use this method as a last resort.

Gab_FTNT_0-1673017477725.png

 
In this example, computer 10.10.10.22 want to communicate with computer 10.10.10.56 on the other side of the tunnel.
To achieve communication, it is necessary to create a new subnet on both sides and translate the traffic using a VIP.

FortiGate A internal Subnet 10.10.10.0/24 is going to be map to 1.1.1.0/24.
FortiGate B internal Subnet 10.10.10.0/24 is going to be map to 2.2.2.0/24.

Note that 1.1.1.0/24 and 2.2.2.0/24 subnets are used as examples.
Use a private IP range for configuration.

Let's review the configuration:

Configuration on FortiGate A.

Go to Policy & Objects -> Addresses and select 'Create New'.


1) Create the local subnet address:

 

Gab_FTNT_1-1673017549784.png

 

2) Create the new local Subnet for IPsec:

 

Gab_FTNT_2-1673017564138.png

 

3) Create the new Remote subnet Address:

 

Gab_FTNT_3-1673017577297.png

 

4) Change the local and remote subnet on the IPsec Phase 2 Selectors for the new subnet.

 

Gab_FTNT_4-1673017593304.png

Gab_FTNT_5-1673017609281.png


It is also either possible to choose the Named Address previously created or Select Subnet and add manually.

If there are multiple subnets to route on the tunnel, it is also possible to use 0.0.0.0/0 as the local and remote subnets.

5) Create the VIP.


Go to Policy & Object -> Virtual Ips and select 'Create New'.

 

Gab_FTNT_6-1673017637599.png

 

The purpose of this VIP is to translate traffic coming from 1.1.1.0 to the internal subnet 10.10.10.0
For example, inbound traffic with destination 1.1.1.46 will be routed to 10.10.10.46

Make sure to select the IPsec tunnel in the Interface Option:

 

Gab_FTNT_7-1673017676006.png

 

Otherwise, this can cause routing issues from Lan to Wan.

6) Apply the VIP to the Inbound Policy only.
 

Gab_FTNT_8-1673017709993.png

 

Gab_FTNT_9-1673017722163.png

 

Gab_FTNT_9-1673017722163.png


There is now, an Inbound Policy with destination V

IP and an Outbound policy to Destination New remote subnet.

 

Gab_FTNT_10-1673017782260.png


7) Configure the static route:


Go to Network -> Static Route.

 

Gab_FTNT_11-1673017813817.png

This route says that to reach 2.2.2.0/24, send the traffic over the IPSec tunnel.


Configuration on FortiGate B.

Go to Policy & Objects -> Addresses and select 'Create New'.


1) Create the local subnet address:

 

Gab_FTNT_12-1673017844226.png

 

2) Create the new local Subnet for IPsec:

 

Gab_FTNT_13-1673017856720.png

 

3) Create the new Remote subnet Address:

 

Gab_FTNT_14-1673017870350.png

 

4) Change the local and remote subnet on the IPsec Phase 2 Selectors for the new subnet.

 

Gab_FTNT_15-1673017891689.png

Gab_FTNT_16-1673017898461.png

If there are multiple subnets to route on the tunnel,l it is also possible touse 0.0.0.0/0 as the local and remote subnets.

5) Create the VIP.


Go to Policy & Object -> Virtual Ips and select 'Create New'.

 

Gab_FTNT_17-1673017932154.png


Make sure to select the IPsec tunnel in the Interface Option.

6) Apply the VIP to the Inbound Policy only.
 

Gab_FTNT_18-1673017960534.pngGab_FTNT_19-1673017974907.png


There is now an Inbound Policy with destination VIP and an Outbound policy to Destination New remote subnet.

 

Gab_FTNT_20-1673018033682.png


7) Configure the static route:


Go to Network -> Static Route.

 

Gab_FTNT_21-1673018053887.png

 

This route says that to reach 1.1.1.0/24, send the traffic over the IPsec tunnel.

Test the behavior.

Computer 10.10.10.22 on FortiGate A side wants to communicate with Computer 10.10.10.56 on FortiGate B side.
Computer 10.10.10.22 will need to send traffic to the new assigned subnet by replacing 10.10.10.56 by 2.2.2.56.

Gab_FTNT_22-1673018078775.png

 

The same goes for Computer 10.10.10.56 who wants to communicate with computer 10.10.10.22.
Computer 10.10.10.56 will need to send traffic to the new assigned subnet replacing 10.10.10.56 by 1.1.1.22.

Gab_FTNT_23-1673018095611.png


Troubleshooting steps

1) Start a Debug Flow on the FortiGate side to the traffic flow.


Open the CLI and run the following:


# diagnose debug flow filter addr 1.1.1.22  <----- IP address you are trying to communicate with.
# diagnose debug flow filter proto 1 
<----- This specify proto 1 which is ICMP.
# diagnose debug flow trace start 999
# diagnose debug enable


2) Send continuous ping from one side to the other.


C:\Users\Fortinet>ping 1.1.1.22 -t

3) Read the debug. This will give a good understanding of where the issue resides.

If the issue persists, contact Fortinet Support for more assistance.

Contributors