Firewall Support Center

FortiGate VIP Works Externally but Fails Internally: Hairpin NAT Troubleshooting

Trace internal access to a FortiGate public VIP and identify DNS, hairpin policy, source NAT, and return-path problems.

Internal client10.10.10.25 requests 198.51.100.10:443
FortiGate VIPDestination becomes 10.20.20.50:443
Server responseMust return through the translation path
Illustrative troubleshooting view · Firewall Support Center

Why external success is only part of the picture

A published application can work from a mobile network and fail from an office VLAN. The external test verifies one path. An internal client reaches the public service through a different ingress interface and may require a different policy or return-path treatment. Fortinet calls internal use of an external mapping hairpin NAT, also known as NAT loopback or U-turn NAT.

Describe the exact mapping

For this example, app.example.com resolves to the documentation address 198.51.100.10. A VIP maps HTTPS to server 10.20.20.50. Client 10.10.10.25 is inside the organization. Record whether the actual client and server share a subnet, which interface receives the request, and which interface the translated request should leave. Also record whether policy NAT or Central NAT is in use.

Check DNS before NAT

Resolve-DnsName app.example.com
Test-NetConnection app.example.com -Port 443 -InformationLevel Detailed

Interpret the endpoint result

Run these tests from an internal Windows client and compare them with the external result. If internal DNS returns a private server address, the traffic uses that private path. If it returns the public VIP, trace the hairpin path. Keep the hostname in the final application test because TLS certificates and virtual hosting can depend on it.

Observe the request on FortiGate

diagnose sniffer packet any 'host 10.10.10.25 and tcp port 443' 4 50 l

Follow the translated connection

The client-only capture may miss server-side traffic when source NAT changes the client address. Capture the server address in a second bounded test and compare both views. Confirm the VIP definition, its interface binding, port mapping, matching firewall policy, and policy hit evidence. Use debug flow for the specific connection when rule selection remains unclear.

Understand the return-path problem

When the server can respond directly to the client, its response can bypass the FortiGate that performed destination translation. In some designs, scoped source NAT keeps the response on the translated path. In others, routing already ensures this. Decide from the observed topology. Source translation also changes the client address seen by the server, which affects application logging.

Choose the approach that fits the application

ApproachDesign consideration
Hairpin through the public VIPPreserves the public destination path and needs correct policy and return handling
Internal DNS answer for the serviceUses a private path and needs matching DNS, certificates, and access controls
Dedicated application proxyIntroduces a different termination and logging architecture

Validate internal and external users

After a scoped repair, confirm name resolution, TCP establishment, TLS identity, application login, and server-side logging. Test clients on the relevant internal VLANs and from a genuine external network. Keep the original configuration and measured outcome so a future DNS or routing change can be assessed against this working state.

Official references

Fortinet hairpin NAT

Fortinet sniffer trace