Skip to content

Linux Foundations / Follow traffic and find the fault ยท Step 24 of 46

Lesson: Network InterfacesSwitch
โ† Linux Foundations

Network operations

Network Interfaces

View and configure Linux network interfaces with the ip command.

A network interface is the point where your system connects to a network. It may be a physical card, a Wi-Fi radio or a virtual device made in software.

Interface names

Older systems used names such as eth0 and wlan0. Many current distributions use predictable names based on hardware location, such as enp3s0 (wired) or wlp2s0 (wireless). The lo interface is the loopback: it lets the machine talk to itself at 127.0.0.1.

Listing interfaces

The ip command, from the iproute2 package, is the current tool:

$ ip -br link show
lo       UNKNOWN  00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
enp3s0   UP       52:54:00:12:34:56 <BROADCAST,MULTICAST,UP,LOWER_UP>

-br means brief output. UP in the flags means the interface is enabled. LOWER_UP means the link below it is working, for example a cable is connected.

To see addresses, use:

$ ip -br addr show
lo       UNKNOWN  127.0.0.1/8 ::1/128
enp3s0   UP       192.168.1.25/24

The /24 is the prefix length. The subnetting guide explains it.

Changing settings

Changes need root. Replace enp3s0 with your interface name:

$ sudo ip link set dev enp3s0 down
$ sudo ip link set dev enp3s0 up
$ sudo ip addr add 192.168.1.60/24 dev enp3s0
$ sudo ip addr del 192.168.1.60/24 dev enp3s0

Taking down the interface you are logged in through will cut your SSH session.

Changes made with ip are temporary. They are lost at reboot. Permanent settings belong to the tool that manages your network: NetworkManager, systemd-networkd (often through Netplan on Ubuntu Server) or /etc/network/interfaces on some Debian installs.

Counters and ifconfig

$ ip -s link show dev enp3s0

-s adds statistics such as received and transmitted packets, errors and drops. Rising error counts can point to a bad cable or port.

You may still see ifconfig. It belongs to the older net-tools package, which many distributions no longer install by default. Learn ip first.

Try it

  1. Run ip -br link show and name each interface.
  2. Run ip -br addr show and find your IPv4 address and prefix.
  3. Run ip -s link show and check for errors or drops.

Check your understanding

Network Interfaces

All 5 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.