Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turnkey Core LXC fail to obtain hostname in DHCP request #1992

Open
fanyangto opened this issue Oct 15, 2024 · 0 comments
Open

Turnkey Core LXC fail to obtain hostname in DHCP request #1992

fanyangto opened this issue Oct 15, 2024 · 0 comments

Comments

@fanyangto
Copy link

fanyangto commented Oct 15, 2024

I believe this issue has existed for a long time.

PVE 8.1, 8.2.4
DHCP server: fresh tomato's dnsmasq

When I create a container with the Turnkey Core LXC template, the LXC obtained the IP address via DHCP. But the DNS name is not set as the hostname configured in PVE. Instead, it's just the hostname derived from the MAC address. I used to workaround it by creating a IP reservation (MAC to IP and hostname mapping).

But recently I found the following:

  1. debian-12-turnkey-core: create a container with this template. Set the hostname in PVE. Start the container, login LXC, it obtained the IP address. But if you look at the dnsmasq hostname, it's not the hostname specified but the MAC address. You can modify the hostname of the container in PVE and then reboot. It has no effect. It's still the mac address is associated with the IP.
  2. debian-12-turnkey-wordpress_18.x has the same problem, as it's based on the same turnkey core LXC template.
  3. debian-12-standard_12.*, debian-11-standard_11.x do not suffer from this bug. You can see the dns name for the container obtained is the host name set in the PVE. You can also change the hostname in PVE, reboot the container and the new hostname will be associated with the IP address.

Based on the experiments of various container templates, I believe the issue is in the turnkey core LXC.

I currently work around this problem by doing the following: I added the following in crontab:


# sleep 30 to avoid race condition
@reboot sleep 30; /usr/sbin/udhcpc renew -x hostname:`cat /etc/hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant