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

LXC appliance: DHCP discover request does not include hostname #1242

Closed
Dude4Linux opened this issue Nov 9, 2018 · 7 comments
Closed

LXC appliance: DHCP discover request does not include hostname #1242

Dude4Linux opened this issue Nov 9, 2018 · 7 comments
Milestone

Comments

@Dude4Linux
Copy link
Member

For appliance versions up through v15.0, the DHCP request issued by udhcpc does not include the hostname. This prevents the upstream DHCP server (usually dnsmasq) from dynamically registering the hostname in DNS. In the past, this was largely an inconvenience which I overcame by pre-defining static entries in the upstream DHCP/DNS. Since developing the Ansible appliance, I've become increasingly frustrated by the need to work around the problem in Ansible playbooks. Lately I've tried adding mods to the LXC containers so that the containers will dynamical register their hostname.

When I recently began looking at fixing a problem in confconsole, I realized that there was a way of addressing the issue by modifying the confconsole code.

From man interfaces:

The dhcp Method
This method may be used to obtain an address via DHCP with any of the tools: dhclient, pump, udhcpc, dhcpcd. (They have been listed in their order of precedence.) If you have a complicated DHCP setup you should note that some of these clients use their own configuration files and do not obtain their configuration information via ifup.
Options
        hostname hostname
                Hostname to be requested (pump, dhcpcd, udhcpc)
        metric metric
                Metric for added routes (dhclient)
        leasehours leasehours
                Preferred lease time in hours (pump)
        leasetime leasetime
                Preferred lease time in seconds (dhcpcd)
        vendor vendor
                Vendor class identifier (dhcpcd)
        client client
                Client identifier (dhcpcd)
        hwaddress address
                Hardware address.

In the testing I've done, adding the hostname to any interface using DHCP in /etc/network/interfaces results in udhcpc including the hostname in the DHCP discover request. In my testing, I also found that when the hostname is changed by confconsole, it must also change /etc/network/interfaces and restart networking to issue a new DHCP request.

@Dude4Linux
Copy link
Member Author

@JedMeister - I've issued a new PR that should close this issue.
Update confconsole for v15.1 #25

@JedMeister JedMeister added this to the 15.1 milestone Jan 10, 2019
@JedMeister
Copy link
Member

I just realised that I hadn't tagged this issue properly. Apologies on that. Also apologies on the really slow turnaround on this... I have a few things that I'd like to tidy up first, but I aim to get back to this sometime within the next week or 2 and tidy up (i.e. finish going over the PR properly and hopefully merge).

@JedMeister JedMeister modified the milestones: 15.1, 16.0 Feb 19, 2020
@JedMeister
Copy link
Member

The v16.0 LXC appliance has been put aside for now as there are significant issues running privileged Debian Buster LXC containers on a Buster host (see #1520).

As such this issue is also deferred for now...

@JedMeister JedMeister modified the milestones: 16.0, 16.1 Oct 14, 2020
@JedMeister JedMeister modified the milestones: 16.1, 17.0 Feb 3, 2021
@JedMeister JedMeister modified the milestones: 17.0, 18.0 Jul 21, 2023
@JedMeister
Copy link
Member

This should now be resolved as of v18.x.

Having said that, we don't currently have an LXC appliance, so it's untested in this context. However, I'm feeling very confident, so closing this one.

@fanyangto
Copy link

I can confirm this problem still exists in the v18.x. My debian-12-turnkey-wordpress_18.2-1_amd64.tar.gz still could not obtain DHCP hostname.

I also find that LXC created with debian-12-standard_12.2-1_amd64.tar.gz works with DHCP names. It's the Turnkey Core templates that has the DHCP no name issue.

@JedMeister
Copy link
Member

Hi @fanyangto

Thanks for reporting.

Although I'm not completely sure that it's exactly the same issue that was discussed here?

This discussion was in context of vanilla LXC (and the LXC host appliance that we produced at the time). On Proxmox, unless you touch /etc/network/.pve-ignore.interfaces inside the guest, the Proxmox host handles the LXC guest's /etc/network/interfaces file.

I've done some quick and dirty testing and I couldn't see any obvious difference between the interfaces file between debian-12-turnkey-wordpress_18.2-1_amd64.tar.gz and debian-12-standard_12.2-1_amd64.tar.gz? If DHCP is chosen in Proxmox at launch, then the hostname isn't added to the interfaces file of either of them. In either guest, if I edit the interfaces file to add the hostname, both are reset to the Proxmox default on guest reboot.

So could you please open a new issue describing the problematic behavior in as much detail as possible, ideally with step by step instructions on how I can reproduce it locally. Personally I always use static IPs for my servers but if I can reproduce your problem on my local Proxmox server, then I'm confident that I can fix it - or at the least, document a workaround...

@fanyangto
Copy link

Hi @fanyangto

Thanks for reporting.

Although I'm not completely sure that it's exactly the same issue that was discussed here?

This discussion was in context of vanilla LXC (and the LXC host appliance that we produced at the time). On Proxmox, unless you touch /etc/network/.pve-ignore.interfaces inside the guest, the Proxmox host handles the LXC guest's /etc/network/interfaces file.

I've done some quick and dirty testing and I couldn't see any obvious difference between the interfaces file between debian-12-turnkey-wordpress_18.2-1_amd64.tar.gz and debian-12-standard_12.2-1_amd64.tar.gz? If DHCP is chosen in Proxmox at launch, then the hostname isn't added to the interfaces file of either of them. In either guest, if I edit the interfaces file to add the hostname, both are reset to the Proxmox default on guest reboot.

So could you please open a new issue describing the problematic behavior in as much detail as possible, ideally with step by step instructions on how I can reproduce it locally. Personally I always use static IPs for my servers but if I can reproduce your problem on my local Proxmox server, then I'm confident that I can fix it - or at the least, document a workaround...

Good point Jeremy. I have opened a new case #1992 per your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants