Linux Networking·7 min read·

Static IPs on a VPS: Netplan vs NetworkManager

Configure a static IP address on an Ubuntu or CentOS VPS by choosing between Netplan and NetworkManager correctly.

NB

Netbay Developer Relations

Netbay Engineering

On this page

When you provision a new VPS, it typically comes with a DHCP-assigned IP address. That works fine for initial testing, but production servers need static addresses. A moving IP breaks DNS records, firewall rules, and every service that references a hardcoded address. Getting static IP configuration right on Linux means understanding which network management layer your distribution uses, because the wrong choice leads to conflicting configurations and mysterious reboots.

picking the right network management stack Netplan (YAML) Ubuntu default systemd-networkd server choice NetworkManager desktop choice pick ONE backend per interface running both causes race conditions

The Two Stacks: Netplan and NetworkManager

Modern Ubuntu server ships with Netplan as the default configuration frontend. Under the hood, Netplan generates configuration for either systemd-networkd or NetworkManager, but on servers it defaults to systemd-networkd. NetworkManager is the default on desktop Ubuntu, Fedora, CentOS Stream, and RHEL. On a headless VPS, you almost always want systemd-networkd or plain Netplan. Mixing the two on the same interface causes race conditions where both daemons fight to control the same link.

The first thing to check on a new server is which backend is active. On Ubuntu run systemctl status systemd-networkd and systemctl status NetworkManager. If both are running, decide which one owns your physical interfaces and disable the other for those interfaces.

Configuring a Static IP with Netplan

Netplan uses YAML files stored in /etc/netplan/. The filename must end with .yaml. Here is a complete static IP configuration.

yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 10.0.0.10/24
      routes:
        - to: default
          via: 10.0.0.1
      nameservers:
        addresses:
          - 1.1.1.1
          - 8.8.8.8
        search:
          - netbayhosts.in

After editing, apply with sudo netplan apply. The generate step happens automatically. If you made a syntax error, netplan will tell you exactly which YAML line is wrong. This is a significant advantage over editing raw networkd unit files.

The route syntax above uses the Netplan v2 routes format. The old gateway4 key still works on some versions but is deprecated. Always prefer the explicit routes block with to and via keys.

Configuring a Static IP with systemd-networkd

If you are not using Netplan or you want to configure systemd-networkd directly, create a .network file in /etc/systemd/network/.

ini
[Match]
Name=eth0

[Network]
Address=10.0.0.10/24
Gateway=10.0.0.1
DNS=1.1.1.1
DNS=8.8.8.8

Save this as /etc/systemd/network/10-static.network, then restart the networkd daemon with sudo systemctl restart systemd-networkd. The naming convention uses numeric prefixes to control ordering. Lower numbers load first.

The advantage of going directly to systemd-networkd without Netplan is that you remove one layer of abstraction. The disadvantage is that you lose Netplan validation and the ability to manage all network config from a single YAML file. For most servers Netplan is the better choice.

When to Use NetworkManager Instead

NetworkManager excels at environments where network conditions change frequently. A laptop switching between Wi-Fi networks, a development machine on DHCP, or a VPS that gets its network config from a cloud provider API all benefit from NetworkManager. It supports automatic connection profiles, VPN integration, and dynamic DNS updates out of the box.

On a static VPS however, NetworkManager adds unnecessary complexity. Its default behavior of trying to manage every interface can interfere with firewall rules, bridge configurations, and custom routing setups. If you must use NetworkManager on a server, disable its auto-management for specific interfaces by adding unmanaged-devices to the keyfile configuration.

Verification and Common Pitfalls

After applying your static config, verify it step by step.

bash
ip addr show eth0
ip route show default
ping -c 3 10.0.0.1
cat /etc/resolv.conf

The most common mistake is forgetting to configure DNS. Your static IP and gateway may be correct, but without nameservers you will have no DNS resolution. Netplan handles this with the nameservers block. With raw systemd-networkd, add DNS lines under the [Network] section.

Another pitfall is assuming the interface name. Many VPS providers use predictable naming like ens3, enp0s3, or eno1 instead of the traditional eth0. Run ip link to confirm the actual name before writing your config.

Quick Decision Guide

If your VPS runs Ubuntu 20.04 or later, use Netplan with the networkd renderer. If it runs CentOS Stream or Fedora, use NetworkManager with a manual connection profile. If you are on an older distribution without Netplan, edit the systemd-networkd files directly. The key principle is to use only one network management daemon per interface.

You can test both approaches on a fresh Ubuntu or CentOS instance from Netbay in under 60 seconds at netbayhosts.in.

Keep reading

Follow along on a real VPS

Deploy Linux in under 60 seconds

These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.

Deploy an instance