Been able to validate the ISC DHCP configuration by using: dhclient eth0
in a container, but during boot the instance it gets incorrect options due to the dhcpd-eval process not getting the user-class option.
I’ve set this via cloud-init in: {LXDprofile} > config > user-data > write_files ... > /etc/dhcp/dhclient.conf
but I suspect that this method is deprecated and not hitting any Google results.
Any ideas how this can be done with LXD containers and VMs via a profile/cloud-init? Would it have to do with networkd/netplan & UserClass=?
DHClient works fine but seems deprecated and isn’t being used by Ubuntu.
Netplan doesn’t seem to support DHCP sending user/vendor classes unless I am missing something. Hope I am and someone can enlighten me: https://bugs.launchpad.net/netplan/+bug/1759014
Networkd does seem to work but I think Netplan gets in the way.
In the following ISC KB article, I see there are a couple of matches to watch out for, so I tested using their “foobar” example: https://kb.isc.org/docs/matching-user-class-option-77-from-rfc-3004-compliant-clients-in-isc-dhcp
The if statement is being executed because it’s detecting the “user-class” option being sent by networkd and running the debug directive and I’m getting this in the log: dhcpd[6609]: #006foobar
however I cannot get the if statement to match what the value of the debug output is with any of these because I don’t understand this format coming from the debug:
if ( exists user-class ) and (option user-class = "foobar"
or option user-class = "\x06foobar"
or option user-class = "\#006foobar"
or option user-class = "006foobar"
) ); { log (debug, option user-class); ..... }
The desired outcome here is to use the user-class to determine what DHCP options are passed to the container/VM. The user-class is pushed to the container/VM via a {LXDprofile} > config > cloud-config or some other way.