Skip to main content
lethargos
New Member
Mar 1, 2021 4:30 PM UTC
Question

Routing through VIP - different handling of source ip

Hello,

 

I need help understanding how Fortigate handles two very similar policies.

I've got three vlans with corresponding subinterfaces: 10.20.0.0/16 (project 1), 10.30.0.0/16 (project 2) and 10.40.0.0/16 (project 3).

I've got a VIP mapping 192.168.1.1 (this is actually public, but it's not hugely relevant here) --> 10.30.1.16

When I access the VIP from a server beloning to the same vlan (10.30.1.100), Fortigate changes the source IP from 10.30.1.100 to 10.30.0.1 (so the vlan's gateway).

When I access the VIP from a server belonging to another vlan (10.40.1.12), the receiving server sees the actual ip, so 10.40.1.12.

I can clearly see this in tcpdump and in the packet capture run directly on the Firewall (where the route is for the first scenarion: 10.30.1.100->192.168.1.1->10.30.16 -- and here the ip source changes to 10.30.1.0).

 

The two policies are:

1. interface out - project 1 (subnet 10.30.0.0/16) --> interface in - also project 1 (VIP - 192.168.1.1->10.30.1.16)

2. interfface out - project 3 (subnet 10.40.0.0/16) --> interface in - project 1 (VIP - 192.168.1.1->10.30.1.16)

 

Is this intentional so that it avoid any ip conflict, in case the the packet comes from the server itself (10.30.1.16)?

 

Thank you!

4 replies

lobstercreed
New Member
Mar 2, 2021 9:12 AM UTC

Are you sure you don't just have NAT enabled on the first policy?  That's the kind of behavior I'd expect if you had NAT enabled on the first policy but not the second one.

Translate
lethargos
lethargosAuthor
New Member
Mar 2, 2021 9:45 AM UTC

I've just had a look. No, there's no NAT in the rules themselves that point to the VIP.

 

There is however a general SNAT rule for all three VLANs when the packets go out into the internet. But that shouldn't matter because the destination interface is different (internet-facing one vs the vlan ones) and the packets didn't reach the 10.30.1.16 at all before adding the VIP policies.

Translate
lethargos
lethargosAuthor
New Member
Mar 2, 2021 10:24 AM UTC

This was an interesting hint though! I added NAT to the rule, just to see what happens, and interestingly enough, it changed the source ip to the public ip mapping into the VIP, so in my example 192.168.1.1.

So with NAT it's not using the vlan gateway anymore as a source ip.

Translate
Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024