Netplan vs. NetworkManager vs. Systemd-networkd vs. ip Command: Understanding Linux Networking

Configuring a Linux network can be confusing because several tools often appear to do the same job. You might find yourself editing a YAML file one minute to set a Static IP and using an ip addr command the next to verify it, only to realize your changes vanished after a reboot. This conflict usually happens because users confuse persistent configuration tools with runtime state tools.

Whether you are managing a local workstation or a remote cloud instance, knowing which tool handles the “source of truth” for your network is vital for system stability. This guide explains the differences between the Netplan abstraction layer, the NetworkManager and systemd-networkd backends, and the temporary ip command utilities. Mastering these differences will ensure your Linux network configuration remains robust and predictable.

Key Takeaways: Linux Networking Components

  • Netplan → The configuration abstractor used in Ubuntu. It uses YAML files to define network intent.
  • NetworkManager → A backend daemon typically used on Desktop systems to manage Wi-Fi and dynamic connections.
  • systemd-networkd → A backend daemon preferred for Servers and virtualized environments for lightweight persistence.
  • ip command → A runtime utility used to view current status or make temporary changes that do not survive a reboot.
  • YAML Syntax → Netplan is highly sensitive to indentation; errors in the file will prevent the network from starting.

Method 1: Netplan (The High-Level Configurator)

Netplan is the default tool in modern Ubuntu for defining persistent network settings. It does not manage the network itself; instead, it reads YAML configuration files and generates instructions for a chosen backend (renderer).

  • Config Location: Files are found in /etc/netplan/ (e.g., 01-netcfg.yaml).
  • How it works: You define your IP addresses, gateways, and nameservers in the file, then apply it.

Example Command to Apply Config: sudo netplan apply

Sample Output (Checking Status):

sudo netplan status -a
Online state: online
DNS Addresses: 127.0.0.53 (stub)
2: enp0s25 ethernet UP (networkd: enp0s25)
   Addresses: 10.102.66.200/24 (dynamic, dhcp)

Method 2: NetworkManager vs. systemd-networkd (The Renderers)

These are the background daemons that actually “render” or execute the network instructions provided by Netplan.

  • NetworkManager: Best for environments with frequent changes, like laptops switching between Wi-Fi networks. It is often managed via the ultimate nmcli cheat sheet.
  • systemd-networkd: A simpler, faster backend used for servers where the network configuration is static and rarely changes.

You choose between them in the Netplan file by setting the renderer: key to either NetworkManager or networkd.

Method 3: The ip Command (The Runtime State Tool)

The ip command (from the iproute2 suite) is the successor to ifconfig. It allows you to see the current runtime state of the kernel’s networking stack.

  • Usage: Use this to how to check IP address in Ubuntu quickly or to add a temporary IP for testing.
  • Warning: Any change made with ip addr add is temporary and will be lost when the machine reboots.

Example Command to View Interfaces: ip addr


Step-by-Step Process: Configuring a Permanent Static IP

If you need to move from a dynamic address to a fixed one, follow these steps using the persistent configuration workflow:

See also: Mastering the Linux Command Line — Your Complete Free Training Guide

  1. Launch your terminal and identify your interface name using ip addr (e.g., eth0).
  2. Navigate to the Netplan directory: cd /etc/netplan/.
  3. Edit the configuration file using the sudo command.
  4. Define your settings in YAML format, ensuring you include addresses, routes, and nameservers.
  5. Test the syntax: Run sudo netplan generate to check for formatting errors.
  6. Apply the changes: Run sudo netplan apply.
  7. Verify the results: Use ip addr show to confirm the new Static IP is active.

Summary Tables

ComponentCategoryMain PurposePersistence
NetplanAbstractorDefining network intent via YAML files.Yes
NetworkManagerBackendManaging dynamic/Desktop connections.Yes
networkdBackendManaging static/Server connections.Yes
ip commandRuntime ToolViewing state or temporary changes.No
Netplan KeywordMeaningExample
rendererThe daemon that executes the config.networkd or NetworkManager
dhcp4Automatic IP assignment toggle.true or false
addressesList of IPs with CIDR mask.10.10.10.2/24
viaThe IP of the default gateway.10.10.10.1

FAQs

Why did my system lose its IP after a reboot? You likely used the ip command to set the address. To make changes permanent, you must use Netplan to save the configuration to disk.

Can I use NetworkManager and Netplan at the same time? Yes. Netplan acts as the “manager” that tells NetworkManager what to do. You define the settings in YAML, and Netplan instructs NetworkManager to apply them.

What happens if I have a typo in my YAML file? Netplan is extremely sensitive to indentation. If the structure is wrong, running sudo netplan apply will fail with a syntax error.


Related Posts

David Cao
David Cao

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

Articles: 628

Leave a Reply

Your email address will not be published. Required fields are marked *