Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one public IP address, one router and multiple servers behind the router.

I would like to forward differing domains (All using HTTP) through the router to different servers.

For example:      =>      =>  =>  =>

I understand that this could be accomplished using Port Forwarding, but I need all hosts running on port 80.

I found some information about IP Masquerading, but I found this difficult to understand, and I am not sure if it is what I am after.

Another solution I have found is to direct all traffic to Reverse Proxy server, which forwards the requests onto the appropriate server. What about iptables?

I am using a Billion 7404 VNPX router. Is there a feature that this router has that can accomplish this?

Are these my only options? Have I missed something completely? Is one recommended over the others?

I have searched around but I don't think I am hitting the correct keywords.

share|improve this question

The best solution would be to user a HTTP reverse proxy. For this you can use:

We are using apache with mod_proxy, but I am thinking to go with pound.

As a hardware appliance you can use a Cisco Content Service Switch. See:

share|improve this answer
Can you comment why you are thinking of using pound? What are the advantages? And maybe you can provide an example config file, you use in your system? – rubo77 Feb 20 at 21:32
Pound is designed to be a reverse proxy. It is optimized only for this use. I did not used it as the apache performance was acceptable for our traffic. – Mircea Vutcovici Feb 21 at 21:44

I've had an idea, and I'd like to know if anyone has some feedback on it.

If I use the Reverse Proxy idea, I think I can resolve the issue quite simply. I am already using Nginx on the other servers, so this is my server of choice for a Reverse Proxy.

At the router, I will forward all incoming connections on port 80 to my Reverse Proxy server. I will have Nginx running on this server with the following configuration file:

server {
    listen *:80;
    location / {
        proxy_pass    http://$host;

What this appears to do is proxy the request to the same host. But here's the trick, in my /etc/hosts file I will map all of the domains to their internal IPs.

So the Reverse Proxy server will route the requested host to the same host, but at this point it should look up the local hosts file, and map that to the internal IP address. It also means I can "set and forget" the Nginx configuration file.

A potential problem is if a local hostname has not been configured, then the Reverse Proxy will send the request back out to the Internet. However, I think NAT will stop this from getting stuck in an infinite loop.

This solution seems to work in my head, and on paper, but I won't be able to set this up for a while.

Can anybody see any reason why this will not work?


share|improve this answer
I think this might work, but you MAY be in for a surprise if people contact your reverse proxy and do assorted "nasty" things to it. – Vatine Dec 22 '10 at 11:39
it is working. We are using in this way to have the same hostname from the browser and also in the request from the proxy towards the website. The browser is resolving the domain using DNS and the reverse proxy is resolving the same domain using hosts. And you will have an infinite number of requests if you forgot to configure it in the hosts and the reverse proxy is allowed to browse the Internet. And better is to have one IP configured for the DNS that is resolving the hosts for Internet and an internal IP for intranet. IN this way the local requests does not go trough the proxy. – Mircea Vutcovici Dec 22 '10 at 14:28
Thanks for your help guys. – user10270 Dec 23 '10 at 1:57
This sounds realy strange. What if a user contacts your server with a request for a domain you have not configured in your hosts file? I think this solution is only a dirty hack, that shold not be used in production environments! – rubo77 Feb 20 at 21:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.