Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2004 15:22:41 -0600
From:      "David G. Andersen" <danderse@cs.utah.edu>
To:        Stephen Gill <gillsr@yahoo.com>
Cc:        freebsd-security@freebsd.org
Subject:   Re: Policy routing with IPFW
Message-ID:  <20040415152241.A26751@cs.utah.edu>
In-Reply-To: <20040415203157.44002.qmail@web60708.mail.yahoo.com>; from gillsr@yahoo.com on Thu, Apr 15, 2004 at 01:31:57PM -0700
References:  <20040415203157.44002.qmail@web60708.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Stephen Gill just mooed:
> following:
> 
> - All traffic sourced from Interface 1 (dc0) should go out gateway 1 
> - All traffic sourced from Interface 2 (dc1) should go out gateway 2
> - All traffic destined to Interface 1 (dc0) should return out gateway 1
> - All traffic destined to Interface 2 (dc1) should return out gateway 2
> 
> Gateway 1 is on dc0 and Gateway 2 is on dc1.  I think you get the
> picture.  
> 
> Is this type of thing possible with IPFW?  If not, is there any other
> module that would allow me to do this?  I don't care how ugly it gets,
> just so long as it works.

  sure. 

  options IPFIREWALL
  options IPFIREWALL_FORWARD

As an example from a running system:

00100 allow ip from any to any via lo0
00500 allow ip from IP1 to IP1/IP1-netmask
00501 fwd IP1-GW ip from IP1 to any
00600 allow ip from IP2 to IP2/IP2-netmask
00601 fwd IP2-GW ip from IP2 to any

(where IP1-GW and IP2-GW are the next-hop routers for each
interface, obviously).

Works like a charm - I've got it running on quite a few machines.
The only downside to it sometimes is that you have to write some
script wrappers around things to get dynamic updates (e.g., 
ppp linkup scripts or dhcpd.conf running external scripts on route
changes).

  -Dave

-- 
work: dga@lcs.mit.edu                          me:  dga@pobox.com
      MIT Laboratory for Computer Science           http://www.angio.net/
      I do not accept unsolicited commercial email.  Do not spam me.



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