Network configuration: netplan, nmcli, static IP
Sign in to read this lesson
Changes made with the ip command are lost on reboot. Permanent configuration is done with netplan YAML files on Ubuntu Server, and with NetworkManager (nmcli) on Red Hat and desktop systems. In this lesson we learn to give a server a static IP, gateway and DNS, and how to avoid locking yourself out when working remotely — netplan try.
What you will learn
- Ubuntu Server: settings live in
/etc/netplan/*.yamland are applied withsudo netplan apply;systemd-networkdruns behind it. - Spaces matter in YAML: no tabs, only spaces; levels indented by 2 spaces.
- When changing remotely, use
sudo netplan try— if you do not confirm within 120 seconds, the old settings come back. - RHEL/Rocky and desktops:
nmcli con mod ens18 ipv4.addresses ... ipv4.method manual, thennmcli con up ens18. - Checks:
ip -br a,ip route,resolvectl status, ping the gateway and a name.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.