=^.^=

Show Routing Table on FreeBSD

karma

On linux old fogeys comme moi use route [-n] to dump the routing table:
route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface a.b.c.80 0.0.0.0 255.255.255.248 U 0 0 0 eth0 d.e.f.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 h.i.j.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2 k.l.m.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3 0.0.0.0 a.b.c.81 0.0.0.0 UG 0 0 0 eth0
Generation Z uses ip route:
ip route a.b.c.80/29 dev eth0 proto kernel scope link src a.b.c.86 d.e.f.0/24 dev eth1 proto kernel scope link src d.e.f.1 h.i.j.0/24 dev eth2 proto kernel scope link src h.i.j.1 k.l.m.0/24 dev eth3 proto kernel scope link src k.l.m.1
FreeBSD on the other hand has no ip command and the route command is terse, allowing us to get|show single, defined routes at a time. The closest approximation is yielded by netstat -r [-n]:
netstat -r Routing tables Internet: Destination Gateway Flags Netif Expire default aa.bb.cc.dd.1 UGS xn0 localhost link#2 UH lo0 192.168.xx.0/24 link#6 U xn1 localhost link#6 UHS lo0 192.168.yy.1 link#7 UH lo0 192.168.zz.0/24 link#5 U xn0 Internet6: Destination Gateway Flags Netif Expire localhost link#2 UHS lo0 fe80::%lo0/64 link#2 U lo0 fe80::1%lo0 link#2 UHS lo0
Which, incidentally, works on linux's version of netstat too:
netstat -r -n Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface aa.bb.cc.80 0.0.0.0 255.255.255.248 U 0 0 0 eth0 d.e.f.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 h.i.j.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2 k.l.m.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3 0.0.0.0 aa.bb.cc.81 0.0.0.0 UG 0 0 0 eth0

Comments

There are no comments for this item.