Community Pick: Many members of our community have endorsed this article.

The most common NAT problem


AKA "why can't I reach my server on its external IP from an internal IP?"

As a Networking ZA/PE, I see a rather significant number of NAT-related (network address translation) questions whose problems can all be attributed to a single issue.  

Typically the scenario involves an internal network that is connected to the internet via some sort of NAT device. The internal network contains a server. The server hosts some arbitrary number of services. No internal client can connect to these services via an external IP that has been forwarded (via some sort of DNAT) to the server. This issue can even affect client processes on the server itself if those processes attempt to connect to the server via its externally forwarded IP.

To resolve this problem, an understanding of the underlying cause is helpful.

A NAT device exists with an external IP of It connects an internal network with the range 10.1.2.x to the internet via SNAT with an internal IP of A server exists on the internal network at IP All appropriate inbound connections to are forwarded (via DNAT) to A client with IP attempts to access a service on the server via the externally forwarded IP address of (typically, the client obtains the external IP through its name resolution/resolver engine which often includes configured DNS servers and a local hosts file). Here is the communication breakdown:

The client ( sends a packet to the server via the externally forwarded IP (

The NAT device translates the destination IP from to and forwards the packet. The source address of the client ( remains the same.

The server ( receives the packet with a source of the client (

The server ( sends a response packet directly to the client (

The client, having sent a request to the server at, does not expect a response from the server at, and the replies are discarded.

Given an understanding of the above, there are two obvious methods to resolve this problem.

Reconfigure the resolver:

The clients will not experience this problem if they can be configured to access the server directly on its internal IP. Split-DNS is a possible solution. Using split-DNS, the DNS servers responsible for address (A) records that correspond to the server reply with the external IP ( when contacted by external clients, and reply with the internal IP ( when contacted by internal clients. This is typically the preferred solution, if it can be implemented.

Another solution (which is not generally scalable) using the resolver is to add/push entries for the local IP of the server to the local hosts files on all local machines (probably \windows\system32\drivers\etc\hosts in windows,  /etc/hosts in unix/linux/os x)

Reconfigure the NAT device:

Be forewarned, this may not be possible for all NAT devices (particularly appliances). Since the original client connection travels through the NAT device (remember, the client is accessing the server through the external IP on the NAT device), the NAT device should be reconfigured to source-NAT (SNAT) the packets from the client so that they appear to originate from the NAT device (packets flowing through the NAT device from 10.1.2.x are re-written so as to appear to originate from

Of course, this requires a stateful NAT device which will keep track of SNATted connections so that the replies from the server are handled correctly, but generally any modern NAT device that supports SNAT should satisfy this requirement.  Implementing an SNAT solution does have the unfortunate side-effect of preventing meaningful client address information from appearing in the server logs, although client connection information can be collected on the NAT device (if supported), and later unified with the server logs.

Relevant questions:

Nat U-Turn - Netscreen N50 - A reminder about false positives (a service on the NAT device may pollute test results when testing on the port associated with such a service)

Connection forwarding with iptables - An interesting instance in which the situation occurs on the public internet.

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.