macsat.com OpenWrt and ASUS WL Forum
January 08, 2009, 10:27:55 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
News: Back to macsat.com
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: How to route traffic that seeks siteA.com to one PC and siteB.com to another  (Read 2408 times)
0 Members and 1 Guest are viewing this topic.
bojansporar
Newbie
*
Offline Offline

Posts: 4


View Profile
« on: September 17, 2006, 19:35:29 PM »

Hi,

I have a problem that I do not know how to solve under linux/oleg's firmware.

I am running lighttpd on the Asus router (oleg's firmware) on a small USB key. I want the traffic going to siteA.com (port 80) to go to the router lighttpd server whereas I would like the router to send traffic asking for siteB.com to point to the PC running a web server on Win NT (one of the computers in my network).

I do not know how to achieve this using iptables or any other proggy if it is possible to do this at all. Any ideas?

Using virtual hosts (lighttpd server) will not do it for me, because I want to use the extensive hard drive on my PC running the web server. So if I get a request for siteA.com I need the request to be served by the router lighttpd server and the request for siteB.com to be served by the PC.

Many thanks if you have any ideas!


Logged
MMCM
Newbie
*
Offline Offline

Posts: 26


View Profile
« Reply #1 on: September 18, 2006, 12:13:12 PM »

Is this what you want?
http://en.wikipedia.org/wiki/Reverse_proxy
Logged
bojansporar
Newbie
*
Offline Offline

Posts: 4


View Profile
« Reply #2 on: September 23, 2006, 19:35:25 PM »

Not exactly, as I do not want to redistribute traffic to the one and the same site (i.e., www.example.com) between two different webservers (one on 192.168.1.100 and the other on xy.200), but would like webserver1 (internally on 192.168.1.100) to serve www.example.com and webserver2 (internally on 192.168.1.200) to serve www.othersite.com.

I will look up if the reverse proxy solution is a possibility, but I am sure there should be something of a more elegant option. Although for sure a proggy needs to run on the router and distribute the traffic between the two webservers.

For now I am simply just having one webserver on port 81 (that is routing to www.example.com:81 to 192.168.1.100:80) and the other one on port80 (192.168.1.1:80, served by the router) ...
Logged
MMCM
Newbie
*
Offline Offline

Posts: 26


View Profile
« Reply #3 on: October 17, 2006, 22:35:03 PM »

Well, a reverse proxy is definitly what you want :-)

And, you're lucky, because lighttpd can do this.

You should take a look at the proxy module for lighttpd.

I'm currently experimenting with openwrt kamikaze on a Netgear WGT634U, and I have installed lighttpd with a some modules, including mod_proxy.
I want to be able to distribute http requests depending on the target hostname to multiple web servers behind the router in a special DMZ vlan and to the router itself (for online statistics with rrdtool).
So, lighttpd listens on my public IP, port 80, gets the http request, looks for what hostname it is, and forwards it to a web server in the DMZ or handles it itself.

It's very simple to configure, and very powerful.

Example in lighttpd.conf

Quote
server.modules = (
...
        "mod_proxy",
...
)

# Forward all requests for *.mydomain.com

$HTTP["host"] =~ "(^|\.)mydomain\.com$" {
        proxy.server = (
                "" => (
                        (
                                "host" => "192.168.254.2",
                                "port" => 80
                        )
                )
        )
}

You can use the above code multiple times with different hostnames and servers.
Hostnames not handled by above statements are processed by lighttpd itself.

I hope this is what you want.

Martin

P.S. I will upgrade my WL-500gx from Oleg's FW to openwrt kamikaze too, when the WGT634U is running as a replacement...
The kernel question (2.4 or 2.6) is still open.
Logged
macsat
Administrator
Sr. Member
*****
Offline Offline

Posts: 1,104



View Profile
« Reply #4 on: October 18, 2006, 07:58:30 AM »


You wont get any wireless support in Kamikaze at current time though - right ?
Logged
MMCM
Newbie
*
Offline Offline

Posts: 26


View Profile
« Reply #5 on: October 18, 2006, 08:32:14 AM »

@macsat: Do you mean wireless on the WL-500gx or on the WGT634U?
WPA-PSK on the WGT634U is running fine with madwifi :-)
On the WL-500gx, I think it's a matter of the kernel version, if the binary broadcom modules do work.
That's why I'm setting up the WGT634U as a replacement, so I have enough time to test everything on the WL-500gx.
If wireless doesn't work at all, I can always reflash Olegs 1.9.2.7e :-)

What I'm missing on Kamikaze is the ipt_psd module, to use Pjotreks iptables script against port scanning attacks.
I think there are problems with the 2.6 kernel and ipt_psd :-(
Logged
macsat
Administrator
Sr. Member
*****
Offline Offline

Posts: 1,104



View Profile
« Reply #6 on: October 18, 2006, 09:46:19 AM »


I meant on the ASUS.

Which wireless chipset does the WGT634U have since it is working?

And yes - unfortunately it seems like broadcom has still only released binary drivers for kernel 2.4. It would be nice if they could at least release a kernel 2.6 version, now that it is quite clear that they are not giving away the sources.
Logged
MMCM
Newbie
*
Offline Offline

Posts: 26


View Profile
« Reply #7 on: October 18, 2006, 10:27:45 AM »

The WGT634U has an Atheros based minipci card.
If it had two USB 2.0 Ports like the WL-500gx, it would be my favourite.
Well, a replacable antenna would be fine too...
Logged
MMCM
Newbie
*
Offline Offline

Posts: 26


View Profile
« Reply #8 on: October 18, 2006, 10:40:57 AM »

Update: In the kamikaze trunk there is a package for bcm43xx wireless, which hopefully will support the 2.6 kernel on the WL-500gx.

http://bcm43xx.berlios.de/
« Last Edit: October 18, 2006, 12:41:34 PM by MMCM » Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

English Steel 1.6 © Saxon North Technologies
Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.144 seconds with 25 queries.