i have a linux box that has 2 NICs, it serves as a firewall/router with red NIC connected to public static IP and green NIC to a switch, and then i have 3 servers connected to the switch that run multiple VMs with Bridged networking, so they have IP leases as if they were "physically" part of the network.

i also have multiple domain names registered, say example1.com and example2.com im wondering if its possible, and if so how can it be done, to redirect traffic to a specific internal IP based on domain name... so say the two domain names are mapped by my DNS provider to my one and only public ip, but i have multiple servers and services i want mapped to specific domain... so whenever i get a request with domain name example1.com my router will forward that traffic to the internal server behind it...

so basically i can map multiple domains to a single public ip, but i have many local IPs that can be assigned to the domain

something like example1.com example2.com

i know such a scenario is possible with apache2 and virtual hosts because the HTTP header includes the domain name but would i need to have a DNS setup on the firewall in order to translate domain name to internal IP... basically VPS hosting

1 Answer 1


If you had one Server behind the router which would host all pages under serveral hostnames Name Based Virtual Hosting would be working for you the way you suggest.

Since you are talking about different hosts, and since hosts communicate via TCP/IP and not via HTTP this won't work. In fact the Router or the Hosts per se could not care less about the HTTP/1.1 Hostname provided

You are left with the possibility to setup a reverseproxy which will take all requests coming in via the Red Zone and then distribute the requests to the application Servers in the Green Zone.

You might do NameBased Vhosts on the Reverseproxy if you need to.

  • but that would only work for HTTP right?
    – 40pro
    Jun 29, 2016 at 3:35

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.