Dhcpv4-server - How to pass Mac address and architecture in boot filename?

When booting using the user-class iPXE, I need to include the architecture and my mac address in the filename URL. For example:

s’https://192.168.11.60/provision/?mac=00:00:00:00:00:00&arch=x86_64

With ISC DHCP, I can do this with replacement variables, but how can we do this using dhcp4-server and only for user-class of iPXE?

Thanks in advance!

TheWitness
www.catci.net

Is this what you looking for ?

Not really. For example, I don’t see either architecture or Mac address here:

HOSTNAME - client hostname
RADIUS_MT_STR1 - from radius MT attr nr. 24
RADIUS_MT_STR2 - from radius MT attr nr. 25
REMOTE_ID - agent remote-id
NETWORK_GATEWAY - the first gateway from '/ip dhcp-server network', note that this option won't work if used from lease

Also, it’s not clear to me how to do a if/the/else statement or use the user-class in that statement. I read through the documentation twice yesterday.

There are really 3 or 4 parts to the question.

  1. Can the filename be a URL
  2. Can I add the requestor mac address, ip address assigned, and architecture to the URL. If so, show an example
  3. Can I perform if/then/else in the rules to assign the filename by user-class?
  4. Can I get access to the user-class in that if/then/else construct

If this is possible, it would be nice to see the documentation augmented as such outside of providing the example here.

Thanks!

TheWitness
www.cacti.net

Within ISC DHCP (Linux), we can do the following:

if exists user-class and option user-class = "iPXE" {
  filename "http://192.168.11.60/provision/?mac=${net0/mac}&arch=${buildarch}&ip=${ip}";
}

If would be good to see how to approximate this method to set the boot filename in Mikrotik dhcp4-server.

Thanks!

TheWitness

If you using vendor class from the pxe boot, it may work.
Like this thread, this feature is pretty new to Mikrotik DHCP Server, but i think it’s pain to add lots of dhcp options set’s, to support all variants.
But here is the thread:
https://forum.mikrotik.com/t/vendor-class-id-replaced-with-generic-option-matcher-how-to-pxe-boot/

That is helpful. I’ll give it a detailed read. The documentation site certainly needs to be updated to include some of the gold nuggets from that conversation for sure. Once I get done reading, I’ll post here again.

Question though… Does the community have a way to contribute to the published documentation on this site?

Okay, so the chaining is fine. The matcher appears to address the if/then/else aspect by architecture, but there is still no way to dynamically update the filename to include dynamic content, or if so, it’s not well documented back to this right?

http://192.168.11.60/provision/?mac=$(CLIENT_MAC)&arch=$(CLIENT_ARCH)&ip=$(CLIENT_IP)

With the matcher, I could manually populate the URL based upon the architecture. So, one of three down, but what about the other two? I guess once I receive a request from the web server, I can get the requestor IP address from the $_SERVER super-global (written in php). So, I guess that is two down. All that’s really left is how to pass the mac Address to the remote http server.

And lastly, I still don’t know if the filename can include a URL as above.

All good things for the documentation once complete.

TheWitness