Networking – Access internal server using external ip

networkingrouter

If I've got a typical home router — say a Net Gear — which has certain ports forwarded to a internal server, is there a way to tweak the router to let me access that internal server using the external IP address from within the same network? Is there a non-enterprise grade router that can handle this type of thing?

In case that was strangely worded, let me re-phrase with an example.

My external IP is 1.2.3.4.
My internal server is 10.4.3.100
Port 1178 is being forwarded from the router to 10.4.3.100.

I'd like to be able to be able to hit 10.4.3.100 from an internal ip of 10.4.3.10 by using the external ip of 1.2.3.4. Possible?

Best Answer

This is called hairpinning, and while some domestic routers can do this, they are rare - that is a matter for research.

Using split DNS is often a better way to approach this type of issue. Usually when accessing the public IP address from inside the network is needed, it is because there is a device that needs to access an internal resource from both outside and inside the network. It is configured to use the public address when outside, but then needs to be reconfigured to use the private address when internal.

Using split DNS can solve this problem by using a public DNS service for the the external address, but then running an internal DNS server that serves the internal IP address for the same DNS entry.

Lets say for example that your 1.2.3.4 IP address has the dns name myserver.domain.com, which works when external to your network. You would then install a forwarding DNS server on your internal network, perhaps on the 10.4.3.100 server. It would have a zone file for myserver.domain.com, resolving the myserver.domain.com address to 10.4.3.100. Set this to have a low TTL so that it doesn't get cached for long.

You would use your internal DNS server for any name resolution while within your network, forwarding any requests it cannot resolve itself on to your ISP.

You would then configure any applications to not use 1.2.3.4 but to use myserver.domain.com, and they will work both inside and outside the network.

Related Question