From owner-freebsd-net@FreeBSD.ORG Sat Jul 25 15:31:32 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 D39B5106564A for ; Sat, 25 Jul 2009 15:31:32 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: from mail-qy0-f191.google.com (mail-qy0-f191.google.com [209.85.221.191]) by mx1.freebsd.org (Postfix) with ESMTP id 819278FC1A for ; Sat, 25 Jul 2009 15:31:32 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: by qyk29 with SMTP id 29so2875933qyk.3 for ; Sat, 25 Jul 2009 08:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to:cc :references:subject:date:mime-version:content-type :content-transfer-encoding:x-priority:x-msmail-priority:x-mailer :x-mimeole; bh=T75hxhisxyTO3lc2aPzbHD214rCryGVRq+qytYAZVLs=; b=BfOGCCnMhUG1r+YBFHWG7TEA+xRO61n9iTz9mgu+A2LIUDUGDchE4qIikPDsWeOWWR WuS0IAzNTG4Cj3IgBRgv9hu+9l50aNOjcI7vALLKZpWfnjwL0r0xCIrq1DltjZmz+sTL GURzIC2gXP4nnmLq/C9q5Ku27g1ERwFxOZmSE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:cc:references:subject:date:mime-version :content-type:content-transfer-encoding:x-priority:x-msmail-priority :x-mailer:x-mimeole; b=Ds6nJWWSOFckoEcBDG396OhG45pxXUX0ZcREWfcB4DpSmkYEny6fe6B/ZQC2Tn1w83 EB9ZKtc3AiFwBMXWM5I5UspM6p3UVq+a3q1sv24c8yGKjKWq7Mme5eJKM1Y2C9xdQUOx I2tl7fn1zYPCgsVCBA1NXggYrqZIVWxwaEwHk= Received: by 10.224.45.137 with SMTP id e9mr4411937qaf.216.1248534555854; Sat, 25 Jul 2009 08:09:15 -0700 (PDT) Received: from adnote989 (201-42-152-161.dsl.telesp.net.br [201.42.152.161]) by mx.google.com with ESMTPS id 2sm6934628qwi.43.2009.07.25.08.09.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 25 Jul 2009 08:09:14 -0700 (PDT) Message-ID: <8222942B09F94943A7B9314F1D7833E4@adnote989> From: "Luiz Otavio O Souza" To: , "Julian Elischer" References: <5a3c8f450907230757j21191a11n6cae4699ec8a76e1@mail.gmail.com><29ae62fc0907232114r2afb9dc8y966a22db6d3236bc@mail.gmail.com><4A693DE2.3050905@elischer.org> <1248433706.1678.13.camel@localhost><4A69B6D7.3080501@elischer.org> <1248442843.1678.36.camel@localhost> Date: Sat, 25 Jul 2009 12:09:08 -0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 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: Sat, 25 Jul 2009 15:31:33 -0000 > >> >> 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 be tested on the recv (in) side of things >> but by then the sending machine has aready decided on a local address >> too. > > Not nice. I have a dream, that fbsd now capable to do real multi-fib > routing :( > > What about ipfw fwd ? That was working years ago for me, but of course, > requires to put all custom routing entries into ipfw rules. > > What about binding of FIBs to local addresses or/and interfaces ? > Such way that kernel will decide what fib to use examining local IP > address of package ? > > -- > Vladimir B. Grebenschikov > vova@fbsd.ru The actual routing code doesn't receive any information about the source address (the route is found using exclusively the destination address), so right now the kernel cannot select the fib by looking at the source address (local address). There is an kernel option called RADIX_MPATH wich changes the routing code substancially (and looks like - from an untrained eye - it uses the local/source address to select the correct route). Unfornately my test hardware dies and i cannot look at this (right now) to tell you how this will work in the "real world", but if you can, you should try it. Luiz