LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   cloud-init network configuration? (https://www.linuxquestions.org/questions/linux-networking-3/cloud-init-network-configuration-4175653968/)

czezz 05-15-2019 02:15 PM

cloud-init network configuration?
 
Hi everyone,
I am trying to sort out how cloud-init configures network interfaces.

In freshly installed Ubuntu on raspberry this is what I see:
Code:

root@ubuntu:/etc# cat /etc/netplan/50-cloud-init.yaml
# 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}
network:
    version: 2
    ethernets:
        eth0:
            dhcp4: true
            match:
                macaddress: bf:ff:ff:ff:ff:ff
            set-name: eth0

Now, where or what tells system to setup my network as DHCP?
I see no entry about that in: /etc/cloud/cloud.cfg

berndbausch 05-15-2019 07:59 PM

I guess it's this line:
Code:

dhcp4: true
Since no renderer is specified, netplan uses the default systemd-networkd to put this into effect. You could configure NetworkManager instead. See https://netplan.io/reference.

But perhaps I misunderstand your question?

czezz 05-16-2019 01:10 AM

Hi Berndbausch, thanks for reply but that is not exactly what I am asking for.
File: /etc/netplan/50-cloud-init.yaml has been generated automatically by cloud-init and after every reboot it will be generated from scratch (unless changed with netplan apply).

My question is:
where in cloud-init configuration files can I find initial/default settings for /etc/netplan/50-cloud-init.yaml ?

Code:

root@ubuntu:/etc# cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.

By looking for "datasource" I have found it in these files but there is not a single string saying about network configuration, dhcp, etc...
Its very interesting how did it come up to create 50-cloud-init.yaml in a form as it is.
Code:

/etc/cloud/cloud.cfg.d/99-fake_cloud.cfg:datasource_list: [ NoCloud, None ]
/etc/cloud/cloud.cfg.d/90_dpkg.cfg:datasource_list: [ NoCloud, ConfigDrive, OpenNebula, DigitalOcean, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, SmartOS, Bigstep, Scaleway, AliYun, Ec2, CloudStack, Hetzner, IBMCloud, None ]
/var/lib/cloud/data/result.json:  "datasource": "DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]",
/var/lib/cloud/data/status.json:  "datasource": "DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]",



All times are GMT -5. The time now is 09:57 PM.