In recent Ubuntu, netplan is the default way of configuring network adapters. I want a static IP on one of mine, and there are some guides on how to do that. Some point you to editing 50-cloud-init.yaml. But that file has an ominous warning:

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}

One answer on askubuntu references this and has the user do just so. (Note it has the renderer set to networkd.)

Which approach is right? Do they both work?

Most confusing, what does "persist across an instance" mean? The settings persist just fine across a reboot. When would I expect to lose settings in 50-cloud-init.yaml?

  • Did you find the answer? The "persist across an instance" wording puzzles me as well.
    – s3v3n
    Mar 6, 2019 at 12:26
  • 1
    Unfortunately no. I've made my changes, got the behavior I want, and not had any problems. Mar 7, 2019 at 21:30

2 Answers 2


The "not across an instance" warning means that if you enter changes to the yaml file in an image that still has to perform it's first cloud-init run (on boot), the changes will be overwritten by cloud-init.

Cloud-init is used tot configre stuff on first boot. To that end it changes files on first (and optionally even subsequent) boots. The 50...yaml file is one of them.

Once cloud-init has run a first time on an image, it will not again run those changes.

The warning thus advices not to change the file on raw, unused system images for containers and virtual machines and the like.

By the way, a 'cloud-init clean' command would revert the cloud-init status to "never run before" and so would regeneratie the 50....yaml file also.

  • Great explanation; knowing this file is one of the "cloud init" files leads to googling "cloud init" and help.ubuntu.com/community/CloudInit, for those looking for more info about the process in general. Thanks so much! Jun 11, 2019 at 20:12

Changes to /etc/netplan/50-cloud-init.yaml are persistent across reboots but not if you backup an instance and restore it to a new one (even if your backup was done after a reboot).

I guess the solution described at Convert /etc/network/interfaces to netplan makes it persistent across instances but I figured out I'd have to update the MAC address on every instance anyway...

So I ended writing a small script that:

  • appends my config at the end of /etc/netplan/50-cloud-init.yaml
  • runs sudo netplan apply

I just run this script once after every instance creation and that's it...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .