Date: Mon, 01 Sep 2008 14:01:38 +0100 From: "Bruce M. Simpson" <bms@FreeBSD.org> To: debarshi.ray@gmail.com Cc: FreeBSD networking and TCP/IP list <freebsd-net@freebsd.org> Subject: Re: reading routing table Message-ID: <48BBE7B2.4050409@FreeBSD.org> In-Reply-To: <3170f42f0809010507q6c37a9d5q19649bc261d7656d@mail.gmail.com> References: <3170f42f0809010507q6c37a9d5q19649bc261d7656d@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48BBE7B2.4050409>