The 18.04 server installation process creates /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg
, which, in turn, seems to generate /etc/netplan/50-cloud-init.yaml
. I can't seem to find exactly how 50-cloud-init.yaml
gets generated from 50-curtin-networking.cfg
though.
What is the recommended way to manage IP addresses on an 18.04 server? Edit 50-curtin-networking.cfg
, and then run some command (?) to update 50-cloud-init.yaml
? Or some other process?
Make your networking changes to the /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg file as if you were putting them in the yaml file.
Then do the following:
This will process your 50-curtin-networking.cfg file, generate the 50-cloud-init.yaml file and apply the yaml file netplan configuration.
In this way, you can write your networking config in the 50-curtin-networking.cfg file as the comments imply you should do.
A lot of the confusion between setting networking up in the 50-cloud-init.yaml file vs the 01-netcfg.yaml found in the /etc/netplan directory comes down to the installer used for Ubuntu 18.04 LTS.
The live installer uses cloud-init, whereas the alternate installer does not.
So for networking your installer choice changes how you will set up networking.
ubuntu-18.04.1-server-amd64.iso -> 01-netcfg.yaml ubuntu-18.04.1-live-server-amd64.iso -> 50-curtin-networking.cfg
I assume this is an ordinary server, behind a router or switch that then connects to the internet. I'd rename the
50-cloud-init.yaml
file:Then find out the relevant interface name:
Assuming, for an example, that your relevant interface is
enp0s25
, edit the file:Amend the file to read:
Of course, substitute your exact details here. Spacing, indentation, etc. are crucial. Proofread carefully. Save (Ctrl+O followed by Enter) and close (Ctrl+X) the text editor.
Next:
Did you get the requested IP address?
Can you ping?
If you get ping returns, you are all set.
I ended up editing the /etc/systemd/resolved.conf file and removed the comment on the DNS= line and added my preferred DNS entries with a space separating entries I.E.: DNS = 8.8.8.8 8.8.4.4
For me in Ubuntu 19.04
cloud-init init
doesn't write 50-curtin-networking.cfg to 50-cloud-init.yaml unless you ask systemctl to restart the cloud-init-local service ...