Transparent proxy support for LVS with localnode and realservers (WORKING) (fwd)
Am cc:'ing LVS-devel
Joe
Signature · 11 lines
Joseph Mack NA3T EME(B,D), FM05lw North Carolina jmack (at) wm7d (dot) net - azimuthal equidistant map generator at http://www.wm7d.net/azproj.shtml Homepage http://www.austintek.com/ It's GNU/Linux! ---------- Forwarded message ---------- Date: Thu, 10 Jan 2008 06:49:01 -0800 (PST) From: Joseph Mack NA3T <[email protected]> To: Raphael Vallazza <[email protected]> Subject: Re: [PATCH] Transparent proxy support for LVS with localnode and realservers (WORKING)
Quoted 3 lines · Raphael Vallazza
Quoted 1 line
neat. I thought it was hard enough to move that it wouldn't be just an option :-)
Hehe, yes, it was pretty easy ;)
OK, if you say so.
Quoted 4 lines
Quoted 2 lines
what we'd really like is ipvs hooked into the FORWARD chain. Can you do this too?
To be honest i don't understand the reason for hooking LVS into the FORWARD chain,
Horms would be a better person to speak about this. The general idea is to have the director be a router
o there will not be a VIP on the director. Presumably the director will advertise any VIPs.
o all filtering/fwmarks/NAT/firewalling that normally happens on ingress/egress will not collide with ipvs.
Quoted 1 line
because this way it would not get the
LOCAL_INtraffic and at the same time it would have the same NAT problem as with theLOCAL_INhook.
hmm, what's the NAT problem with having ipvs in the FORWARD chain? (or have I missed your point?)
Quoted 1 line
Maybe i'm missing something, but it seems that PREROUTING is the best point for LVS to act like a real router, because it gets packets that haven't been NATed yet.
A while ago Horms move ipvs to PREROUTING and then decided it was the wrong place and it would be better in the FORWARD chain.
We'll change our minds if we're wrong.
If there are problems and advantages in special cases for FORWARD and PREROUTING, then perhaps we need both versions.
Quoted 1 line
The only negative thing is that traffic can't be filtered in a regular way,
it would be nice to avoid the collisions with firewall rules that we have now.
Quoted 1 line
but using fwmark and the mangle table the user can select the traffic that has to be handled by LVS.
OK
Quoted 1 line
Ok, i'll try to write a short document/example ASAP.
thanks
Joe
Signature · 4 lines
Joseph Mack NA3T EME(B,D), FM05lw North Carolina jmack (at) wm7d (dot) net - azimuthal equidistant map generator at http://www.wm7d.net/azproj.shtml Homepage http://www.austintek.com/ It's GNU/Linux!
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
what we'd really like is ipvs hooked into the FORWARD chain. Can you do this too?
To be honest i don't understand the reason for hooking LVS into the FORWARD chain,
Horms would be a better person to speak about this. The general idea is to have the director be a router
o there will not be a VIP on the director. Presumably the director will advertise any VIPs.
Work, with the PREROUTING method.
Quoted 1 line
o all filtering/fwmarks/NAT/firewalling that normally happens on ingress/egress will not collide with ipvs.
Right, with the PREROUTING only fwmarks are set, filtering and NAT happens after ipvs.
Quoted 1 line
Quoted 1 line
hmm, what's the NAT problem with having ipvs in the FORWARD chain? (or have I missed your point?)
For transparent proxying there has to be a DNAT/REDIRECT to the local machine, if the director/localnode applies the DNAT/REDIRECT rule it only works on the localnode. The realservers get already NATed packets, and replies have the wrong destination ports set.
Quoted 7 lines
Quoted 1 line
Maybe i'm missing something, but it seems that PREROUTING is the best point for LVS to act like a real router, because it gets packets that haven't been NATed yet.
A while ago Horms move ipvs to PREROUTING and then decided it was the wrong place and it would be better in the FORWARD chain.
We'll change our minds if we're wrong.
If there are problems and advantages in special cases for FORWARD and PREROUTING, then perhaps we need both versions.
Yes, you're right. FORWARD could be interesting if the localnode feature isn't required, but it wouldn't solve the transparent proxy problem with localnode + realservers. Well if i add a choice for a FORWARD method the user could choose...
Quoted 3 lines
Quoted 1 line
The only negative thing is that traffic can't be filtered in a regular way,
it would be nice to avoid the collisions with firewall rules that we have now.
Yes, but i can't find a good solution for that if used together with transparent proxying, the only one i've found was the PREROUTING one, any thoughts?
Thanks,
Raphael
Signature · 6 lines
:: e n d i a n :: open source - open minds :: raphael vallazza :: phone +39 0471 631763 :: fax +39 0471 631764 :: http://www.endian.com :: raphael (AT) endian.com
Quoted 3 lines · Raphael Vallazza
Quoted 1 line
o there will not be a VIP on the director. Presumably the director will advertise any VIPs.
Work, with the PREROUTING method.
sorry don't understand. Are you saying that there won't be a VIP on the director with ipvs in PREROUTING either? (in which case I'm happy)
Quoted 3 lines
Quoted 1 line
o all filtering/fwmarks/NAT/firewalling that normally happens on ingress/egress will not collide with ipvs.
Right, with the PREROUTING only fwmarks are set, filtering and NAT happens after ipvs.
it would be nice not to have to handle the ipvs packets with a separate set of rules or thinking.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
hmm, what's the NAT problem with having ipvs in the FORWARD chain? (or have I missed your point?)
For transparent proxying there has to be a DNAT/REDIRECT to the local machine, if the director/localnode applies the DNAT/REDIRECT rule it only works on the localnode. The realservers get already NATed packets, and replies have the wrong destination ports set.
you seem to be more interested in transparent proxy and localnode than most other people on the ml so maybe you have a different interest in it.
I regard transparent proxy only as a way of avoiding having the VIP on the director (perhaps it has other virtues I've ignored), which was pretty neat at the time and I was sorry we lost that capability with 2.4.x kernels. With ipvs no longer in LOCAL_IN, you don't have a requirement for the VIP anymore and presumably you wouldn't need transparent proxy either.
People rarely use localnode. I wouldn't miss it if it didn't exist. Do you want it for other reasons (eg sorry server)? If for a sorry server, could we invoke something like Julian's iproute2 trick that's currently being used to emulate transparent proxy?
Quoted 1 line
Yes, you're right. FORWARD could be interesting if the localnode feature isn't required, but it wouldn't solve the transparent proxy problem with localnode + realservers. Well if i add a choice for a FORWARD method the user could choose...
what's the localnode + realserver problem with transparent proxy?
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
The only negative thing is that traffic can't be filtered in a regular way,
it would be nice to avoid the collisions with firewall rules that we have now.
Yes, but i can't find a good solution for that if used together with transparent proxying, the only one i've found was the PREROUTING one, any thoughts?
Joe
Signature · 4 lines
Joseph Mack NA3T EME(B,D), FM05lw North Carolina jmack (at) wm7d (dot) net - azimuthal equidistant map generator at http://www.wm7d.net/azproj.shtml Homepage http://www.austintek.com/ It's GNU/Linux!
Quoted 3 lines
Quoted 1 line
Work, with the PREROUTING method.
sorry don't understand. Are you saying that there won't be a VIP on the director with ipvs in PREROUTING either? (in which case I'm happy)
Yes, it should also work without a VIP.
Quoted 5 lines
you seem to be more interested in transparent proxy and localnode than most other people on the ml so maybe you have a different interest in it.
I regard transparent proxy only as a way of avoiding having the VIP on the director (perhaps it has other virtues I've ignored), which was pretty neat at the time and I was sorry we lost that capability with 2.4.x kernels. With ipvs no longer in
LOCAL_IN, you don't have a requirement for the VIP anymore and presumably you wouldn't need transparent proxy either.People rarely use localnode. I wouldn't miss it if it didn't exist. Do you want it for other reasons (eg sorry server)? If for a sorry server, could we invoke something like Julian's iproute2 trick that's currently being used to emulate transparent proxy?
Transparent proxying is very important for us because we use IPVS to cluster application level proxies on firewalls. I.E. we have 2 nodes and one of the two acts as master/director, balancing traffic between node 1 (himself, localnode) and node 2 (slave, realnode). We would like support transparent proxying for squid and let the master/director node act as the gateway, outgoing web traffic to port 80 balanced over the node and tranparently redirected to port 8080 (squid). Probably it's an unusual setup for IPVS ;) We could also use tproxy and haproxy, but LVS + keepalived work together like a charm, so we tried to find a solution with LVS.
Quoted 1 line
what's the localnode + realserver problem with transparent proxy?
It's the NAT problem i've described in the previous mail... if LVS resides in LOCAL_IN traffic has to be DNATed before LVS comes into play and the realservers return packets with the wrong/NATed destination port to the client.
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
The only negative thing is that traffic can't be filtered in a regular way,
it would be nice to avoid the collisions with firewall rules that we have now.
Yes, but i can't find a good solution for that if used together with transparent proxying, the only one i've found was the PREROUTING one, any thoughts?
Hmmm, i think i've just understood the solution with FORWARD :) It should also work with transparent proxies, LVS has to nat the traffic for the localnode, instead of letting netfilter DNAT/REDIRECT it.
I'll try to put LVS inside the FORWARD chain and see what happens :)
Thanks,
Raphael
Signature · 6 lines
:: e n d i a n :: open source - open minds :: raphael vallazza :: phone +39 0471 631763 :: fax +39 0471 631764 :: http://www.endian.com :: raphael (AT) endian.com
On Thu, 10 Jan 2008, Raphael Vallazza wrote:
I'm getting arithmetically increasing numbers of replies, so I'm only replying to lvs-devel this time.
Quoted 3 lines
Yes, it should also work without a VIP.
Transparent proxying is very important for us because we use IPVS to cluster application level proxies on firewalls. I.E. we have 2 nodes and one of the two acts as master/director, balancing traffic between node 1 (himself, localnode) and node 2 (slave, realnode).
are you using transparent proxy for localnode?
Quoted 1 line
We would like support transparent proxying for squid and let the master/director node act as the gateway, outgoing web traffic to port 80 balanced over the node and tranparently redirected to port 8080 (squid). Probably it's an unusual setup for IPVS ;)
sorry if I'm being thick and miss the point of your :-) here, but you must know that squids were the first major use of lvs. I haven't kept track of how people are load balancing squids now. I guess I'd assumed they were putting a fwmark on anything to 0/80 (or equivalently NAT'ing it to 3128 and then fwmarking it).
Quoted 3 lines
Quoted 1 line
what's the localnode + realserver problem with transparent proxy?
It's the NAT problem i've described in the previous mail...
I didn't get it then and I'm still having trouble with it.
Quoted 1 line
if LVS resides in
LOCAL_IN, traffic has to be DNATed before LVS comes into play and the realservers return packets with the wrong/NATed destination port to the client.
you're talking about the original LOCAL_IN ipvs. Packets to localnode is just forced to be accept locally. You have LVS-NAT with packets being accepted by transparent proxy.
Can't remember what I thought happened with LVS-NAT and transparent proxy. Just looked at the HOWTO and see the httpds receiving packets by transparent proxy have to be setup to reply on the VIP, but I don't know your problem yet. Can you show the path of the packets and the IPs involved?
Quoted 1 line
Hmmm, i think i've just understood the solution with FORWARD :) It should also work with transparent proxies, LVS has to nat the traffic for the localnode, instead of letting netfilter DNAT/REDIRECT it.
sounds like part of the problem above that I don't understand.
Quoted 1 line
I'll try to put LVS inside the FORWARD chain and see what happens :)
OK. good luck.
The user expects that incoming packets will be messed with by iptables/conntrack before LVS gets them (and the reverse on sending packets out to the realservers). If ipvs is in PREROUTING, you're going to have to make sure that nothing ever gets put in the PREROUTING chain after LVS. If ipvs is in FOWARD then the user will already know that they have to know the order in which packets are hooked (I don't expect much chain hooking goes on in FORWARD)
Joe
Signature · 4 lines
Joseph Mack NA3T EME(B,D), FM05lw North Carolina jmack (at) wm7d (dot) net - azimuthal equidistant map generator at http://www.wm7d.net/azproj.shtml Homepage http://www.austintek.com/ It's GNU/Linux!