List Network Interfaces on Linux Systems (and others)
Show Network Interfaces
The network configuration is a common place to start during system configuration, security audits, and troubleshooting. No surprise that Lynis helps with collecting information about network interfaces, like MAC and IP addresses. We will have a look on how to gather this information yourself, like listing all available interfaces. Although we focus a lot here at Linux, we will include tips for other platforms, like macOS.
Previously the most obvious command to obtain the available network interfaces, was using the ifconfig command. As some systems no longer have that command installed by default, we will also look at using alternative ip. So if you have ifconfig available, run it with the
ifconfig -a | grep Link
Depending on what particular information you need, you can use grep to get you the right lines. The ifconfig command on Linux actually has the most option available, so have a look at the man page for all details.
As described, newer Linux distributions now ship only the ip command. The easiest way to see what connections you have available, is showing the available links.
ip link show
AIX and Solaris
These two old style platforms have of course ifconfig still available. By using the
-a parameter, all interfaces will be displayed.
ifconfig -a | grep "flags="
To see only the interfaces which are active, add the -u (up) parameter.
DragonBSD, FreeBSD, NetBSD
On the systems running BSD, it is also the ifconfig tool that can be used.