Transparent load balancing

Chuck Swiger cswiger at mac.com
Mon Jul 11 17:44:09 UTC 2011


On Jul 11, 2011, at 9:49 AM, Unga wrote:
> I need to implement a transparent load balancing daemon in C.
> 
> That is, the daemon accept a TCP connection, get more info from the client, and forward the communication transparently to another server to handle it.
> 
> How this could be implemented on FreeBSD? What basic primitives I should study more?

You can use redirect_address in natd to accomplish simple round-robin load-balancing, ie:

 -redirect_address localIP[,localIP[,...]] publicIP

 These forms of -redirect_port and -redirect_address are used
 to transparently offload network load on a single server and
 distribute the load across a pool of servers.	This function
 is known as LSNAT (RFC 2391).	For example, the argument
		       
	tcp www1:http,www2:http,www3:http www:http

 means that incoming HTTP requests for host www will be trans-
 parently redirected to one of the www1, www2 or www3, where a
 host is selected simply on a round-robin basis, without
 regard to load on the net.

Regards,
-- 
-Chuck



More information about the freebsd-questions mailing list