How to read ip addr output on Linux?


Welcome to the next pikoTutorial!

ip command was designed to replace older networking tools like ifconfig, route or netstat. To show all the network interfaces use command:

ip addr

Example output:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever

In the output you can find a bunch of useful information about each of the interfaces:

  1. 1: lo – interface index and name (lo stands for loopback)
  2. <LOOPBACK,UP,LOWER_UP> – statuses of the interface. For other interfaces, you may find here values like BROADCAST, MULTICAST etc.
  3. mtu 65536 – the maximum transmission unit size for the interface (in this case it’s 65536 bytes, but e.g. for Ethernet networks 1500 is a typical value)
  4. qdisc noqueue – the queuing discipline
  5. state UNKNOWN – state of the interface (here UNKNOWN, but for other interfaces may be UP or DOWN)
  6. group default – group name that this interface belongs to
  7. qlen 1000 – length of the transmit queue (in this case it’s 1000 packets)
  8. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 – MAC address and broadcast address
  9. inet 127.0.0.1/8 scope host lo – IPv4 address with netmask (127.0.0.1/8) scope (host)
  10. inet6 ::1/128 scope host – IPv6 address with netmask (::1/128) and scope (host)