From owner-freebsd-net@FreeBSD.ORG Tue Apr 29 07:44:20 2008 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 1A3231065670 for ; Tue, 29 Apr 2008 07:44:20 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outC.internet-mail-service.net (outc.internet-mail-service.net [216.240.47.226]) by mx1.freebsd.org (Postfix) with ESMTP id F17E78FC20 for ; Tue, 29 Apr 2008 07:44:19 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Tue, 29 Apr 2008 06:00:00 -0700 Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id 3C7F52D600E for ; Tue, 29 Apr 2008 00:44:19 -0700 (PDT) Message-ID: <4816D1D2.7010603@elischer.org> Date: Tue, 29 Apr 2008 00:44:18 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.12 (Macintosh/20080213) MIME-Version: 1.0 To: FreeBSD Net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: multiple routing tables review patch ready for simple testing. 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: Tue, 29 Apr 2008 07:44:20 -0000 The patch can be found at http://www.freebsd.org/~julian/mrt.diff (or http://www.freebsd.org/~julian/mrt6.diff for RELENG_6) or source can be taken from perforce at: //depot/user/julian/routing/src a kernel needs to be created with the option ROUTETABLES=N e.g. +options ROUTETABLES=2 # max 16. 1 is back compatible. leaving this out will result in just a single routing table as per normal. the max is 16 but I have an artificial (even lower) at 8 but that may be gone by the time people try it :-) I ws informed early in this project that kernel routing tables should now be refered to as FIBs (forwarding Information base?). the new command "setfib" sets teh default fib for a process and all its decendents The ipfw command has been enhanced with fib and setfib commands netstat has been tweaked to cope with >1 table if used with setfib.. ipfw and setfib have man pages to look at. e.g. root@trafmon2:setfib -2 netstat -rn Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire 127.0.0.1 127.0.0.1 UH 0 0 lo0 172.28.0.0/24 link#3 UC 0 0 fxp0 172.28.0.1 00:c0:9f:41:cd:3c UHLW 1 0 fxp0 1189 172.28.10.0/24 link#2 UC 0 0 bge1 root@trafmon2:setfib -0 netstat -rn Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire default 172.28.0.1 UGS 0 20 fxp0 10.1.1.209 172.28.0.1 UGHS 0 0 fxp0 127.0.0.1 127.0.0.1 UH 0 20 lo0 172.28.0.0/24 link#3 UC 0 0 fxp0 172.28.0.1 00:c0:9f:41:cd:3c UHLW 3 0 fxp0 1188 172.28.10.0/24 link#2 UC 0 0 bge1 root@trafmon2: Currently it is IPV4 ONLY (other protocols will ignore the existance of other tables) there are two new sysctls. net.my_fibnum: 0 net.fibs: 3 Give it a test drive if you have any reason to want to do policy based routing or have multiple ISPs for different workloads etc. I'd like to get it out to a wider audience. all comments welcome. please read the file http://perforce.freebsd.org/fileViewer.cgi?FSPC=//depot/user/julian/routing/plan.txt&REV=5 for notes before using it. Julian