The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,676 other followers

Mac OS X: getting default route and ip addresses

Posted by jpluimers on 2015/11/30

On Mac OS X, bare route and ifconfig give way too much information to view the most important things at once.

So I used an alias for this:

route -n get default | grep 'gateway' && echo && ifconfig | grep '\: flags\|inet\|inet6'

Later I needed IPv6 support, so I changed it to:

netstat -nr | grep 'Internet\|Gateway\|default' && echo && ifconfig | grep '\: flags\|inet\|inet6'

So you get something like this:

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            192.168.178.1      UGSc           23        0     en4
default            192.168.71.1       UGScI           7        0     en0
Internet6:
Destination                             Gateway                         Flags         Netif Expire
default                                 fe80::3631:c4ff:fe47:13f1%en0   UGc             en0

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet6 ::1 prefixlen 128 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet6 fe80::6203:8ff:fea2:4814%en0 prefixlen 64 scopeid 0x4 
    inet 192.168.71.40 netmask 0xffffff00 broadcast 192.168.71.255
    inet6 2001:982:2345:1:6203:8ff:fea2:4814 prefixlen 64 autoconf 
    inet6 2001:982:2345:1:4011:119a:e527:e021 prefixlen 64 autoconf temporary 
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet6 fe80::426c:8fff:fe44:95ea%en4 prefixlen 64 scopeid 0xb 
    inet6 fd00::426c:8fff:fe44:95ea prefixlen 64 detached autoconf 
    inet6 fd00::74a7:8f26:cd22:20b7 prefixlen 64 detached autoconf temporary 
    inet 192.168.178.22 netmask 0xffffff00 broadcast 192.168.178.255

–jeroen

via:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: