From owner-freebsd-questions@FreeBSD.ORG Wed Sep 10 19:01:05 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 866E0106566B for ; Wed, 10 Sep 2008 19:01:05 +0000 (UTC) (envelope-from ccowart@rescomp.berkeley.edu) Received: from hal.rescomp.berkeley.edu (hal.Rescomp.Berkeley.EDU [169.229.70.150]) by mx1.freebsd.org (Postfix) with ESMTP id 69DAA8FC12 for ; Wed, 10 Sep 2008 19:01:05 +0000 (UTC) (envelope-from ccowart@rescomp.berkeley.edu) Received: by hal.rescomp.berkeley.edu (Postfix, from userid 1225) id 069CC3C0508; Wed, 10 Sep 2008 12:00:48 -0700 (PDT) Date: Wed, 10 Sep 2008 12:00:48 -0700 From: Christopher Cowart To: The Noob Message-ID: <20080910190048.GA77705@hal.rescomp.berkeley.edu> Mail-Followup-To: The Noob , freebsd-questions@freebsd.org References: <9263743c0809101005w5e45edb9g990eeb26b47bbb6b@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <9263743c0809101005w5e45edb9g990eeb26b47bbb6b@mail.gmail.com> Organization: RSSP-IT, UC Berkeley User-Agent: Mutt/1.5.16 (2007-06-09) Cc: freebsd-questions@freebsd.org Subject: Re: Configure 2 gateways on a freebsd box for 2 interfaces X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2008 19:01:05 -0000 --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--