Identify Network Interfaces on Linux
This article describes how to identify which network interfaces on a Linux® server are associated with which Internet Protocol (IP) addresses.
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 22.214.171.124 eth1 10.173.3.121
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
To get all the information about your network interfaces in one place, run the following command:
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:
©2020 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License