From owner-freebsd-net@FreeBSD.ORG Mon Sep 1 13:01:40 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 DAA4A1065677 for ; Mon, 1 Sep 2008 13:01:40 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id B48148FC1F for ; Mon, 1 Sep 2008 13:01:40 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 3F20615BA71; Mon, 1 Sep 2008 09:01:40 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Mon, 01 Sep 2008 09:01:40 -0400 X-Sasl-enc: fAlZZrmhh0opQmQKeOpGX2vxxg1/sXX0G0WP+39ys2Ve 1220274099 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 918A47572; Mon, 1 Sep 2008 09:01:39 -0400 (EDT) Message-ID: <48BBE7B2.4050409@FreeBSD.org> Date: Mon, 01 Sep 2008 14:01:38 +0100 From: "Bruce M. Simpson" User-Agent: Thunderbird 2.0.0.14 (X11/20080514) MIME-Version: 1.0 To: debarshi.ray@gmail.com References: <3170f42f0809010507q6c37a9d5q19649bc261d7656d@mail.gmail.com> In-Reply-To: <3170f42f0809010507q6c37a9d5q19649bc261d7656d@mail.gmail.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD networking and TCP/IP list Subject: Re: reading routing table 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: Mon, 01 Sep 2008 13:01:40 -0000 Debarshi Ray wrote: > ... > I was going through the FreeBSD and NetBSD documentation and the > FreeBSD sources of netstat and route. I was suprised to see that while > NetBSD's route implementation has a 'show' command, FreeBSD does not > offer any such thing. Moreover it seems that one can not read the > entire routing table using the PF_ROUTE sockets and RTM_GET returns > information pertaining to only one destination. This suprised me > because one can do such a thing with the Linux kernel's RTNETLINK. > > Is there a reason why this is so? Or is reading from /dev/kmem the > only way to get a dump of the routing tables? > You want 'netstat -rn' to dump them, this is a very common command which should be present in a number of online resources on using and administering FreeBSD so I am somewhat surprised that you didn't find it. P.S. Look in the sysctl tree if you need to snapshot the kernel IP forwarding tables. You can use kmem, but it is generally frowned upon unless you're working from core dumps -- kernels can be built without kmem support, or kmem locked down, etc. cheers BMS