2

Assuming port forwarding is done on router, can the router forward if the data is coming from local machine, rather than remote.

For example: Sender targets ip like:88.251.xxx.xxx, port 8999. Receiver listens to that port. Router, forwards 8999 to receiver.

They are all on local network.

Should it run well?

0

3 Answers 3

2

Assuming a simple soho setup, then you dont need to touch anything on the router, the two boxes should talk to each other directly.

2
  • 1
    +1, however if the OP has some software that communicates with the public IP on his router (hardcoded for some reason), then we need to know what type of router he has.
    – Bryan
    Apr 5, 2010 at 12:14
  • @Iraklis Hairpinning is most commonly needed when your web server is behind your NAT gateway, and your domain name www.exmple.com points at the public IP address of your NAT gateway (with port 80 forwarding). If you tell an internal machine's web browser to go to the web server at http://10.0.0.200 and accidentally leave the trailing / off the URL, your web server will redirect you to http://www.example.com/. Now your browser will look up www.example.com and find your NAT gateway's public IP, and try to connect to that. Without hairpinning, that will fail.
    – Spiff
    Apr 6, 2010 at 1:21
2

Yes, it's common and it should run well. The term most commonly used for this is "hairpin NAT". It's when the NAT gateway in a sense performs outbound-NAT on the packet, and then turns it right back around and performs inbound-NAT on the same packet.

Early NAT implementations didn't always perform hairpinning, but it's a pretty common feature on modern NAT implementations. NAT gateway validation test suites like QACafe's CDRouter have built-in test cases for hairpinning.

1

You should note there will be a performance hit from hairpinning traffic. The size of the hit depends on the specific NAT device, traffic load, router CPU, etc.

If the nodes are located internally, you're better off having them talk directly to each other. When possible, I recommend using DNS or host-file magic to direct internal clients to the internal IP address and external clients to the public IP.

You must log in to answer this question.