Quick answer

What this guide helps you do

Configure a stable Ubuntu Server address with Netplan, verify interface, subnet, gateway and DNS values, and avoid locking yourself out of SSH.

Choose reservation or static configuration

A DHCP reservation on the router is often the simplest home-network option: the server remains a DHCP client but receives the same address. Use a Netplan static address when you control the subnet and need host-side configuration.

Record the working network

ip -brief address
ip route
resolvectl status
ls -l /etc/netplan
sudo netplan get

Record the real interface name, prefix length, default gateway and DNS servers. Confirm the proposed address is outside the DHCP pool or reserved so another device cannot receive it.

Keep a recovery path

For a remote server, use a local keyboard, hypervisor console or other out-of-band access. A wrong address, gateway, interface name or YAML indentation can end SSH immediately.

Back up and edit Netplan

Back up the existing YAML file rather than inventing a second conflicting definition. Example using systemd-networkd:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: false
      addresses:
        - 192.168.1.50/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 192.168.1.1
          - 1.1.1.1

Replace every value with your real network details. Preserve cloud-init or installer ownership of the file where applicable.

Validate and try safely

sudo netplan generate
sudo netplan try

Netplan try applies the change temporarily and expects confirmation. If connectivity is lost and the rollback works, the previous configuration returns. Keep the console available because not every unusual network arrangement can be recovered remotely.

Verify each layer

ip -brief address
ip route
resolvectl status
ping -c 3 192.168.1.1
ping -c 3 1.1.1
getent hosts ubuntu.com

Gateway success proves local routing. An external IP test separates routing from DNS. Name lookup tests DNS. Then reconnect using the new address.

Check after reboot

sudo reboot

After reconnecting, repeat the address, route and DNS checks. Update router reservations, SSH bookmarks, DNS records, monitoring and Compose bind addresses that referred to the old IP.

Verification checklist

  • Interface name and working route were recorded.
  • Address does not conflict with DHCP.
  • A local recovery console is available.
  • Netplan generates without errors.
  • Netplan try was confirmed successfully.
  • Gateway, internet route and DNS each work.
  • SSH reconnects on the intended address.
  • A reboot preserves the configuration.

The addresses shown are examples, not SmallGrid network settings or universal recommendations.

Next: How to Install Docker on Ubuntu Server. Return to the Ubuntu cornerstone: Mount a Drive Automatically with fstab.

Official references: Ubuntu Server network configuration and Netplan static addresses.