This is a Canonical Question about Hairpin NAT (Loopback NAT).
The generic form of this question is:
We have a network with clients, a server, and a NAT Router. There is port forwarding on the router to the server so some of it's services are available externally. We have DNS pointing to the external IP. Local network clients fail to connect, but external work.
- Why does this fail?
- How can I create a unified naming scheme (DNS names which work both locally and externally)?
This question has answeres merged from multiple other questions. They originally referenced FreeBSD, D-Link, Microtik, and other equipment. They're all trying to solve the same problem however.
Answer
What you're looking for is called "hairpin NAT". Requests from the internal interface for an IP address assigned to the external interface should be NAT'ted as though they came in from the external-side interface.
I don't have any FreeBSD familiarity at all, but reading the "pf" manual for OpenBSD (http://www.openbsd.org/faq/pf/rdr.html) the proposed solutions of split-horizon DNS, using a DMZ network, or TCP proxying lead me to believe that "pf" doesn't support hairpin NAT.
I'd look at going the route of split-horizon DNS and not using IP addresses in URLs internally but, instead, using names.
Comments
Post a Comment