Hairpin NAT for an Internal Web Server
An SRX1500 at a logistics company uses three zones: trust (10.20.0.0/16), dmz (172.16.10.0/24), and untrust (reth0.0). A public web server at 172.16.10.10 is published with a static NAT mapping to 203.0.113.10. Internet users can reach the site over HTTPS, and the server can reach vendor update sites. Internal users on the trust zone can reach the server at 172.16.10.10, but when they type https://203.0.113.10 the connection times out. The security policies currently permit trust-to-dmz any, trust-to-untrust any, and untrust-to-dmz HTTPS. Source NAT is configured as interface NAT for trust-to-untrust. The helpdesk has asked for a split-horizon DNS record that points internal users to the private IP, but the security team wants to understand the NAT behavior first. The SRX is the default gateway for the trust zone and holds the public address on reth0.0.
1. Why does trust-to-public-IP access time out while Internet access to the same public IP works?
Read the worked answer
The inbound path works because packets from the Internet enter the untrust interface, where the destination NAT rule set is applied, and are translated to 172.16.10.10 before the security policy is evaluated. The trust-to-public path is different. The packet from a trust host to 203.0.113.10 enters the trust interface, but the destination NAT rule set is bound to untrust, so it is not evaluated on the trust ingress. The SRX then routes the packet toward its default route or treats the destination as local, depending on addressing, and the translation to the DMZ server never happens. Even if the packet somehow reaches the server, the return path would not match the original flow cleanly. The policy trust-to-dmz being any does not help, because the packet is not being destination-NATted into the DMZ. This is a NAT-application problem, not a missing security policy. That is why internal users can reach 172.16.10.10 directly but not the public address.
2. What configuration changes would you make to support hairpin access, and in what order should the SRX process them?
Read the worked answer
Add a destination NAT rule set bound to the trust interface that matches destination 203.0.113.10/32 and statically translates it to 172.16.10.10. Add a source NAT rule for trust-to-dmz so the server replies to the SRX's DMZ address rather than to the original 10.20.x.x client; interface source NAT on the dmz interface is the usual choice. Confirm the trust-to-dmz policy permits HTTPS to 172.16.10.10. The processing order matters: the SRX evaluates destination NAT before source NAT, so the packet is first translated to the private server address, then source-NATted for the return path. The security policy then sees the translated destination. Without the trust-bound destination NAT rule, the public address is never mapped on that ingress. Without source NAT, the server may reply directly to the client and bypass the SRX, producing an asymmetric flow that is dropped. Verify with a flow trace and session table showing both translations.
3. Compare hairpin NAT with split-horizon DNS for this requirement.
Read the worked answer
Hairpin NAT keeps a single URL and public certificate for all users, but it adds translation state and makes troubleshooting harder because internal and external clients use different NAT paths to the same server. It also consumes SRX sessions and can complicate logging because the original source is hidden unless you log pre-NAT information. Split-horizon DNS is simpler on the firewall: internal clients resolve the server to 172.16.10.10 and take a direct trust-to-dmz path, while external clients resolve to 203.0.113.10. The trade-off is DNS complexity and the risk of inconsistent records or certificate name mismatches if the internal name differs. Split-horizon DNS also avoids the hairpin performance cost and is usually easier to audit. If the application must present the same public name internally, hairpin NAT is justified; otherwise I would prefer split-horizon DNS for operational simplicity.