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:
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:
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?
- 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?