atom feed18 messages in org.freebsd.freebsd-netRe: reading routing table
FromSent OnAttachments
Debarshi RaySep 1, 2008 5:06 am 
Bruce M. SimpsonSep 1, 2008 5:53 am 
Bruce M. SimpsonSep 1, 2008 6:01 am 
Debarshi RaySep 1, 2008 6:18 am 
Debarshi RaySep 1, 2008 6:23 am 
Bruce M. SimpsonSep 1, 2008 6:34 am 
Debarshi RaySep 1, 2008 8:15 am 
Julian ElischerSep 2, 2008 12:00 am 
Debarshi RaySep 2, 2008 12:17 am 
Robert WatsonSep 2, 2008 2:19 am 
Luigi RizzoSep 2, 2008 3:48 am 
Bruce M. SimpsonSep 2, 2008 7:55 am 
Robert WatsonSep 2, 2008 2:01 pm 
Luigi RizzoSep 2, 2008 2:28 pm 
Julian ElischerSep 2, 2008 3:10 pm 
Debarshi RaySep 18, 2008 1:01 am 
Bruce M. SimpsonSep 18, 2008 2:59 pm 
Julian ElischerSep 18, 2008 4:57 pm 
Subject:Re: reading routing table
From:Bruce M. Simpson (bm@FreeBSD.org)
Date:Sep 1, 2008 6:01:15 am
List:org.freebsd.freebsd-net

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