lvs-users
|
To: | "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx> |
---|---|
Subject: | Re: LVS-DR and fwmarks question |
From: | Matthew Crocker <matthew@xxxxxxxxxxx> |
Date: | Wed, 1 Oct 2003 16:04:01 -0400 |
Hello,I'm currently using a setup where I have individual webservers which are using port based virtual hosts in apache. For instance, I have port 5678 and 5679 which map to ports 80 and 443 on a virtual host. I'm currentlyusing a commercial solution to schedule these hosts and keep thempersistant together, however I'm hoping to switch these over to my LVS-DRbox. It appears that the fwmark group is what I would want to do to keep people going to both ports persistant, but from the documentation itdidn't appear that you could do port mapping while doing fwmarks. I was wondering if anyone had done this and if they could share how they made itwork if they had. This would be for a shopping cart type applicationwhere switching between port "80" and "443" were necessary for security,but because the application uses php sessions it has to go back to thesame server each time. It appears very easy to do if they were actually listening on port 80 and 443 but since they're not I'm very confused aboutthe correct way to configure this. So the client is going to 12.34.56.78:80 & 12.34.56.78:443 you want to redirect them internally to 10.0.0.1:5678 & 10.0.0.1:5679 respectively? This can be done with a combination of LVS, fwmark and iptables DNAT First step is to mark the packets with a fwmarkiptables -t mangle -A PREROUTING -d 12.34.56.78/255.255.255.255 -i eth0 -p tcp -m tcp --dport 80 -j MARK --set-mark 0x1 iptables -t mangle -A PREROUTING -d 12.34.56.78/255.255.255.255 -i eth0 -p tcp -m tcp --dport 443 -j MARK --set-mark 0x1 Second step is to change the destination port to the correct port using DNAT iptables -t nat -A PREROUTING -d 12.34.56.78/255.255.255.255 -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 12.34.56.78:5678 iptables -t nat -A PREROUTING -d 12.34.56.78/255.255.255.255 -i eth0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 12.34.56.78:5679 Third step is to load balance based off of the fwmark with persistance. ipvsadm -a -f 1 -s wlc -p 600 ipvsadm -a -f 1 -r 10.0.0.1:0 -g -w 1 ipvsadm -a -f 1 -r 10.0.0.2:0 -g -w 1This is all off the top of my head but it should work. Step two might be an issue because the iptable docs say the nat table only picks up socket creation packtes (aka SYN packets). Hope this helps -Matt The short answer is that you can't using LVS. But I wonder if it might be possible to change the destination port using nefilter before or after the packets hit LVS. Alternatively it would be possible to modify LVS to do this, the main issue in my mind would be working out a sane way to configure it. -- Horms _______________________________________________ LinuxVirtualServer.org mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx Send requests to lvs-users-request@xxxxxxxxxxxxxxxxxxxxxx or go to http://www.in-addr.de/mailman/listinfo/lvs-users |
<Prev in Thread] | Current Thread | [Next in Thread> |
---|---|---|
|
Previous by Date: | RE: Error connecting /tmp/.vrrp wdog socket, Peter Mueller |
---|---|
Next by Date: | RE: Error connecting /tmp/.vrrp wdog socket, Ajit Kashyap |
Previous by Thread: | Re: LVS-DR and fwmarks question, Horms |
Next by Thread: | Re: LVS-DR and fwmarks question, Faruk Ahmed |
Indexes: | [Date] [Thread] [Top] [All Lists] |