Mailing List Archive

real server using freebsd
Hi, a client wants to have 2 freebsd servers set up behind LVS. Has anyone
successfully configured freebsd (4.2) real servers behind an LVS with DR? If
you have or know where I might find good docs please reply thanks.

Jeffrey Schoolcraft
Re: real server using freebsd [ In reply to ]
Jeffrey A Schoolcraft wrote:
>
> Hi, a client wants to have 2 freebsd servers set up behind LVS. Has anyone
> successfully configured freebsd (4.2) real servers behind an LVS with DR? If
> you have or know where I might find good docs please reply thanks.

I've done it with nearly every available Unix as a Realserver and with
LVS_DR. No problem, it's all in the howto of Joe. And if you can't find
it, drop a note and I'll show you. (BTW: Plan9 doesn't work yet)

Regards,
Roberto Nibali, ratz

--
mailto: `echo NrOatSz@tPacA.cMh | sed 's/[NOSPAM]//g'`
Re: real server using freebsd [ In reply to ]
Jeffrey A Schoolcraft wrote:
>
> Hi, a client wants to have 2 freebsd servers set up behind LVS. Has anyone
> successfully configured freebsd (4.2) real servers behind an LVS with DR? If
> you have or know where I might find good docs please reply thanks.

In principle you can do VS-DR with any OS on the real-servers. FreeBSD honours
the -arp flag so they are easy. You can do it by hand.

I don't know whether anyone has done 4.2. Ratz has done 2.2.5,3.2 and 3.3.
My configure script will attempt to setup those machines using the info supplied
by Ratz. Since I haven't been able to test the script, it may need minor
fiddling.
If you want to try this script, look for "FreeBSD" with your editor and add the
commands for v4.2.

Whatever way you get it to work, please send me the commands for 4.2

Thanks Joe

--
Joseph Mack PhD, Senior Systems Engineer, Lockheed Martin
contractor to the National Environmental Supercomputer Center,
mailto:mack.joseph@epa.gov ph# 919-541-0007, RTP, NC, USA
Re: real server using freebsd [ In reply to ]
> In principle you can do VS-DR with any OS on the real-servers. FreeBSD honours
> the -arp flag so they are easy. You can do it by hand.
>
> I don't know whether anyone has done 4.2. Ratz has done 2.2.5,3.2 and 3.3.

Me, I've done it :)

> My configure script will attempt to setup those machines using the info supplied
> by Ratz. Since I haven't been able to test the script, it may need minor
> fiddling.
> If you want to try this script, look for "FreeBSD" with your editor and add the
> commands for v4.2.
>
> Whatever way you get it to work, please send me the commands for 4.2

It's the same, I think the *BSD folks are not gonna change it like
the Linux folks ;)

ifconfig lo0 alias <VIP> netmask 0xffffffff -arp up

ratz

--
mailto: `echo NrOatSz@tPacA.cMh | sed 's/[NOSPAM]//g'`
Re: real server using freebsd [ In reply to ]
ratz wrote:
>

> > I don't know whether anyone has done 4.2. Ratz has done 2.2.5,3.2 and 3.3.
>
> Me, I've done it :)

> It's the same, I think the *BSD folks are not gonna change it like
> the Linux folks ;)

that make it easy.

> ifconfig lo0 alias <VIP> netmask 0xffffffff -arp up

will update script

thanks
Joe
--
Joseph Mack PhD, Senior Systems Engineer, Lockheed Martin
contractor to the National Environmental Supercomputer Center,
mailto:mack.joseph@epa.gov ph# 919-541-0007, RTP, NC, USA
Re: real server using freebsd [ In reply to ]
> It's the same, I think the *BSD folks are not gonna change it like
> the Linux folks ;)

Julian, as it seems, Alexey and Andi are not going to deploy the hidden
feature for kernel 2.4. But how about introducing the arpfilter? It's
NET_IPV4_CONF_ARPFILTER for ip_sysctrl. This has more likely the chance
of getting into the mainstream kernel. From the list:

"-arp means that the kernel will not put in link layer to the packets.
It's probably not what you want. Yes the option is misnamed. 2.2 has
arpfilter, which will hopefully end up in 2.4 soon too."

There is a patch flying around for 2.4. This patch will enable only
answer ARP requests on this device when the routing table would send
packets to the source it to the same device.

Ask Alexey for more info if you don't already know ;)
Regards,
Roberto Nibali, ratz

--
mailto: `echo NrOatSz@tPacA.cMh | sed 's/[NOSPAM]//g'`
Re: real server using freebsd [ In reply to ]
Hello Ratz,

On Tue, 23 Jan 2001, ratz wrote:

> > It's the same, I think the *BSD folks are not gonna change it like
> > the Linux folks ;)
>
> Julian, as it seems, Alexey and Andi are not going to deploy the hidden
> feature for kernel 2.4. But how about introducing the arpfilter? It's
> NET_IPV4_CONF_ARPFILTER for ip_sysctrl. This has more likely the chance
> of getting into the mainstream kernel. From the list:
>
> "-arp means that the kernel will not put in link layer to the packets.
> It's probably not what you want. Yes the option is misnamed. 2.2 has
> arpfilter, which will hopefully end up in 2.4 soon too."
>
> There is a patch flying around for 2.4. This patch will enable only
> answer ARP requests on this device when the routing table would send
> packets to the source it to the same device.
> Ask Alexey for more info if you don't already know ;)

These URLs are from the linux-kernel discussion. You can find here
all the arguments:

http://marc.theaimsgroup.com/?t=95743539800002&w=2&r=1

http://marc.theaimsgroup.com/?l=linux-kernel&m=95747521113399&w=2


In short: the arpfilter flag is the other variant to
block ARP: if you have two interfaces you can restrict the
ARP responses only for the routes that point to the same interface
the ARP requests come from. For example:

eth0: 192.168.0.1/24, arpfilter=1
eth1: 192.168.1.1/24, arpfilter=0

ARP broadcast request for local IP 192.168.0.1:

come from eth0: who-has 192.168.0.1 tell 192.168.0.2 answer, same dev
come from eth0: who-has 192.168.0.1 tell 192.168.1.2 drop, 1.2 is on eth1
come from eth1: who-has 192.168.0.1 tell 192.168.0.2 answer
come from eth1: who-has 192.168.0.1 tell 192.168.1.2 answer

So, with arpfilter you drop all probes in eth0 that come from addresses
reached through another interface. We can see such request when
we put the two NICs in one hub (switched or shared). With arpfilter=0
we answer through both interfaces.

In the LVS case we have setup with one NIC which can't be
solved using arpfilter. Why? Because the uplink router is on the
same route where the request come from: eth0.

The ARP problem can be explained in this way:

1. we want to talk IP with local clients or the uplink gateway
2. we don't want to talk ARP with same IP addresses in (1)

But I explained this here:

http://marc.theaimsgroup.com/?l=linux-kernel&m=95782600528062&w=2


In short:

arpfilter=1: reply only for addresses on this device
hidden=1: don't reply for addresses on this device

Oposite:) hidden=1 is the Linux 2.0 (and other unices) behavior.


May be someone can come with exotic advanced routing rules to
solve the arp problem. May be I can't see something obvious that allows
arpfilter to solve the DR/TUN ARP problem.

I thought some time for additional route flags, etc. But can't
come with something that is a more clear idea.

The selection of the VIP as source address in the ARP probes
can be avoided in this way:

ip addr add VIP/32 brd + dev lo scope host

Now we have to find a solution to block ARP, i.e.:

- ignore the ARP request (not to reply for VIP) from LAN IP

- talk IP with the same LAN IP

LAN IP in our case is: (1) Client (2) Uplink gateway
These two hosts can probe for VIP and we don't want to reply.

> Regards,
> Roberto Nibali, ratz
>
> --
> mailto: `echo NrOatSz@tPacA.cMh | sed 's/[NOSPAM]//g'`

Regards

--
Julian Anastasov <ja@ssi.bg>
Re: real server using freebsd [ In reply to ]
> These URLs are from the linux-kernel discussion. You can find here
> all the arguments:
>
> http://marc.theaimsgroup.com/?t=95743539800002&w=2&r=1

I've read through it ... <big pause> ... well, sigh, I mean: Let's
also propose the "different routing table" approach with arp_filter
to lvs users. I mean, as long as they're not going to implemenet or
even accept the way you/we want to have it (hidden if) this is s
solution and maybe not even so dirty, just as Andi said, it's dirty
in configuration but not in c:

ip rule add prio 100 from VIP-net/24 iif eth0 table 100
ip route add table 100 blackhole VIP
ip rule add prio 101 from 0/0 iif eth0 table 101
ip route add table 101 local VIP dev eth0

Is this a solution?

> In short: the arpfilter flag is the other variant to
> block ARP: if you have two interfaces you can restrict the
> ARP responses only for the routes that point to the same interface
> the ARP requests come from. For example:
>
> eth0: 192.168.0.1/24, arpfilter=1
> eth1: 192.168.1.1/24, arpfilter=0
>
> ARP broadcast request for local IP 192.168.0.1:
>
> come from eth0: who-has 192.168.0.1 tell 192.168.0.2 answer, same dev
> come from eth0: who-has 192.168.0.1 tell 192.168.1.2 drop, 1.2 is on eth1
> come from eth1: who-has 192.168.0.1 tell 192.168.0.2 answer
> come from eth1: who-has 192.168.0.1 tell 192.168.1.2 answer

No it's definitely clear, thanks ;)

> May be someone can come with exotic advanced routing rules to
> solve the arp problem. May be I can't see something obvious that allows
> arpfilter to solve the DR/TUN ARP problem.

In next life probable, I mean you can always write up supercomplex
routing table setups and mix them with arp_filter and rp_filter and
fw_mark and whatever you like but I agree with you, that the hidden
if solution is with LVS the best solution.

Thank you for all the links and explanations,
Roberto Nibali, ratz

--
mailto: `echo NrOatSz@tPacA.cMh | sed 's/[NOSPAM]//g'`
Re: real server using freebsd [ In reply to ]
> Whatever way you get it to work, please send me the commands for 4.2

I would be interested as well!

Thx,

Ivan

idf@weewannabe.com





> Thanks Joe
>
> --
> Joseph Mack PhD, Senior Systems Engineer, Lockheed Martin
> contractor to the National Environmental Supercomputer Center,
> mailto:mack.joseph@epa.gov ph# 919-541-0007, RTP, NC, USA
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users@LinuxVirtualServer.org
> Send requests to lvs-users-request@LinuxVirtualServer.org
> or go to http://www.in-addr.de/mailman/listinfo/lvs-users
>
Re: real server using freebsd [ In reply to ]
Hello Ratz,

On Tue, 23 Jan 2001, ratz wrote:

> > These URLs are from the linux-kernel discussion. You can find here
> > all the arguments:
> >
> > http://marc.theaimsgroup.com/?t=95743539800002&w=2&r=1
>
> I've read through it ... <big pause> ... well, sigh, I mean: Let's
> also propose the "different routing table" approach with arp_filter
> to lvs users. I mean, as long as they're not going to implemenet or
> even accept the way you/we want to have it (hidden if) this is s
> solution and maybe not even so dirty, just as Andi said, it's dirty
> in configuration but not in c:
>
> ip rule add prio 100 from VIP-net/24 iif eth0 table 100
> ip route add table 100 blackhole VIP
> ip rule add prio 101 from 0/0 iif eth0 table 101
> ip route add table 101 local VIP dev eth0
>
> Is this a solution?

Yes, this solution is in /arp.html: 3. The policy routing approach
But with reduced rules that are enough.

But you can see that this is not a complete solution, we can't
support clients on the same LAN. These rules block both the IP and
the ARP traffic. There is no way to distinguish the requests (arrived
from the LVS box) with saddr=CIP from the ARP probes who-has VIP tell CIP.
The above rules block not only the ARP but also the IP traffic. So,
we can't test the DR method with clients from the LAN. This solution
is for the users that don't run clients on the same LAN. They will block
the ARP probes from the router. We assume connections with saddr=ROUTER
will not come to the real servers :) The router sends only traffic
with saddr=CIP (from the world) to the VIP. But this assumption can
fail very soon. Do we know the standards very well? I don't. I'm not
sure whether the router will not send to the real server packet with
saddr=ROUTER that will be fatally ignored.

> > May be someone can come with exotic advanced routing rules to
> > solve the arp problem. May be I can't see something obvious that allows
> > arpfilter to solve the DR/TUN ARP problem.
>
> In next life probable, I mean you can always write up supercomplex
> routing table setups and mix them with arp_filter and rp_filter and
> fw_mark and whatever you like but I agree with you, that the hidden
> if solution is with LVS the best solution.

No, I'm serious :) May be there is something simple, two or three
commands that will block the ARP but will allow the IP traffic from
the clients. May be by using fwmark in the real server (I'm so happy that
LVS is after the routing in 2.4 :) ):

# Mark only IP, forget ARP
ipchains -A input -d VIP 80 -m 1
# Accept locally the marked IP traffic for VIP
ip rule add prio 100 fwmark 1 table 100
ip route add table 100 local 0/0 dev lo

but make sure the spoofing will not occur (the uplink router must
check the source addresses). Because packet with saddr=VIP and daddr=VIP
will not be detected as spoofed (BTW, you can have many VIPs).

So, the result is:

- we don't have local VIP, so we don't reply for it
- we don't have local VIP, so we don't announce it in the ARP probes
"who-has ROUTER tell VIP". Instead, we use
"who-has ROUTER tell RIP"
- we have rules to accept the IP traffic locally

Are we happy?

May be someone after a little testing can achieve the expected
results. But may be there is something wrong that I'm missing now.
But why so many problems to setup adv routing when you can patch with
the hidden feature and to forget for the problems :))) No security
problems, no complex setups :) But this is only my advice :)

echo 1 > /proc/sys/net/ipv4/conf/all/hidden
echo 1 > /proc/sys/net/ipv4/conf/lo/hidden

Now add your VIPs:

# Single VIP
ip addr add VIP/32 brd + dev lo scope host
# Class C
ip addr add VIP_NET/24 brd + dev lo scope host

It seems everything in 2.4 goes in the opposite direction for
LVS :))) May be because only LVS needs such features :) So, we wait
the kernel features to stabilize and ... then to provide patches for
our needs :)

> Thank you for all the links and explanations,
> Roberto Nibali, ratz
>
> --
> mailto: `echo NrOatSz@tPacA.cMh | sed 's/[NOSPAM]//g'`


Regards

--
Julian Anastasov <ja@ssi.bg>
Re: real server using freebsd [ In reply to ]
is there any special kernel config I need to do (like include ip aliasing or
something) for v4.2 to work? or can I just put that

ifconfig lo0 alias <VIP> netmask 0xffffffff -arp up

in some type of init/start up script?

Thanks,

Jeffrey Schoolcraft

* ratz (ratz@tac.ch) wrote:
> > In principle you can do VS-DR with any OS on the real-servers. FreeBSD honours
> > the -arp flag so they are easy. You can do it by hand.
> >
> > I don't know whether anyone has done 4.2. Ratz has done 2.2.5,3.2 and 3.3.
>
> Me, I've done it :)
>
> > My configure script will attempt to setup those machines using the info supplied
> > by Ratz. Since I haven't been able to test the script, it may need minor
> > fiddling.
> > If you want to try this script, look for "FreeBSD" with your editor and add the
> > commands for v4.2.
> >
> > Whatever way you get it to work, please send me the commands for 4.2
>
> It's the same, I think the *BSD folks are not gonna change it like
> the Linux folks ;)
>
> ifconfig lo0 alias <VIP> netmask 0xffffffff -arp up
>
> ratz
>
> --
> mailto: `echo NrOatSz@tPacA.cMh | sed 's/[NOSPAM]//g'`
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users@LinuxVirtualServer.org
> Send requests to lvs-users-request@LinuxVirtualServer.org
> or go to http://www.in-addr.de/mailman/listinfo/lvs-users
Re: real server using freebsd [ In reply to ]
On Wed, 24 Jan 2001, Jeffrey A Schoolcraft wrote:

> is there any special kernel config I need to do (like include ip aliasing or
> something) for v4.2 to work? or can I just put that
>
> ifconfig lo0 alias <VIP> netmask 0xffffffff -arp up
>
> in some type of init/start up script?

that's it

Joe
--
Joseph Mack mack@ncifcrf.gov
Re: real server using freebsd [ In reply to ]
Jeffrey A Schoolcraft wrote:
>
> is there any special kernel config I need to do (like include ip aliasing or
> something) for v4.2 to work? or can I just put that

Not that I'd know of. See, on BSD systems you hardly ever compile
unless you develop. Most of the stuff is configurable.

> ifconfig lo0 alias <VIP> netmask 0xffffffff -arp up
>
> in some type of init/start up script?

Jep, check out if you got the /etc/ifaliases. There you could put it,
however I'm not sure if this is for OpenBSD only. Just try it out, it
will not explode your machine ;)

Regards,
Roberto Nibali, ratz

--
mailto: `echo NrOatSz@tPacA.cMh | sed 's/[NOSPAM]//g'`