The officially official Devuan Forum!

You are not logged in.

#1 Installation » cloud-init does not set IP » 2023-08-28 10:05:06

lastcentral
Replies: 0

Hi,

I have a custom VM image based on Devuan Chimera as template in a Proxmox cluster and would like to configure it's IP, for example to "172.27.3.77". Apparently, cloud-init is the way to go. I edited the /etc/cloud/cloud.cfg (which by default does really a lot). When booting, a ASCII-Art-Table happily tells me that another IP address had been configured:

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

I assume, I get it via DHCP, but I'm not able to verify this in the log files:

root@RefVm-5:~# find /var/log/ -type f|xargs  grep  172.27.1.32 
/var/log/daemon.log:Aug 28 11:35:32 RefVm-5 avahi-daemon[1626]: Joining mDNS multicast group on interface eth0.IPv4 with address 172.27.1.32.
/var/log/daemon.log:Aug 28 11:35:32 RefVm-5 avahi-daemon[1626]: Registering new address record for 172.27.1.32 on eth0.IPv4.
/var/log/cloud-init-output.log:ci-info: |  eth0  | True | 172.27.1.32 | 255.255.252.0 | global | fe:37:f1:1e:35:4b |
/var/log/syslog:Aug 28 11:35:32 RefVm-5 avahi-daemon[1626]: Joining mDNS multicast group on interface eth0.IPv4 with address 172.27.1.32.
/var/log/syslog:Aug 28 11:35:32 RefVm-5 avahi-daemon[1626]: Registering new address record for 172.27.1.32 on eth0.IPv4.

BTW: On the console, I cannot "scroll back" to "look up", because Kernel does not support Shift-PgUp anymore and I don't see some boot.log or such. Can I see the bootmessages on console somehow?

However, cloud-init writes config file for right IP:

root@RefVm-5:~# 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 dom.net

auto eth0
iface eth0 inet static
    address 172.27.3.77/22
    gateway 172.27.0.1
root@RefVm-5:~# 

This is want I configured in Proxmox cloud-init config and this is what I want.

When I try "ifup eth0", it says "ifup: interface eth0 already configured", if I add "--force", I get a "RTNETLINK answers: File exists" warning and then have both IP addresses (which is fine). I can access 172.27.3.77 then and all is fine.
NB: even if I reboot after getting /etc/network/interfaces.d/50-cloud-init, I don't get this IP address, so cloud-init appears to act early enough in the boot process (possibly deleting / recreating the file?).

What do I miss? How do I get my IP address configured (without needing manually ifup --force)?

Board footer

Forum Software