Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Sep 2008 12:00:48 -0700
From:      Christopher Cowart <ccowart@rescomp.berkeley.edu>
To:        The Noob <thenoob06@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Configure 2 gateways on a freebsd box for 2 interfaces
Message-ID:  <20080910190048.GA77705@hal.rescomp.berkeley.edu>
In-Reply-To: <9263743c0809101005w5e45edb9g990eeb26b47bbb6b@mail.gmail.com>
References:  <9263743c0809101005w5e45edb9g990eeb26b47bbb6b@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

The Noob wrote:
> I have a small question.
> I have two interface in two vlans.
> The first interface 192.168.0.1 255.255.255.0
> The second interface: 10.228.44.1 255.255.255.0
> The gateway for the first interface must be 192.168.0.254 and the second
> interface must be 10.228.44.254
> How can I configure them? In rc.conf we have just defaultrouter but we ca=
n't
> specify the interface.

I'm guessing you want the gateway to be chosen based on the source
address, correct? The kernel does not support routing based on the
source address.

I use ipfw and fwd rules to achieve this:

ipfw add fwd 10.228.44.254 ip from 10.22.44.1 to not 10.22.44.0/24

Then you can leave the default_gateway as 192.168.0.254.

You might need IPFIREWALL_FORWARD in your kernel config. See ipfw(8).

--=20
Chris Cowart
Network Technical Lead
Network & Infrastructure Services, RSSP-IT
UC Berkeley

--FCuugMFkClbJLl1L
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iQIcBAEBAwAGBQJIyBlgAAoJEIGh6j3cHUNPLXAP/ik44rIob6eWseuYn/e1APEx
qgNMYvhPLPuMJxlZHjgjQ90zZoNtePk9AWtfugKctt+UTYq/57WwXTx4EbnrsS/k
HtmWUNQ7xq17qan7VwjdM+8sUcQWzfAXhpkf++iszanFBKmv5A9RwEKS/eUczve9
oJW3y2p+x9vmBCkx4N7oTwoI5qwbnTplJkumJGIzpMHd7Mktpz7RZbEV+Ir+R81M
SERBHmL8lGPbJOYbTP38eK7rIoy0XIq6UGOS/G0JHQw/+nOJQDVeNMa6mgx8UkBK
N2KFOPpGfvMz1NdjOmw+dWMsBOlgMrPMlgzNBDOh0Zypij9O5PCwsWkZiXu5KRyr
viWQYAZWTU6QnTms2Zp1Jw2l2EvRQK2UmgG13wUImHpZoFkbLwKK1omYYG2KxYqB
SbxHpYq48/gU9y3yXphrCxbfPD8CFRLyA7LI4fn8rd+3/xQ5mhVokIAh+UwwlmdG
CCbDJ7VRMrWXVYcBAYdNZ4gReKvv/TEnBlXMxXRtvxjPk6gqAuE3dC7PJ1EULzai
AvvWMFZy+el04U6xvA3UsBzakcdryrePEGhbweo2uF8QnEHwhEp0YgkJS/Cji3Vu
VvcTheqs0bmyJKj+x/YR4q3bOIYeFBmETFSAAxJ2oUKp889m1pdUOD5B4rCtCa7M
dHBOSEKV5pU+MLghPCx3
=jInb
-----END PGP SIGNATURE-----

--FCuugMFkClbJLl1L--



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