2

On my mac, if i run netstat -rn i get the following output:

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            192.168.1.1        UGSc          342        0     en1
10.0.0.1           10.0.0.2           UH              8    88877    tun0
127                127.0.0.1          UCS             1        0     lo0
127.0.0.1          127.0.0.1          UH              5     2034     lo0
192.168.1          link#4             UCS            28        0     en1
192.168.1.1/32     link#4             UCS             2        0     en1
192.168.1.1        a0:63:91:9d:39:e1  UHLWIir       350     4353     en1   1182
192.168.1.2/32     link#4             UCS             2        0     en1
192.168.1.2        a8:8e:24:a3:b4:5f  UHLWIi          1      180     lo0
192.168.1.7        link#4             UHLWIi          1        0     en1
192.168.1.9        link#4             UHLWIi          1        0     en1
192.168.1.10       link#4             UHLWIi          1        0     en1
192.168.1.11       link#4             UHLWIi          1        0     en1
192.168.1.13       link#4             UHLWIi          1        0     en1
192.168.1.14       link#4             UHLWIi          1        0     en1
192.168.1.15       link#4             UHLWIi          1        0     en1
192.168.1.16       link#4             UHLWIi          1        0     en1
192.168.1.17       link#4             UHLWIi          1        0     en1
192.168.1.18       link#4             UHLWIi          1        0     en1
192.168.1.19       link#4             UHLWIi          1        0     en1
192.168.1.20       link#4             UHLWIi          1        0     en1
192.168.1.21       link#4             UHLWIi          1        0     en1
192.168.1.22       link#4             UHLWIi          1        0     en1
192.168.1.23       link#4             UHLWIi          1        0     en1
192.168.1.24       link#4             UHLWIi          1        0     en1
192.168.1.25       link#4             UHLWIi          1        0     en1
192.168.1.27       74:da:38:6c:7c:6   UHLWIi          5   480721     en1   1144
192.168.1.29       link#4             UHLWIi          1        0     en1
192.168.1.30       link#4             UHLWIi          1        0     en1
192.168.1.31       link#4             UHLWIi          1        0     en1
192.168.1.32       link#4             UHLWIi          1        0     en1
192.168.1.33       link#4             UHLWIi          1        0     en1
192.168.1.34       link#4             UHLWIi          1        0     en1
192.168.1.35       link#4             UHLWIi          1        0     en1
192.168.1.140      link#4             UHLWIi          1       14     en1
192.168.1.255      link#4             UHLWbI          1     1519     en1
224.0.0/4          link#4             UmCS            3        0     en1
224.0.0.251        1:0:5e:0:0:fb      UHmLWI          1        0     en1
239.255.255.250    1:0:5e:7f:ff:fa    UHmLWI          1    20802     en1
255.255.255.255/32 link#4             UCS             1        0     en1

What are the following items:

  • Flags (UGSc, UH, UCS, UHLWIir, UHLWIi)
  • Refs (what do the numbers represent)
  • Use (what do the numbers represent)
  • Expire (is this when that specific route expires?)

Answers so far:

1
  • 1
    Partial answer: Gateway refers to the Layer 2 (Ethernet/Wi-Fi) destination. If you send traffic out to the Internet, you typically send traffic to a "gateway", such as a "default gateway". However, for traffic within your subnet, you don't need to route traffic through your "default gateway". Instead, you obtain the MAC-48 address (using ARP/IPv4 or NDP/IPv6) and the frame goes directly to the machine with the specific address, with no routing being required. The reason no routing is required is because the address is part of link#4's subnet.
    – TOOGAM
    Feb 1 '17 at 6:52
3

1) The expression link#x, where x is some digit, is used to indicate that the corresponding address is a link-level address, .i.e, an address that operates only on the network the host is physically connected to.

In other words, these are directly-attached networks that don't need additional routing.

As for the link numbers (why they're #4 and #5 rather than #1 and #2 like you're probably expecting), check the output of ifconfig -a and you'll see that link #1 is usually the loopback interface (lo0). Links 2 and 3 are typically IPv6 interfaces (gif0 and stf0), leaving links 4 and 5 for the typical en0 (ethernet) and en1 (airport)

Here is other explanation.. : https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/netstat.1.html

1
  • How do I know which # corresponds to which interface. Is it just the first is #1 second #2.. in the order that they appear?? I guess I was expecting for the interfaces to have link# in the output of ifconfif -a.
    – MikeSchem
    Jul 6 '17 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.