Identify Network Interfaces on Linux

  • Last updated on: 2019-03-12
  • Authored by: Jered Heeschen

This article describes how to identify which network interfaces on a Linux® server are associated with which Internet Protocol (IP) addresses.

IPv4

You can get a list of the network interfaces and IPv4 addresses on your server by running the following command:

/sbin/ip -4 -o a | cut -d ' ' -f 2,7 | cut -d '/' -f 1

The output lists the interface names on the left and the associated IP addresses on the right.

lo 127.0.0.1
eth0 68.207.142.192
eth1 10.173.3.121

IPv6

For IPv6, you can run a similar command but use “-6” in place of “-4”:

/sbin/ip -6 -o a | cut -d ' ' -f 2,7 | cut -d '/' -f 1

Here, too, the interface names are on the left, and the IP addresses are on the right.

lo ::1/128
eth0 2001:4801:7817:72:bc18:4779:ff10:1653
eth0 fe80::be76:4eff:fe10:1633
eth1 fe80::be76:4eff:fe10:12ab

Full output

To get all the information about your network interfaces in one place, run the following command:

/sbin/ip a

The detailed output lists each interface, any associated IP addresses, their network prefix length, their scope, and many other details. For more information, check the man page for the ip command by using the following command:

man ip

Share this information: