Proxmox CT does not configure hostname properly for DHCP on Alpine & Debian templates

senkwich

New Member
Jul 13, 2020
2
0
1
33
I recently set up Proxmox 6.2 onto a couple of old servers and was running through configuring some LXC instances. I've tried the following with only ArchLinux working as expected:

  • alpine-3.10-default_20190626_amd64.tar.xz (does not work)
  • alpine-3.11-default_20200425_amd64.tar.xz (does not work)
  • debian-10.0-standard_10.0-1_amd64.tar.gz (does not work)
  • debian-9.0-standard_9.7-1_amd64.tar.gz (does not work)
  • debian-10-turnkey-gitea_16.0-1_amd64.tar.gz (does not work)
  • archlinux-base_20200508-1_amd64.tar.gz (works)

I've got a Ubiquiti Edge Lite 3 configured with dnsmasq to map hostnames to IP addresses via DHCP. E.g. if I run a machine with the hostname "git" that is assigned IP address 192.168.1.100, dnsmasq will route git.my.domain to 192.168.1.100.

What I've discovered is that with the alpine and debian images above, they use udhcpc as the client, which seems to not pick up the hostname to send as a parameter/option to the DHCP server. If I manually run udhcpc renew -x hostname:git, the hostname is picked up and correctly set by dnsmasq, but this would require me to run this whenever the container starts up.

I tried editing some udhcpc configs, but couldn't get it to change. Finally, I read several places online where editing /etc/network/interfaces to include hostname as a configuration would set it. The challenge was that the interfaces file was being overwritten by proxmox; so, I had to touch /etc/network/.pve-ignore.interfaces in order to add the setting to the generated file:


Code:
auto lo
iface lo inet loopback
iface lo inet6 loopback

auto eth0
iface eth0 inet dhcp
hostname $(hostname) <-- added this line

iface eth0 inet6 manual

Adding the ignore and rebooting the container fixed my problem and dnsmasq picked up the hostname for use locally. Is this expected for LXC containers? I'd prefer to not need to edit the interfaces file manually nor mark it for being ignored by pve. Is there a better way to do this?
 
could you file an issue over at https://bugzilla.proxmox.com ? looks like something that we could add to our network setup code for select distros..
 
Can confirm I saw the same in the turnkey wordpress image.

udhcpc renew -x hostname:`cat /etc/hostname` solved this, until the next start. Looking for a place like /etc/rc.local.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!