From owner-freebsd-net Fri Mar 5 16:52:54 1999 Delivered-To: freebsd-net@freebsd.org Received: from maxwell.syr.edu (maxwell.syr.edu [128.230.129.5]) by hub.freebsd.org (Postfix) with ESMTP id 698EE14CF9 for ; Fri, 5 Mar 1999 16:52:51 -0800 (PST) (envelope-from cmsedore@maxwell.syr.edu) Received: from exchange.maxwell.syr.edu (exchange.maxwell.syr.edu [128.230.129.241]) by maxwell.syr.edu (8.9.1a/8.9.1) with ESMTP id TAA03652 for ; Fri, 5 Mar 1999 19:42:03 GMT Received: by exchange.maxwell.syr.edu with Internet Mail Service (5.5.1960.3) id ; Fri, 5 Mar 1999 19:52:34 -0500 Message-ID: <262C3DA9BE0CD211971700A0C9B413A1CBC7@exchange.maxwell.syr.edu> From: Christopher Sedore To: "'freebsd-net@freebsd.org'" Subject: IP source address based load balancing Date: Fri, 5 Mar 1999 19:52:33 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.1960.3) Content-Type: text/plain Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org At Jordan's suggestion, I'm posting this on this list. I just subscribed, but have not yet received confirmation on my subscription, so please be sure to CC: me on anything I should see. I've implemented a basic form of load balancing for IP based services. It works by assigning the same IP address to multiple machines, having all the machines receive the IP packets for that address but only pass the ones from specific sources up to the stack. The notion is that you can split the IP address space up (I use a mask and a comparison value) to distribute load across servers. My experiments have been in using the least significant bit in the 4th octet in an IP address (ie whether the 4th octet is odd or even). I don't have many high-load things here, so my testing doesn't say too much about performance. You can use any bit or bits that make sense to distribute load. I hope to go further and add redundancy through this methodology by writing a daemon to monitor the cluster and reconfigure to achieve failover. This was done with some relatively simple mods to the IP input, ARP, and ioctl routines; as well as some modification to the in_aliasreq and ifaliasreq structures. My testing has been limited thus far, but I'd be interested in learning whether or not there is interest in the code, and if so, finding someone else to look over the code, as well as try it out for themselves. The kernel code is pretty clean, but the userland interface is fairly simplistic. The kernel code might need some stylistic adjustment and some optimization, and could be extended quite a bit to include a better selection algorithm, port based service distribution, etc. Ideally, ifconfig would be extended to deal with some of the options, but I almost fainted when I examined the ifconfig source--I wrote a simple 20 line C program to do the config instead. The code mods are against 3.1-Release, but I'd guess that the patches would apply fairly easily to any 3.0 or later system. I believe that I've located an odd behavior and a bug (I don't think that the de driver supports if_allmulti correctly--I've tried fixing it without much success as yet). In any case, the code does appear to work fine with fxp and ep drivers (the only other two I have here). You can try telneting to 128.230.143.88 from an odd-4th-octet address and an even-4th-octet address and see what you get. Notice the host banners. -Chris To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message