Managing Ubuntu Network State with Netplan: Moving Beyond /etc/network/interfaces
Learn how Ubuntu's Netplan abstracts network configuration for systemd‑networkd and NetworkManager, and how to safely apply static IP settings using 'netplan try'.
16 Dec 2025, 20:03 UTC

The Problem: Fragmented Network Configuration
For years, Linux administrators relied on /etc/network/interfaces to manage connectivity. While functional, this approach became cumbersome as environments shifted between headless cloud servers and desktop workstations. The challenge was the lack of a unified, declarative way to describe a network state that could be applied across different backend renderers without rewriting the entire configuration logic.
The takeaway is that Ubuntu uses Netplan as an abstraction layer. Instead of configuring the network daemon directly, you define the desired state in a YAML file, and Netplan translates that state for the underlying renderer—typically systemd-networkd for servers or NetworkManager for desktops.
How the Abstraction Layer Works
Netplan does not manage the network itself. It is a configuration generator. When you execute a Netplan command, it reads the YAML files in /etc/netplan/ and generates the specific configuration files required by the chosen renderer.
- systemd-networkd: A lightweight daemon designed for servers and containers. It is the default for Ubuntu Server.
- NetworkManager: A feature‑rich daemon that handles dynamic environments (like Wi‑Fi switching) and provides a GUI. It is the default for Ubuntu Desktop.
This decoupling means you can migrate a server configuration to a desktop environment (or vice versa) by changing a single line in the YAML file—the renderer: key—rather than learning a completely new syntax for the backend daemon.
Practical Implementation: Static IP and DNS
To configure a network interface, you must create or edit a YAML file in /etc/netplan/. Because YAML is whitespace‑sensitive, indentation must be exact; a single misplaced space will cause the configuration to fail.
Below is a configuration for a server using systemd-networkd to set a static IP address on interface enp0s3.
# File: /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
addresses:
- 192.168.1.50/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
Applying the Configuration Safely
Running netplan apply immediately pushes the configuration. If you have a typo in your IP address or gateway while connected via SSH, you will be locked out of the system. To prevent this, use the try command.
Command: sudo netplan try
Where to run: Local terminal or SSH session.
Permissions: Root/Sudo required.
Expected Result: The system applies the config and starts a timer (default 120 seconds). If you do not press ENTER to confirm the change, Netplan automatically rolls back to the previous working state.
Trade‑offs and Limitations
While Netplan simplifies the common case, it introduces a layer of indirection that can be frustrating in two specific scenarios:
- Abstraction Gaps: Some advanced features supported by
NetworkManager(such as complex VPN profiles or specific Wi‑Fi authentication methods) are not exposed through the Netplan YAML syntax. In these cases, you must bypass Netplan and usenmclior the GUI. - Debugging Complexity: When a network fails, you now have three places to look: the Netplan YAML, the generated backend config (found in
/run/systemd/network/for networkd), and the actual runtime state seen viaip addr.
Verification and Validation
To verify that your Netplan configuration was successfully translated and applied, use the following diagnostic steps:
- Check the Interface: Run
ip addr show enp0s3to confirm the IP address matches your YAML definition. - Check the Route: Run
ip routeto ensure the default gateway is correctly set. - Check DNS: Run
resolvectl statusto verify that the nameservers are being utilized by systemd-resolved.
If the ip addr command shows the correct IP but you cannot ping external hosts, double‑check the routes section of your YAML, as the gateway4 key is deprecated in newer Ubuntu versions in favor of the routes list.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.