:: [DNG] Wrong (no) IP from cloud-init
Page principale
Supprimer ce message
Répondre à ce message
Auteur: Steffen Dettmer
Date:  
À: Dng
Sujet: [DNG] Wrong (no) IP from cloud-init
Hi,

On a Proxmox system I have a few Devuan virtual machines. The VM image is based
on Chimera, is configured DHCP via /etc/network/interfaces and so far worked
great all the time, a few instances were I setup the MAC in DHPC server to get
"static IP via DHCP" (lease reservation or however it is called). Then I
normally use very pragmatic ansible scripts to configure my needs.

Now I have a few more instances and learnt that cloud init would be
the way to go.
So I created a cloud init device in Proxmox and added an IP adress: "10.2.3.77".
I disabled what I think I don't need in /etc/cloud/cloud.cfg and
rebooted the VM.

I get an ASCII-Art-Table, which shows the wrong IP adderss.

ci-info: ++++++++++++++++++++++++++++++Net device
info+++++++++++++++++++++++++++++++
ci-info: +--------+------+-------------+---------------+--------+-------------------+
ci-info: | Device |  Up  |   Address   |      Mask     | Scope  |
Hw-Address    |
ci-info: +--------+------+-------------+---------------+--------+-------------------+
ci-info: |  eth0  | True |  10.2.1.31  | 255.255.252.0 | global |
fe:37:f1:4e:53:ac |
ci-info: |   lo   | True |  127.0.0.1  |   255.0.0.0   |  host  |
   .         |
ci-info: +--------+------+-------------+---------------+--------+-------------------+


I dont' know where this IP comes from:

root@devuan-master:~# find /var/log/ -type f|xargs grep 10.2.1.32
/var/log/daemon.log:Sep 6 08:12:32 devuan-master avahi-daemon[1626]:
Joining mDNS multicast group on interface eth0.IPv4 with address
10.2.1.32.
/var/log/daemon.log:Sep 6 08:12:32 devuan-master avahi-daemon[1626]:
Registering new address record for 10.2.1.32 on eth0.IPv4.
/var/log/cloud-init-output.log:ci-info: | eth0 | True | 10.2.1.32 |
255.255.252.0 | global | fe:37:f1:4e:53:ac |
/var/log/syslog:Sep 6 08:12:32 devuan-master avahi-daemon[1626]:
Joining mDNS multicast group on interface eth0.IPv4 with address
10.2.1.32.
/var/log/syslog:Sep 6 08:12:32 devuan-master avahi-daemon[1626]:
Registering new address record for 10.2.1.32 on eth0.IPv4.

But I think from DHCP.

cloud-init sets up the correct one:

root@devuan-master:~# cat /etc/network/interfaces.d/50-cloud-init
# 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}
auto lo
iface lo inet loopback
    dns-nameservers 10.12.3.4
    dns-search company.com


auto eth0
iface eth0 inet static
    address 10.2.3.77/22
    gateway 10.2.0.1
root@devuan-master:~#


But I don't get this IP "activated", I don't see it on "ip a" or so.

"ifup eth0 --force" sets it and then I can access 10.2.3.77.
After reboot, it is not setup again.

How do I get the IP without manually "ifup eth0 --force"?

Steffen