3.1. Listing Your Network Interfaces
Problem
You want a list of your network interfaces.
Solution
To list all interfaces, whether up or down, whose drivers are loaded:
$ ifconfig -a
To list all interfaces that are up:
$ ifconfig
To list a single interface, commonly eth0:
$ ifconfig eth0
Discussion
If you are not root, ifconfig might not be in your path: try /sbin/ifconfig.
When invoked with the -a option, ifconfig lists all network interfaces that are up or down, but it will miss physical interfaces whose drivers are not loaded. For example, suppose you have a box with two Ethernet cards installed (eth0 and eth1) from different manufacturers, with different drivers, but only one (eth0) is configured in Linux (i.e., there is an /etc/sysconfig/network-scripts/ifcfg-* file for it). The other interface you don’t normally use. ifconfig -a will not show the second interface until you run ifconfig eth1 to load the driver.
See Also
ifconfig(8).
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access