Date: Tue, 13 Aug 2013 14:41:53 +0200 From: Daniel Hartmeier <daniel@benzedrine.cx> To: "artem@artem.ru" <artemkuchin76@gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: Different providers for different nat clients Message-ID: <20130813124153.GA16266@insomnia.benzedrine.cx> In-Reply-To: <520A2279.6050600@artem.ru> References: <520A2279.6050600@artem.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 13, 2013 at 04:11:37PM +0400, artem@artem.ru wrote: > There is a router with 3 interfaces: > > IF1: PROVIDER A > IF2: PROVIDER B > IF3: LAN > > Clients served via NAT. There are about 15 clients. > > Now, what i need to do: > > By default all traffic from all clients goes to PROVIDER A via IF1. > But, if total incoming traffic for any particular client becomes > over X Mb then that client > and only that client must be switch for PROVIDER B. The switch must > be automatic and must > not use any software on the client side. > While i know how to count traffic i don't understand how to route > external traffic to/from > nat clients on particular external interface. > > Any idea how it is done? This is called source-based routing, and at least pf and ipfw support it. Using pf it could look like table <overquota> nat on IF1 from !IF1 -> IF1 nat on IF2 from !IF2 -> IF2 pass in on IF3 route-to (IF2 GW2) from <overquota> with the default route going through IF1 to GW1. To add a client to the table, use pfctl -t overquota -Ta 192.168.2.3 Subsequent new connections will go out through the second provider. Existing prior connections will continue to to through the first provider, unless you explicitly remove the sessions, as in pfctl -k 192.168.2.3 Daniel
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130813124153.GA16266>