[RADIATOR] Multi-homed, Virtual IP and source IP
Thomas Guthmann
tguthmann at iseek.com.au
Mon May 31 19:10:43 CDT 2010
Hi Hugh,
> Radiator does not have access to the UDP packet headers - it simply gives the packet to the operating system to send.
Indeed.
But I looked into the code and it took me a whole morning to remember my
sockets knowledge and to understand Radiator's low layers. And then it
was so obvious and so simple that I wonder why I haven't thought about
that before. That's maybe why you didn't understand my question, because
it was a dumb one :)
*Solution*
You bind a socket to an interface. And therefore you will reply with
this interface. So instead using the default bind to 0.0.0.0. You just
have to listen to the interfaces you are interested in with BindAddress.
Radiator will create different sockets per IP aka interfaces and Bob's
your uncle.
*Example*
[..]
BindAddress VIP1,VIP2,VIP3,RIP,127.0.0.1
[..]
# Listen to everything for SNMP queries
<SNMPAgent>
BindAddress 0.0.0.0
</SNMPAgent>
*Contrib*
If you add the following code after the variable definitions in your
init.d script it will generate the BindAddress parameter automatically
in a sub config. So you need to tell radiator to include this file or
the directory containing this file
(/etc/radiator/conf.d/bindaddresses.cfg). This code will parse ifconfig
and add all IPs in BindAddress. This is a quick hack, feel free to improve.
/etc/init.d/radiator
[..]
# LVS support so Radiator will use the good VIP to reply to requests
# Indeed if Radiator listens to 0.0.0.0 it will use eth0's IP to reply
# which will break the dialogue (the client may complain that he's
# receiving an answer of an unknown server).
# Tom - 26/5/10
grep -q '^net.ipv4.conf.eth0.arp_ignore' /etc/sysctl.conf
if [[ $? == 0 ]]
then
LOCALIPS="`/sbin/ifconfig |grep 'inet addr:' |cut -d ':' -f2
|cut -d ' ' -f1`"
BINDADDRESSES=`echo $LOCALIPS |tr ' ' ','`
echo "BindAddress $BINDADDRESSES" >
/etc/radiator/conf.d/bindaddresses.cfg
else
if [ -f /etc/radiator/conf.d/bindaddresses.cfg ]
then
/bin/rm -f /etc/radiator/conf.d/bindaddresses.cfg
fi
fi
# End Tom
[..]
Thanks guys for your time and hope it will help lost mind like mine :)
Thomas
More information about the radiator
mailing list