carp(4) ip loadbalancing (patch included)

Felix J. Ogris fjo-lists at ogris.de
Thu Jan 24 10:24:34 PST 2008


Hi,

I have extended ip_carp.c to provide loadbalancing on an ip basis, eg. to
setup an active/active cluster. The algorithm is quite simple. Each cluster
consists of N nodes. If an IPv4/IPv6 packet reaches node X, then it
evaluates X == N mod source_address_of_IP_packet. If this is true, then the
node will process that packet (carp_forus() returns 1). I had to introduce a
new carp type (#define CARP_HELO 0x00) which by default is multicasted every
3 seconds (advertising base). Each node maintains a list of its IPv4 and
IPv6 neighbours. Neighbours are timed out after 3 * advbase seconds. Network
layer protocols other than IPv4/IPv6 are handled by the carp master. TCP
packets, which have their ACK flag set or their SYN flag not set, are
checked for an entry in the syncache or in tcbinfo. If an entry is found,
then that TCP packet will not be handled by the current node (carp_forus()
returns 0). This guarantees that an established TCP connection will stick to
a host, even if a dead node reenters the cluster.
I have put my patch (against 6.3-RELEASE) under the same license as the
FreeBSD kernel itself. So feel free to apply it to the official tree - or to
punish me for my lousy work :-)

Regards,
Felix

-------------- next part --------------
A non-text attachment was scrubbed...
Name: carp_aa.patch
Type: application/octet-stream
Size: 19169 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20080124/51dfe37f/carp_aa.obj


More information about the freebsd-net mailing list