sudo netplan try

Netplan Config Generator

Fill in the interface and addressing, and get valid Netplan YAML with correct indentation, plus netplan try, which rolls back automatically if you lose the connection.

Use netplan try on remote machines

A wrong address or gateway on a server you reach over SSH locks you out. sudo netplan try applies the new configuration and waits 120 seconds for you to press Enter; if you cannot, because the connection died, it reverts on its own. Only use netplan apply once try has worked. YAML is indentation-sensitive and tabs are not allowed, so copy the output as is. Use routes with to: default instead of gateway4, which is deprecated.

Generate Netplan network configuration

This Netplan generator writes configuration for Ubuntu Server and Desktop: DHCP for IPv4 and IPv6, or static addresses in CIDR form with a default route, nameservers, and search domains. It can build a Linux bridge, the usual way to put virtual machines directly on your LAN, or a tagged VLAN interface on top of a physical NIC, and it lets you choose the systemd-networkd renderer for servers or NetworkManager for desktops. It prints the file path, the permissions Netplan expects, and the try, apply, and verify commands.

Netplan FAQ

Which file should I edit?

Netplan reads every .yaml file in /etc/netplan in name order, and later files override earlier ones. Cloud images often ship 50-cloud-init.yaml, which cloud-init may regenerate; either disable cloud-init networking or put your settings in a later file such as 60-static.yaml.

How do I find my interface name?

Run ip -brief link. Names like enp1s0 or ens3 are predictable names based on the hardware location; eth0 appears mostly in containers and some cloud images.

Why does netplan warn about permissions?

Netplan files can contain Wi-Fi passwords, so Netplan warns when they are readable by other users. Set them to 600 with sudo chmod 600 /etc/netplan/*.yaml.

networkd or NetworkManager?

Ubuntu Server uses systemd-networkd, which suits fixed configurations. Ubuntu Desktop uses NetworkManager so the desktop applet and Wi-Fi roaming work. Match what the machine already uses unless you have a reason to change.