Interfaces, addresses and the ip command

Beginner · 5 min

Read a Linux machine's network identity with ip link and ip addr, decode names like enp5s0, and see why ifconfig was replaced.

Before thisudev and device filesKernel modules and drivers

Learn Linux TV · 7 min · from 2:38

Interfaces, addresses and the ip command

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Learn Linux TVReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • An interface is the kernel's handle on one network device, real or virtual. `ip link` shows interfaces and their state. `ip addr` shows the addresses attached to them.
  • `UP` in the flags means an administrator enabled the interface. `LOWER_UP` means the driver reports a working link underneath. You need both for traffic.
  • Every machine has `lo`, the loopback interface, with `127.0.0.1/8` and `::1`. Traffic to those never leaves the host.
  • Names like `eno1`, `enp5s0` and `wlp3s0` come from udev's predictable naming scheme. They encode where the device sits in the hardware, so they stay the same across reboots, unlike `eth0` assigned in probe order.
  • `ip addr add` and `ip link set` change the running kernel only. They are gone after a reboot unless a network manager writes them down.
  • `ifconfig` belongs to the old net-tools package and cannot show everything the kernel now does, such as extra addresses added without a label. Use `ip`.

Where a machine meets the network

A server with no network is a very expensive space heater. Everything it serves arrives through a network device, and before you can debug a single connection you need to answer two plain questions: which devices does this machine have, and what addresses do they carry?

The kernel’s answer is the interface. An interface is the kernel’s handle on something that can send and receive packets. Sometimes that is a physical network card. Often it is virtual: the loopback device, a bridge, a VLAN, a WireGuard tunnel or the veth pair a container uses. The kernel treats them all the same way. Each has a name, a link state and zero or more addresses.

The theory of layers and addresses lives in the OSI and TCP/IP models lesson. This lesson is about reading what Linux actually has.

The ip command from the iproute2 package splits the picture into objects. Two matter here:

ip link              # interfaces and their state (layer 2)
ip addr              # the same interfaces plus their addresses (layer 3)
ip -br addr          # one line per interface, easier to scan
ip addr show dev enp5s0

Commands written from the iproute2 man pages. I did not run them, since this machine is a Mac and has no ip.

Each ip link entry has flags in angle brackets and a state field. Two flags are the ones to read. UP means an administrator, or a network manager, enabled the interface. LOWER_UP means the driver reports that the layer underneath works, such as a cable with a link light. The kernel’s operstate documentation describes it in exactly these terms: one is “admin up”, the other is the driver signalling carrier. An interface that is UP without LOWER_UP is switched on with nothing at the other end. No ip command will fix that. Check the cable, the switch port or the hypervisor.

ip addr adds the inet (IPv4) and inet6 lines. Each address is written with its prefix length, as in 192.0.2.10/24, and a scope. The ip-address man page defines global as valid everywhere, link as valid only on this device (IPv6 fe80:: addresses are the usual case), and host as valid only inside this machine. IPv6 addresses learned automatically show dynamic with a valid_lft countdown. Static ones say forever.

Loopback

Every Linux machine has lo. It holds 127.0.0.1/8 and ::1, with scope host. Packets sent to those addresses never reach a driver. The kernel hands them straight back to itself. That is why a database configured to listen on 127.0.0.1 is reachable from the same machine and invisible from outside it, and why ping 127.0.0.1 succeeds on a machine with no cable plugged in. Think of loopback as an internal phone extension that cannot dial out.

Why the names look strange

Older systems called Ethernet devices eth0, eth1 and so on, in the order the kernel happened to find them. On a machine with two cards that order can change between boots, so the firewall rule written for eth0 suddenly applies to the other network.

Modern distributions let udev name interfaces by where the hardware sits, as covered in udev and device files. The systemd naming-scheme page (systemd 262, checked 2026-11-28) defines a two-letter type prefix, en for Ethernet, wl for wireless, ww for mobile broadband and ib for InfiniBand, followed by a location:

Name Read it as
eno1 on-board device, firmware index 1
ens1 hot-plug slot 1
enp5s0 PCI bus 5, slot 0
enp2s0f1 PCI bus 2, slot 0, function 1, the second port of a two-port card
wlp3s0 wireless card on PCI bus 3, slot 0

The same page says the scheme can be pinned with the net.naming_scheme= kernel parameter, so an upgrade cannot rename your interfaces. A name looks odd once and then stays the same for the life of the hardware.

Changing things, temporarily

ip can also change state:

sudo ip link set enp5s0 down
sudo ip link set enp5s0 up
sudo ip addr add 192.0.2.50/24 dev enp5s0
sudo ip addr del 192.0.2.50/24 dev enp5s0

These talk to the kernel over netlink and take effect at once. They also write nothing to disk. After a reboot, the address is whatever the machine’s network manager says it should be. That is useful for a quick test and a trap for anyone who “fixed” a server by hand. The persistent network configuration lesson covers the files that survive a reboot.

Why ifconfig went away

ifconfig, route and netstat come from net-tools, a package built around older kernel interfaces. Linux kept growing features that the tool never learned, such as many addresses per interface, multiple routing tables and network namespaces. The classic example: add a second address with ip addr add and no label, and ifconfig shows only the first. Minimal server installs of the major distributions no longer ship net-tools. macOS still has ifconfig, but it is a different BSD program, which is part of why commands copied from a Mac tutorial fail on a server.

About the video

The embed is a seven-minute clip, 2:38 to 9:49, from Learn Linux TV’s “How to Use the ip Command in Linux: A Beginner’s Guide” (Jay LaCroix, November 2024). It covers basic ip usage, limiting output to one interface, bringing an interface up and down, and adding and removing an address. The clip skips the opening course advert but contains a short merch-shop segment at 7:23. It ends where the video’s routing chapter begins, which belongs to the next lesson. The video does not explain the naming scheme or the UP/LOWER_UP distinction, which is why this lesson spends time on both. English was judged from the channel and its English caption track. The facts here come from the iproute2 man pages, the kernel’s operstates document and the systemd naming-scheme page, all read on 2026-11-28.

Where this fits

An address says who the machine is. The next question is how a packet leaves it: routing and the default gateway.

Check yourself

  1. 01`ip link` shows an interface with `<BROADCAST,MULTICAST,UP>` but no `LOWER_UP`, and its state is `DOWN`. What is the likely cause?

    The interface is enabled in software but the driver sees no link, so the cable is unplugged, the switch port is down or the virtual NIC is disconnected. Bringing it up again will not help.

  2. 02What does the name `enp2s0f1` tell you about the device?

    It is Ethernet (`en`), named by PCI path: bus 2, slot 0, function 1. It is the second port of a multi-function card.

  3. 03You ran `ip addr add 10.0.0.5/24 dev eth1` on a server and it worked. After a reboot the address is gone. Why?

    The `ip` command changes the kernel's live state and stores nothing on disk. Persistent addresses come from NetworkManager, netplan or systemd-networkd configuration.

  4. 04Why does pinging `127.0.0.1` work on a machine with every cable unplugged?

    The loopback interface is virtual. The kernel delivers loopback traffic to itself without touching any hardware.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark