Lesson 5.23: A static address with netplan
Servers that others connect to, and that firewall rules name by address, need an address that doesn't change. On Ubuntu the network is described in YAML files under /etc/netplan, which netplan turns into configuration for systemd-networkd. Files are merged in name order, cloud images ship their own file generated by cloud-init, and a mistake applied over SSH can cut you off, so the safe workflow matters as much as the syntax. In the lab web02 lost its usual address after a DHCP change and the database refuses it; you give it a fixed address, DNS server and search domain, the right way.
16 min
You will learn to
- Explain why servers need fixed addresses
- Read netplan YAML and its merge order
- Check the merged configuration with netplan get
- Protect netplan files and stop cloud-init from overwriting them
- Apply safely and verify the address and DNS
Key terms
- netplan
- Ubuntu's network configuration: YAML in /etc/netplan, rendered for systemd-networkd or NetworkManager.
- Static address
- An address set in configuration instead of leased from DHCP.
- Default route
- Where packets go when no more specific route matches: the gateway.
- Search domain
- A suffix tried for short names: db01 becomes db01.northwind.example.
- netplan try
- Applies a configuration and reverts it automatically unless you confirm.
← Compressing and archiving files · All lessons · The SSH client and the bastion →