0

Is port forwarding of the same service running on distinct hosts behind a NAT, on the same port possible? For example, if there are two hosts 192.2.0.2 and 192.2.0.3 using the gateway(NAT) 192.2.0.1 to access the Internet both running a web server on port 80, to which host is an external client directed upon sending an HTTP request to the NAT(to its public address)?

Can a same request(towards the NAT's public address) be made from within the LAN?

1
  • On the NAT level, no you cannot. Using name-based VHosts may work for HTTP but not anything else.
    – qasdfdsaq
    Sep 7, 2015 at 16:08

1 Answer 1

1

Port-forwarding is intended to be used with fixed rules. Although you could write a script to switch the destination host time-to-time to "distribute" the traffic, it is not a good idea as NAT does not know about the HTTP sessions. The result would be a lot of lost connections and one host would be hit by 100% of the traffic at any given time.

You might want to use a session aware HTTP proxy/loadbalancer for this like HAProxy or nginx.

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.