I noticed at several different LANs connected to the Internet through a NAT the following phenomena. There is a server in the LAN and there is a port forwarding to reach this server also from outside the LAN through the NAT. E.g. consider a LAN with the address 192.168.0.* and a SSH server at with port 22 and a forwarding from port 2222 at the NAT to If the NAT's external IP is, one can connect to the SSH server through Surprisingly this works only from outside the LAN. If one tries to connect to from behind the NAT, there is no answer. Of course one could simply use, but often it is simpler to use the external IP. The typical use case for me is the configuration on a laptop computer. Usually the user uses any arbitrary Internet connection to connect to his home or office server, but sometimes he will use also the LAN to connect to it and it would be annoying to have to different configurations or bookmarks.

Why does it fail to connect from inside the LAN?

Is there any good work around?


The feature you are looking for is officially (according to the IETF, the internet standards body) called "NAT hairpinning", although it also gets called other things, such as "NAT reflection".

Good home gateways support it. Crappy ones don't. If you have a crappy one, either replace it with a good one, or see if you can get a third-party open source aftermarket home gateway firmware distro such as DD-WRT to run on it. (Hmm, I've never actually tested hairpinning with DD-WRT, but it has such a good reputation I would hope this is one of the things it does. )

| improve this answer | |
  • Thanks for your enlightening answer. Unfortunately this sounds like no good news for me. At home I am running a DD-WRT router, but behind the ISP's modem/router. Neither at the office I can replace the ISP's modem/router. A good work-a-round would be nice... – lumbric Jul 5 '12 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.