Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 192.168.1.101 example1.com 192.168.1.102 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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.