sandy's blog

2/11/2005

Routing and Apache Gateways

I switched my broken Linksys router from NAT Gateway to Router and back again, and now I can connect through it to machines on my 192.168.0.0/24 subnet. Hmmm... Maybe I won't need to replace it after all. Now to blog how I set up routing to my Apache servers with private IP addresses on that subnet... I have a machine (home.sorn.net) with a public IP address (81.86.17.116) running an Apache server. This machine acts as a gateway to the other servers. I have a NAT Gateway (wireless.sorn.net) on the same subnet as the Apache gateway server which has got various ports set up to forward to port 80 on each web server on the private network. Setting this up depends on which router you use. If the Apache gateway machine is running Linux (or any other Unix-like system), you could make it do the routing to the private network too. The Apache gateway server has had entries like this added to its apache2.conf file: <VirtualHost *:80> ServerName www.macmini.wireless.sorn.net ProxyPass / http://wireless.sorn.net:84/ </VirtualHost> And make sure these lines aren't commented out: LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_http_module modules/mod_proxy_http.so And finally, I have DNS set up so that a host name points at the Apache gateway server for each machine behind the NAT gateway. The host macmini.wireless.sorn.net has IP address 192.168.0.4, and www.macmini.wireless.sorn.net points at 81.86.17.116 (the gateway server). The above virtual host directive in the Apache config tells apache to redirect requests with this hostname to port 84 on the NAT router. The NAT router then forwards the request to macmini.wireless.sorn.net where a web server will server up a web page. A side-effect of this setup is that Netcraft now things the server's OS is Linux and it's running Apache on Darwin. I'm sure some fun could be had with this type of setup with a Microsoft/IIS host behind the gateway.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home