How to set afixed ip on ubuntu core?

Hi, I know how to set a ip on raspbian… hwo to set an ip on ubuntu core?

you can create a snap using the network-setup-control interface containing a script that applies a netplan.yaml and reboots the device (it will automatically use the netplan setup you provide after reboot)

i do something along these lines with a configuration snap for a demo image at

it watches for usb-sticks containing a netplan.yaml file and if it finds one, it imports this file and reboots the device to new IP config.

What I do is after I ssh in to the device after setting it up, you can modify the /etc/netplan/00-snapd-config.yaml

sudo vi /etc/netplan/00-snapd-config.yaml

Then under the eth0 in addresses section write out the CIDR address (eg.
and under that add gateway4: <gateway.ip> and then enter the nameservers. Finally, set dhcp4: false.
Now you can save the configuration. Now execute

sudo netplan apply

Your network configuration will take effect. You will be disconnected from your ssh session, so you will have to restart it with the new IP address you assigned and you’re good to go. This will also persist through reboots as well.
Here is my example I used for my netplan.yaml:

      addresses: []
        addresses: [,]
        search: [demo]
      dhcp4: false
  version: 2

@ogra’s Solution will work as well if you don’t have access to the device via ssh or if it does not have a local password set and you can’t change the netplan.yaml locally on the device.

  • Luke