Network Interfaces: Configuration & Management
- Read an interface's state and addresses with the modern `ip` command
- Bring an interface up or down and add or remove an address at runtime
- Understand why `ip` changes vanish on reboot — the runtime-vs-persistent split
- Make an address configuration survive a reboot with NetworkManager (`nmcli`) on RHEL-family systems
- Persist the same configuration with a netplan YAML file on Ubuntu Server — the mechanism your lab box uses
- Recognise when interface bonding gives you redundancy across two NICs
Why interfaces need managing
Frame the one idea that runs through the whole lesson: runtime state versus persistent config.
A network interface is the doorway between your machine and a network — usually a physical NIC like
eth0, sometimes a virtual one. For traffic to flow, two things have to be true: the interface has to be up (turned on), and it has to have an IP address so other hosts can reach it.You will manage both with a single modern tool: `ip` (from the
iproute2package). It replaced the olderifconfigand is what every current certification expects.But there is a catch that trips up almost everyone, and it is the heart of this lesson. Changes you make with
ipare live but temporary — they take effect this instant and disappear at the next reboot. To make a configuration stick, you write it into a configuration manager — and which manager depends on the distro. On the RHEL family (and desktop Ubuntu) it is NetworkManager, driven bynmcli. On Ubuntu Server — including the lab box beside this lesson — it is netplan, a YAML file the system replays at boot. This lesson teaches both, because the mental model is identical; only the filing cabinet changes.An analogy makes the split concrete. Think of the running kernel's network config as a whiteboard in the office: anyone can write an address on it instantly, everyone in the room can read it, and it is wiped clean every night when the building's power cycles. NetworkManager's config files are the permanent record in the filing cabinet — slower to update, but it is what gets copied back onto the whiteboard every morning when the building reopens (a reboot).
ipwrites on the whiteboard.nmcli— or, on a netplan system, a YAML file plusnetplan apply— writes in the filing cabinet.Read state before you touch it
Inspect interface link state and addresses without changing anything.
The operations golden rule: look before you leap. The
ipcommand splits its world into objects. The two you need arelink(the interface itself — is it up?) andaddr(the addresses bound to it). The-br("brief") flag prints one tidy line per interface, which is the fastest way to get your bearings.ip -br linklo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> eth0 UP 52:54:00:a1:b2:c3 <BROADCAST,MULTICAST,UP,LOWER_UP> eth1 DOWN 52:54:00:a1:b2:c4 <BROADCAST,MULTICAST>
- -br
- Brief output: one line per interface instead of a multi-line block.
- link
- Operate on the link (layer-2 interface) object — state and MAC, not IP.
Read the second column. `eth0` is UP and `eth1` is DOWN. The flags in angle brackets confirm it: eth0showsUP,LOWER_UP(admin-up and carrier present), whileeth1lacks both. The third column is the hardware MAC address. No IP information appears here — for that you ask theaddrobject.ip -br addr showlo UNKNOWN 127.0.0.1/8 ::1/128 eth0 UP 192.0.2.10/24 fe80::5054:ff:fea1:b2c3/64 eth1 DOWN
- addr
- Operate on the address object — the IPs bound to each interface.
- show
- Display only (the default verb for addr); contrast with
add/delwhich change things.
Now you can see the addresses. eth0carries `192.0.2.10/24` (an IPv4 address and its /24 netmask) plus an auto-generated IPv6 link-local address.eth1shows nothing after its state because it has no address assigned.showis read-only — it never changes anything, which makes it safe to run as often as you like.Check yourself
Which object would you query to find out whether eth0 currently has an IP address bound to it —
ip linkorip addr?Change it at runtime with ip
Bring an interface up and add an address — and see that the change is live immediately.
Two verbs do the everyday work.
ip link set <dev> up|downflips the interface on or off, andip addr add <cidr> dev <dev>binds an address to it. Both take effect the moment you press Enter — no reboot, no service restart.sudo ip link set eth1 up- set
- Change a property of the link rather than just displaying it.
- up
- Administratively enable the interface (use
downto disable it).
Success is silent — no output means it worked, a convention that surprises beginners expecting a confirmation. Re-run ip -br linkandeth1will now readUP.sudo ip addr add 192.0.2.20/24 dev eth1- add
- Bind a new address to the interface (mirror:
delremoves one). - dev eth1
- The device the address attaches to — always required for add/del.
Again silent on success. The /24is part of the argument, not optional: it tells the kernel the subnet so it can route locally. Verify withip -br addr show eth1and you'll see192.0.2.20/24appear. To undo it, swapaddfordel:sudo ip addr del 192.0.2.20/24 dev eth1.Check yourself
You ran
ip addr add 192.0.2.20/24 dev eth1and it works perfectly. After a reboot the address is gone. Why?Make it persist with NetworkManager
Write the address into a connection profile so it survives a reboot — the part exams check.
To make config permanent you talk to NetworkManager through its command-line client, `nmcli`. NetworkManager's unit of config is a connection profile — a named bundle of settings (which device, which addresses, which gateway, DNS) stored on disk. At boot, NetworkManager reads these profiles and writes them onto the kernel's whiteboard for you.
The workflow is three verbs: `add` a profile, optionally `mod` (modify) it later, then `up` to activate it now.
Example — not runnable on your lab box
sudo nmcli con add type ethernet ifname eth1 con-name eth1-static ipv4.method manual ipv4.addresses 192.0.2.20/24Connection 'eth1-static' (8f2c1a90-3b4d-4e7a-9c11-aa20b3d4e5f6) successfully added.
- con add
- Create a new persistent connection profile (stored on disk).
- type ethernet
- The connection kind — a wired Ethernet profile.
- ifname eth1
- Bind the profile to the eth1 device.
- ipv4.method manual
- Use a static address (the alternative,
auto, means DHCP). - ipv4.addresses
- The static address and prefix to assign.
Unlike ip, this prints a confirmation with the new profile's UUID — because something durable was written to disk under/etc/NetworkManager/system-connections/. That file is the filing-cabinet entry: it is what NetworkManager replays at every boot.Example — not runnable on your lab box
sudo nmcli con mod eth1-static ipv4.gateway 192.0.2.1 ipv4.dns 192.0.2.53- con mod
- Modify an existing profile's settings without recreating it.
- ipv4.gateway
- Default gateway for traffic leaving this subnet.
- ipv4.dns
- DNS resolver address(es) for this connection.
Silent on success, like ip. Important:modupdates the saved profile but does not push the change onto the live interface yet — you must re-activate the profile for it to take effect. That is the next command.Example — not runnable on your lab box
sudo nmcli con up eth1-staticConnection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
- con up
- Activate the profile now — apply its settings to the live interface.
This is the step that copies the filing-cabinet entry onto the whiteboard immediately, so you don't have to reboot to see it. After this, the address is in both places: live now (via the activation) and persistent (in the saved profile). That is the complete, durable state — the network equivalent of systemctl enable --now.Check yourself
You set a new gateway with
nmcli con mod eth1-static ...but the running interface still uses the old one. Which command makes the change take effect on the live interface?Make it persist with netplan (Ubuntu Server — and this lab)
Persist address, gateway, and DNS in netplan YAML — the mechanism the netplan rooms grade.
Ubuntu Server keeps its filing cabinet somewhere else entirely: netplan. Instead of profiles you talk to through a CLI, the persistent intent is a small YAML file under
/etc/netplan/(on these lab boxes:/etc/netplan/01-netcfg.yaml). You don't run commands to build the config — you declare the end state in the file, then tell netplan to make reality match it.Start, as always, by reading what's there. A fresh box usually declares nothing but DHCP:
Runnable in the ne03 room — that room’s setup plants the files it reads
cat /etc/netplan/01-netcfg.yamlnetwork: version: 2 ethernets: eth0: dhcp4: trueFive lines is the entire persistent network config. Read it as a tree: a network:document (alwaysversion: 2), anethernets:section, one entry per interface, and per-interface settings.dhcp4: truemeans "ask a DHCP server for everything" — address, gateway, DNS all arrive from outside and nothing else needs declaring.To pin a static address, you flip DHCP off and declare the three things DHCP was providing — address, default route, DNS:
network:version: 2ethernets:eth0:dhcp4: falseaddresses: [192.0.2.20/24]routes:- to: defaultvia: 192.0.2.1nameservers:addresses: [192.0.2.53]/etc/netplan/01-netcfg.yaml — static address, gateway, and DNS Field by field:
- `dhcp4: false` — the master switch, exactly like
ipv4.method manualin nmcli. Leave ittrueand your static declarations are ignored in favour of DHCP: the same #1 static-IP mistake, in YAML clothing. - `addresses:` — a list, and each entry carries its CIDR prefix (
192.0.2.20/24, never a bare IP). - `routes:` with `- to: default` — the default gateway. (Older guides show
gateway4:; it still parses but is deprecated — theroutes:form is what current docs and these rooms expect, and it also handles static routes to specific subnets:- to: 10.20.0.0/16+via: ....) - `nameservers.addresses:` — the DNS resolvers, also a list.
Example — not runnable on your lab box
sudo netplan tryDo you want to keep these settings? Press ENTER before the timeout to accept the new configuration Changes will revert in 120 seconds
- try
- Apply the YAML now, but auto-revert in 120 s unless you confirm.
The safety net for the SSH-lockout warning from earlier: tryapplies your YAML provisionally. If the new config cut your connection, you can't press ENTER — so after 120 seconds netplan rolls back to the old config and your access returns. Confirm only when the network still works from where you're sitting.Example — not runnable on your lab box
sudo netplan apply- apply
- Render the YAML and apply it to the live system immediately — no revert.
The unconditional version — this is the moment the filing cabinet is copied onto the whiteboard, the netplan equivalent of nmcli con up. Silent on success, likeip. Editing the YAML alone changes nothing live: the file is intent, andapply(or a reboot) is what enacts it. Graded netplan rooms read the YAML itself, so the persistent file is the truth that earns the points.Check yourself
You edited /etc/netplan/01-netcfg.yaml with a correct static address, but
ip addrstill shows the old DHCP address. What's missing?- `dhcp4: false` — the master switch, exactly like
Bonding two NICs for redundancy
Understand what a bond is and when redundancy across two interfaces is worth it.
Sometimes one network cable is a single point of failure you cannot accept — a database server whose uptime depends on staying reachable. Bonding (Linux's name; some vendors call the same idea teaming) joins two or more physical NICs into one logical interface, commonly
bond0. The server usesbond0for everything; underneath, the kernel spreads or fails over traffic across the member NICs.The analogy: a bond is a braided rope. You hang your traffic on the single rope (
bond0), but it is woven from several strands (eth0,eth1). Cut one strand — a dead switch port, an unplugged cable — and the rope still holds because the others carry the load. The application never notices.Example — not runnable on your lab box
sudo nmcli con add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup,miimon=100"Connection 'bond0' (1c9d77e2-0a55-4b88-9f3e-77c0de12ab34) successfully added.
- type bond
- Create a bond master profile (the logical bond0 interface).
- mode=active-backup
- One NIC active, one standby; standby takes over if the active link fails.
- miimon=100
- Check each member link's carrier every 100 ms to detect a failure fast.
This creates the master. On its own it carries no traffic — you still have to enslave physical NICs to it (each as a type ethernetprofile withmaster bond0). The point to take away: the bond is built and persisted through the same `nmcli` profile model you just learned, so once you understand connection profiles, bonding is one more profile type, not a new tool.Check yourself
In active-backup bonding, how many of the two member NICs carry traffic during normal operation?
Try it in your live terminal
Do it, don't just read it — these run safely on the real sandbox to your right.
You have a real root shell. The commands below are read-only or fully reversible, so they are safe to run as-is. They walk the same inspect-then-change loop a real configuration task follows.
ip -br linkBaseline: see every interface and whether each is UP or DOWN. ip -br addr showSee which addresses are bound where. Note these are the live (whiteboard) values. ip route showThe routing table — find the default vialine to read this box's gateway.Example — not runnable on your lab box
cat /etc/netplan/*.yaml 2>/dev/null || echo 'no /etc/netplan here — netplan.io is not installed on this sandbox; on Ubuntu Server (and in the netplan labs) this is where interface config persists'The filing cabinet on this box — it persists with netplan, so this YAML is the saved intent the system replays at boot. Compare it against the live ipoutput above and you are looking at both sides of the runtime-vs-persistent split at once.
- `ip` changes the now; NetworkManager owns the forever. It is the same active-vs-enabled split systemctl taught, applied to interfaces.
ip link set <dev> up|downflips an interface;ip addr add/delbinds or removes an address — all runtime only, gone on reboot.- Persistence lives in a NetworkManager connection profile:
nmcli con addto create,con modto edit,con upto activate now. con modedits the saved profile but doesn't touch the live interface until youcon upit.- On Ubuntu Server — and this lab — the filing cabinet is netplan YAML (
/etc/netplan/*.yaml):dhcp4: false,addresses:with CIDR, aroutes: - to: defaultentry,nameservers:— thennetplan try(120 s auto-revert) ornetplan applyto enact it. - Never down the interface you are connected through over SSH — you cut the line you'd need to fix it.
- Bonding braids two NICs into one logical interface (
bond0) so a single link failure doesn't take the host offline; in active-backup mode only one NIC is live at a time.
| Command | Effect | Survives reboot? |
|---|---|---|
ip -br link / ip -br addr | Show interface state / addresses (read-only) | n/a |
ip link set eth1 up | Bring interface up now | No |
ip addr add 192.0.2.20/24 dev eth1 | Bind address now | No |
nmcli con add ... ipv4.addresses ... | Create a persistent profile | Yes (after con up) |
nmcli con mod <name> ... | Edit the saved profile only | Yes (live after con up) |
nmcli con up <name> | Apply the profile to the live interface now | Yes |
nmcli con add type bond ... | Create a persistent bond for redundancy | Yes |
cat /etc/netplan/*.yaml | Read the persistent intent on a netplan system | n/a |
edit netplan YAML → netplan apply | Persist address/route/DNS on Ubuntu Server | Yes |
netplan try | Apply with a 120-second auto-revert safety net | Yes, once confirmed |
