Applies to: Ubuntu 24.04 LTS (netplan 1.1.2, systemd 255, NetworkManager 1.46) and Ubuntu 26.04 LTS (netplan 1.2, systemd 259); tested on both

On Ubuntu Server the network is configured by netplan and run by systemd-networkd. After you change a file in /etc/netplan/, the right way to “restart the network” is:

sudo netplan apply

It prints nothing when it works. The old sudo systemctl restart networking and sudo service networking restart don’t exist on current Ubuntu; both answer Failed to restart networking.service: Unit networking.service not found.

Which command for which situation

  • You edited a netplan YAML file: sudo netplan apply (or netplan try first, see below).
  • The interfaces look stuck and you changed nothing: sudo networkctl reconfigure eth0 for one interface, or sudo systemctl restart systemd-networkd for all of them.
  • You edited files in /etc/systemd/network/ by hand (not netplan): sudo networkctl reload.
  • Ubuntu Desktop (NetworkManager): sudo systemctl restart NetworkManager, or nmcli networking off followed by nmcli networking on. Note the unit name: network-manager.service answered Unit network-manager.service not found. in our test.
  • Only DNS is wrong: flush the resolver cache instead, see flush the DNS cache.

Replace eth0 with your interface name from ip -br addr.

Apply a change safely over SSH

A typo in a gateway or address can cut your SSH session. netplan try applies the change and rolls it back unless you confirm it:

  1. Edit the file, for example sudo nano /etc/netplan/50-cloud-init.yaml (the name differs per server; check with ls /etc/netplan/).
  2. Run sudo netplan try. The default timeout is 120 seconds; --timeout 30 shortens it.
  3. Open a new SSH session to check that you can still reach the server.
  4. If it works, go back and press Enter to keep the settings. If you lose the connection, just wait: when the timeout runs out, netplan restores the previous settings (our test printed Reverting.).

Important: in our test, the rollback only restored the running settings. The edited YAML file stayed as it was, so the broken change would come back with the next netplan apply or reboot. Fix or undo the edit straight away.

Check the result

ip -br addr
ip route
networkctl list
netplan get           # shows the merged netplan configuration

After our test change, ip -br addr show br0 showed the new address (10.99.0.2/24) straight after netplan apply, without a reboot.

Warnings you may see

  • Permissions for /etc/netplan/50-test.yaml are too open. Netplan configuration should NOT be accessible by others.: in our test the change was still applied, but fix it with sudo chmod 600 /etc/netplan/*.yaml, as these files can contain Wi-Fi or VPN secrets.
  • /etc/netplan/50-test.yaml:7:4: Invalid YAML: inconsistent indentation: nothing was changed; fix the line and column it names. Indent with spaces, not tabs.

Restart the whole server instead

If you are not sure the new settings will work, have console access ready before you reboot: VNC console in Virtualizor for a VPS, or IPMI for a dedicated server. Then use sudo reboot; the reboot and shutdown commands are explained in shutdown, poweroff, halt and reboot.

Related: set a static IP with Netplan, old networking commands and their replacements, and install Ubuntu Server.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket