Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Apr 2007 21:50:42 +0530
From:      "Rajkumar S" <rajkumars@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   Re: Spillover routing?
Message-ID:  <64de5c8b0704070920q986b5fat7523ac2b4e2b53d7@mail.gmail.com>
In-Reply-To: <4617B23D.1090502@FreeBSD.org>
References:  <64de5c8b0704060004s5d2f4416if88f32cc45c77aba@mail.gmail.com> <4617B23D.1090502@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 4/7/07, Bruce M. Simpson <bms@freebsd.org> wrote:

> Rajkumar S wrote:
> > I have a low cost 128kbps and a high cost 512 kbps link to internet.
> > Is it possible to do a "spillover" routing

> This feature is almost certainly not going to be present in the base
> system.

I was almost sure of this, but was just checking if I did miss some
thing. To do spillover load balancing, I need to

1. Measure the current bandwidth.
2. If the current b/w is above certain limit, all new sessions should
go via backup gateway, till the b/w in old gateway comes back to safe
limit.

I can measure the bandwidth using any userspace tools, and a simple
approach would be to  add  the new gateway to the route-to rule when
the b/w is above limit and remove it when the usage comes down.

One problem with this approach is that when I add a new gateway, only
round-robin [with sticky-address option] algorithm is available,
though I would have liked to have  all new sessions to be via new
gateway and old sessions via old gateway. When it's strictly round
robin, 50% of new sessions would have to go via existing gateway,
causing some congestion. I prefer to have old sessions via old gateway
because if some website expects all connections to be from same public
ips they will not be disappointed.

Another more ambitious and complex method would be to make use of tags
support in pf, and use tags to select which gateway a session should
use. Tagging can be done outside pf, and netgraph seems to be well
suited for it.

I can write a ng_tag, which can attach to  upper and lower hook of lan
interface, silently selecting which session should go to which gateway
such that when a overload message is passed to it, all new sessions
can be tagged to go via new gateway.

This will also open up possibility of having ratios other than 1:1
when I have to use multiple gateways, some thing like 2:1 between two
gateways. This is particularly useful when I have a 512 and 256 link,
and want to use both of them together.

ng_netflow already does most of the stuff, ie parsing the raw traffic
flow into sessions good enough for load balancing,

I am not sure if I want to take this route though. there is a big
learning curve involved when I start coding. So before I plunge into
it, I just want to check what other listers think about this.

regards,

raj



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?64de5c8b0704070920q986b5fat7523ac2b4e2b53d7>