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.
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...
7 min read · Sep 19, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Sep 17, 2026Related articles
Learn Linux from the ground up with simple explanations of the kernel, distributions, filesystem, commands, pe...
4 min read · Updated Oct 1, 2026
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
7 min read · Sep 19, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Sep 17, 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.