Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2011 10:43:51 -0700
From:      Chuck Swiger <cswiger@mac.com>
To:        Unga <unga888@yahoo.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Transparent load balancing
Message-ID:  <E3C4F1C8-3E14-484A-A9EA-B1CE65A81B81@mac.com>
In-Reply-To: <1310402991.9928.YahooMailClassic@web160114.mail.bf1.yahoo.com>
References:  <1310402991.9928.YahooMailClassic@web160114.mail.bf1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E3C4F1C8-3E14-484A-A9EA-B1CE65A81B81>