Configure a static IP on WatchNode
Set a static IP address on the WatchNode (Ubuntu) using Netplan.
⚠️ Pay close attention to indentation. Netplan uses YAML, which is whitespace-sensitive. Use spaces only (never tabs), and keep the nesting exactly as shown (2 spaces per level). Incorrect indentation is the most common cause of Netplan errors.
The example below assumes:
| Setting | Value |
|---|---|
| IP address | 10.10.10.10/24 |
| Gateway | 10.10.10.1 |
| DNS servers | 10.10.10.1, 8.8.8.8 |
| Interface | ens160 |
Adjust the values to match your environment.
1. Find your interface name
ip aNote the name of the active Ethernet interface (e.g., ens160), not lo (loopback).
2. Check the netplan file name and open it
ls /etc/netplan/
sudo nano /etc/netplan/50-cloud-init.yamlThe file name may differ (e.g., 00-installer-config.yaml). The default content looks like this:
network:
version: 2
ethernets:
ens160:
dhcp4: true3. Replace the contents
Change ens160 to your interface name and keep the indentation exactly as shown:
network:
version: 2
renderer: networkd
ethernets:
ens160:
dhcp4: no
addresses:
- 10.10.10.10/24
routes:
- to: default
via: 10.10.10.1
nameservers:
addresses:
- 10.10.10.1
- 8.8.8.84. Save the file
In nano: Ctrl+O, Enter, Ctrl+X.
If netplan warns that permissions are too open:
sudo chmod 600 /etc/netplan/50-cloud-init.yaml5. (Recommended) Prevent cloud-init from overwriting the config
echo "network: {config: disabled}" | sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg6. Test, then apply
sudo netplan try
sudo netplan apply
netplan tryreverts automatically if you don't confirm, which helps avoid lockouts when connected over SSH.
7. Verify
ip a show ens160
ip route
resolvectl status
ping -c 3 8.8.8.8Troubleshooting
- YAML errors / "mapping values are not allowed": Check indentation and make sure there are no tabs.
- Interface not found: Confirm the name with
ip a. - Config lost after reboot: Make sure step 5 was completed.