How can I display the routing table with netmasks

I would like to see the current routing table of my MBP. The command "netstat -rn" doesn't display the associated netmasks for the IPv4 entries (but does for IPv6). Example (output shortened):


root# netstat -rn

Routing tables

Internet:

Destination Gateway Flags Refs Use Netif Expire

127 127.0.0.1 UCS 0 0 lo0

192.168.1 link#9 UCS 5 0 en3


Instead of "127" and "192.168.1", I would expect "127.0.0.0/8" and "192.168.1.0/24".


Any idea?


Thanks,

Marc

MacBook Pro (Retina, Mid 2012), OS X Mountain Lion (10.8.5)

Posted on Oct 11, 2013 2:05 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 13, 2013 11:54 AM

This is not exactly true, as 192.168.1 (meaning 192.168.1.0) could mean any network number from /24 to /32. But playing arount with the routing table has showed: if the netmask equals the natural class, no netmask is shown. If it differs, the netmask is shown:


192.168.1 link#4 UCSI 3 0 en0

192.168.2/25 192.168.1.1 UGSc 0 0 en3

192.168.2.128/28 192.168.1.1 UGSc 0 0 en3


Thanks anyway.


Cheers,

Marc

2 replies
Question marked as Top-ranking reply

Oct 13, 2013 11:54 AM in response to Linc Davis

This is not exactly true, as 192.168.1 (meaning 192.168.1.0) could mean any network number from /24 to /32. But playing arount with the routing table has showed: if the netmask equals the natural class, no netmask is shown. If it differs, the netmask is shown:


192.168.1 link#4 UCSI 3 0 en0

192.168.2/25 192.168.1.1 UGSc 0 0 en3

192.168.2.128/28 192.168.1.1 UGSc 0 0 en3


Thanks anyway.


Cheers,

Marc

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I display the routing table with netmasks

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.