1

I have just installed Ubuntu 20.04 64-bit server on raspberry pi. I want to provide a static ip to it.

I'm thinking of adding a configuration file under /etc/netplan/ (following these examples), but inside /etc/netplan/ I see a file: 50-cloud-init.yaml with the following comment

This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. 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}

I have two questions:

  • Am I supposed to create this: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg before creating the static address yaml file under /etc/netplan/ ?
  • Should I prefer the /run/netplan/ directory for adding my static address configration?

2 Answers2

1

I think you just create the file /etc/netplan/01-netcfg.yaml with the correct configuration for your server.

This should get read before the 50-cloud-init.yaml since according to this https://linuxconfig.org/netplan-network-configuration-tutorial-for-beginners

Inside each of these directories configurations are created using files with the .yaml extension which are processed in lexicographical order, regardless of the directory they are in.

You may need to disable cloud init How to get rid of cloud-init?

Some details here 01-netcfg.yaml and 50-cloud-init.yaml both exist - can't find one IP

0

@Jannis I ran into that situation as well (2 IPs for eth0, one DHCP and the other static).

Apparently netplan is executing each yaml file in /etc/netplan and dutifully assigning an IP to the interface as instructed in each file.

I didn't add or touch any other yaml files in /etc/netplan and did my static IP mods to 50-cloud-init.yaml.

Rebooted and now I only see my static IP assignment.