Ubuntu Server commonly uses Netplan to describe network configuration in YAML. Before changing a remote machine, keep console access available: a typo in an interface name, address, route, or indentation can disconnect the server.
Collect the current network details
- Identify the interface name with ip link or ip address.
- Record the current address, prefix length, gateway, and DNS servers.
- Check which renderer is in use, typically systemd-networkd on servers or NetworkManager on desktops.
- Confirm that the planned static address is outside the DHCP pool or reserved for this host.
Define the Netplan configuration
Edit a YAML file in /etc/netplan. Under network, set version 2, define the correct interface under ethernets, disable DHCP for the address family you are configuring, add the address with its CIDR prefix, define the default route, and list DNS servers. Use spaces only; YAML indentation is significant.
| Setting | Example value | Purpose |
|---|---|---|
| addresses | 192.168.10.25/24 | Static address and prefix |
| default route | 0.0.0.0/0 via 192.168.10.1 | Default IPv4 gateway |
| nameservers | 192.168.10.10, 1.1.1.1 | DNS resolvers |
| dhcp4 | false | Prevents IPv4 DHCP assignment |
Test safely before committing
Restrict the configuration file to root where appropriate, generate the backend configuration, and use netplan try for a remote system. The temporary test requires confirmation and can roll back automatically if connectivity is lost. After confirmation, apply the configuration and inspect the resulting address and routes.
Validate the result
- Confirm the expected address on the intended interface.
- Inspect the routing table and verify the default route.
- Test the local gateway before testing an external address.
- Test DNS resolution separately from raw IP connectivity.
- Reboot during a maintenance window to confirm persistence.
Common problems
- Wrong interface name after hardware or virtual NIC changes.
- Tabs or inconsistent indentation in YAML.
- Multiple Netplan files defining the same interface.
- A duplicate IP address already used by another device.
- An unreachable gateway or incorrect prefix length.
- Cloud-init regenerating network settings on cloud images.
Server naming and local resolution
A local hosts entry can map the server address to its fully qualified and short hostname, but it does not replace authoritative DNS. Keep forward and reverse DNS aligned for infrastructure that depends on consistent name resolution.
Use netplan try to avoid losing a remote server
ip -brief address ip route sudo netplan generate # With console access available, review: # sudo netplan try
Netplan try can roll back when confirmation is not received, but not all network problems are automatically recoverable. Verify interface names, indentation, prefixes and gateway before applying changes; keep an out-of-band console for remote production hosts.Related Melochip reading: https://melochip.com/posts/linux-filesystem-explained. This is an illustrative operational checklist, not a tested deployment.
Join the discussion
0 CommentsAsk questions, add context, or share what worked.
More from Melochip Editorial
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
8 min read · Updated Nov 16, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Updated Nov 16, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Updated Nov 16, 2026Related articles
Learn Linux from the ground up with simple explanations of the kernel, distributions, filesystem, commands, pe...
5 min read · Updated Nov 16, 2026
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
8 min read · Updated Nov 16, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Updated Nov 16, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Updated Nov 16, 2026Stay in the loop. Get new Melochip articles
Receive Melochip article updates when new articles are available. Explicit opt-in only.
No comments yet. Start the discussion.