Configure router to redirect different hostnames to different machines

I have configured many routers and have never seen a feature like this in off the shelf routers. As far as I know you only get these types of features on high-end enterprise routers like SonicWall and Cisco routers. These range in prices, but the SonicWall I used had this feature and was about a $3,000 router.

This is really an advanced task your trying to accomplish. If your up for it you can buy a router compatible with DD-WRT or OpenWRT and get that type of feature for under $200 buck. you gotta flash it and then go from there.

@Dan offers another option which is software based, which may be the easiest method depending on how large of a network and how many servers you have behind that router. You may be able to configure Apache as a proxy and forward request to other internal Apache servers.

Apache mod_proxy - http://httpd.apache.org/docs/2.0/mod/mod_proxy.html


As previously mentioned, it's impossible for most routers.

However, there are always other methods, which I felt might be valuable to those that land on this topic:

For those that want to accomplish this for INCOMING requests to a server, it is possible through another, FREE, method:

You could have 1 main server ACT as your router. Let me explain. If you are using Apache, you have the built-in ability to host multiple domains as a "Virtual Host" - If your server has enough resources to handle it, you might be better off with multiple directories on 1 server. You can configure Apache to listen on the same IP for multiple "ServerName" (domains), while pointing to different directories.

If you wanted to have files for each domain on a separate server, you could setup a network share, and point that "ServerName" to that the NFS or SAMBA mount. With either setup, you are dependent on the main server's resources, as that is where the processing will take place.

For those that want to accomplish this for OUTGOING requests, from a client computer, it is possible through another, FREE, method:

On your computer, with admin privileges, edit your /etc/hosts file, basically just insert a new row with your destination IP and the domain name you want to point there:

127.0.0.1 yourdomain.com

Here's a pretty good how-to for all OS's: http://support.hostgator.com/articles/general-help/technical/how-do-i-change-my-hosts-file