From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

In network computing, hairpinning (or NAT loopback) describes a communication between two hosts behind the same NAT device using their mapped endpoint. Because not all NAT devices support this communication configuration, applications must be aware of it.

Hairpinning is where a machine on the LAN is able to access another machine on the LAN via the external IP address of the LAN/router (with port forwarding set up on the router to direct requests to the appropriate machine on the LAN).


Consider a private network with the following:

  • Gateway address:
  • Host 1:
  • Host 2:
  • The gateway has an external IP :
  • Host 1 runs a P2P application P1 on its port 12345 which is externally mapped to 4444.
  • Host 2 runs a P2P application P2 on its port 12345 which is externally mapped to 5555.

If the NAT device supports hairpinning, then P1 application can connect to the P2 application using the external endpoint If not, the communication will not work.

See also[edit]


This notion is officially described in 2008, RFC 5128.