From owner-freebsd-net@FreeBSD.ORG Fri Jul 24 13:27:50 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 547B6106564A for ; Fri, 24 Jul 2009 13:27:50 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outE.internet-mail-service.net (oute.internet-mail-service.net [216.240.47.228]) by mx1.freebsd.org (Postfix) with ESMTP id 382AE8FC13 for ; Fri, 24 Jul 2009 13:27:50 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id BC201D4E0; Fri, 24 Jul 2009 06:27:49 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 324C32D6018; Fri, 24 Jul 2009 06:27:49 -0700 (PDT) Message-ID: <4A69B6D7.3080501@elischer.org> Date: Fri, 24 Jul 2009 06:27:51 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: vova@fbsd.ru References: <5a3c8f450907230757j21191a11n6cae4699ec8a76e1@mail.gmail.com> <29ae62fc0907232114r2afb9dc8y966a22db6d3236bc@mail.gmail.com> <4A693DE2.3050905@elischer.org> <1248433706.1678.13.camel@localhost> In-Reply-To: <1248433706.1678.13.camel@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org, Jamie Ostrowski , "Lucian@lastdot.org" Subject: Re: How to change default source address? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jul 2009 13:27:50 -0000 Vladimir Grebenschikov wrote: > Hi > > >> you could set up 2 routing tables and assign different apps to use >> different tables > > Is it possible to select routing table by ipfw setfib X ? > > someting like: > > ipfw add setfib 1 ip from a.b.c.d to any out xmit em0 > setfib 1 route add default 10.10.10.1 no that wouldn't work for 2 reasons. 1/ for local sockets, the routing decision is made already before it gets to the firewall 2/ for non-ocal packets (from another machine that you are routing) the packet needs to b etested on the recv (in) side of things but by then the sending machine has aready decided on a local address too. The only way to do this would be to do: setfib -1 my_aplication so that the sockets were created looking at fib 1 or: setfib -1 /bin/sh so that all children used fib 1 > > > PS: > you may need to compile kernel with > options ROUTETABLES=2 > > PPS: > why there is not sysctl way to specify number of routing tables ? >