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.

Network configuration

Linux

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 -a parameter.

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

Screenshot showing ip command, an alternative to ifconfig

Linux Network Interfaces with 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.

ifconfig -l

 

Lynis Enterprise

Lynis Enterprise screenshot to help with system hardening

This blog post is part of our Linux security series and the mission to get Linux and Unix-based systems more secure.

Does system hardening take a lot of time, or do you have any compliance in your company? Have a look at Lynis Enterprise.

Or start today with the open source security scanner Lynis (GitHub)


One comment

  • ZoidZoid

    Three more low-level ways:

    cat /proc/net/dev
    ls /sys/class/net
    find /sys/devices -name ‘mtu’

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *