NetOPSGetting started

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:

SettingValue
IP address10.10.10.10/24
Gateway10.10.10.1
DNS servers10.10.10.1, 8.8.8.8
Interfaceens160

Adjust the values to match your environment.


1. Find your interface name

ip a

Note 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.yaml

The file name may differ (e.g., 00-installer-config.yaml). The default content looks like this:

network:
  version: 2
  ethernets:
    ens160:
      dhcp4: true

3. 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.8

4. 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.yaml
echo "network: {config: disabled}" | sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

6. Test, then apply

sudo netplan try
sudo netplan apply

netplan try reverts 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.8

Troubleshooting

  • 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.

On this page