Migrate to RunxBuild and earn up to $50 in hosting credit on your first deposit.

Calculate your savings
unxBuild

Ubuntu IP Static: Configure a Static IP on Ubuntu with Netplan

Sean

Platform Writer

Jul 06, 2026
4 min read

Configure a static IP on Ubuntu with a Netplan YAML file in /etc/netplan/, with dhcp4: no and an addresses: block, then run sudo netplan apply. The right way for a remote box is netplan try, which reverts after 120 seconds if the new config breaks connectivity.

Ubuntu IP Static: Configure a Static IP on Ubuntu with Netplan

Table of contents

The right YAML

The right Netplan YAML:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: no
      addresses:
        - 192.168.1.100/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 1.1.1.1
          - 8.8.8.8

Applying the config

sudo netplan apply for a local box. sudo netplan try for a remote box.

Verifying

ip a show enp0s3, ip route, resolvectl status.

FAQ

What is the right interface name?

Run ip a to find the actual name. The right answer is to use the name that is state UP.

What if I lose connection after apply?

Wait 120 seconds if you used netplan try. If you used netplan apply, use the cloud console or IPMI to revert.

Can I have multiple IPs?

Yes, add them to the addresses: list.

What about cloud-init?

Disable with network: {config: disabled} in /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg.

If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.

Useful related references:

#ubuntu#guide#dev-infra#tutorial