currently RouterOS supports adding dhcp options and it does send these only when requested from client. What I need is to send conditional options based on information the client sends.
My first example is PXE booting. Depending on what the client is, supports or what architecture it is based on I need to send different options. This is configuration snippet for ISC dhcpd:
# Declare the iPXE option space
option space ipxe;
option ipxe-encap-opts code 175 = encapsulate ipxe;
# iPXE feature flags, set in DHCP request packet
option ipxe.http code 19 = unsigned integer 8;
option ipxe.bzimage code 24 = unsigned integer 8;
option ipxe.pxe code 33 = unsigned integer 8;
option ipxe.elf code 34 = unsigned integer 8;
option ipxe.efi code 36 = unsigned integer 8;
option ipxe.menu code 39 = unsigned integer 8;
# Other useful general options
option arch code 93 = unsigned integer 16;
class "PXEClient" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
allow booting;
allow bootp;
next-server 10.0.0.1;
# Make sure the iPXE we're loading supports what we need,
# if not load a full-featured version.
if exists ipxe.http
and exists ipxe.menu
and ((exists ipxe.pxe
and exists ipxe.bzimage
and exists ipxe.elf)
or (exists ipxe.efi)) {
# Everything is fine, just send the boot configuration file.
filename "http://10.0.0.1:3928/default.ipxe";
} elsif exists user-class and option user-class = "iPXE" {
# We're already using iPXE, but not a feature-full version,
# and possibly an out-of-date version from ROM, so load a more
# complete version with native drivers.
if option arch = 00:06 {
filename "/ipxe/efi-i386.efi";
} elsif option arch = 00:07 {
filename "/ipxe/efi-x86_64.efi";
} else {
filename "/ipxe/ipxe.pxe";
}
} elsif exists user-class and option user-class = "gPXE" {
# If someone has an old version of gPXE burned into their ROM,
# load a more recent iPXE
filename "/ipxe/ipxe.pxe";
} elsif option arch = 00:06 {
filename "/ipxe/efi-i386.efi";
} elsif option arch = 00:07 {
filename "/ipxe/efi-x86_64.efi";
} else {
filename "/ipxe/ipxe.pxe";
}
}
This is kind of complex… It uses information from vendor-class-identifier, ipxe option space and architecture (general option code 93). But having a solution for that in RouterOS would be really great.
Another example is a mix of VoIP phones. Depending on the manufacturer I have to send different options…
# Siemens Opti Stage IP Phones
class "OptiIpPhone" {
match if option vendor-class-identifier = "OptiIpPhone";
option vendor-encapsulated-options 01:07:53:69:65:6D:65:6E:73:02:...;
}
# Lync Phone
class "CPE-OCPHONE" {
match if option vendor-class-identifier = "CPE-OCPHONE";
option vendor-encapsulated-options 01:0B:43:50:45:...;
}
class "MS-UC-Client" {
match if option vendor-class-identifier = "MS-UC-Client";
option vendor-encapsulated-options 01:0C:4d:53:2d:...;
Thanks for your excellent devices and a great operating system for routers!
If DHCP->Leases has static item of DHCP client and this item has custom DHCP options, DHCP Server could offer this custom DHCP options to DHCP client even if DHCP client didn’t send these options during DHCP Discovery package.
This is one attitude i dislike about mikrotik. They won’t reply even when faced with important bugs. Maybe they only communicate with people they know. Disappointing.
But I’m so much so looking forward to this feature. We should have modern networking booting for modern times.
dnsmasq supports conditions, isc dhcpd supports it, even microsoft dhcp probably supports it.
On conditional dhcp? no. Did send a mail on issues prevalent with bridge+vlan on 6.38.5 to which i havent received a reply after a week. How about you send them an email on this on ‘our’ behalf and see if they do actually reply. (Since they always reply to you) You could then let us know of the wonderful news.
I did write to them and they answered in less than a day. They told me the same jinzhanhua did some posts above. “DHCP lease menu allows you to set different DHCP option or option set for specific client.”
Well, I wasn’t pleased with the answer and asked more specifically for “rule-based conditional DHCP options”. They replied “We will see what we can do about it.”
So this is probably not the “wonderful news” you were looking for, but they replied.
If you want to refer to my inquiry you may use the following ticket number: Ticket#2017032222001004. If they see more people requesting certain features it helps them decide what to implement next.
Any solution?
I think so, because I managed with these configurations, boot via legacy and uefi in a virtual machine, without having to manually change the d boot file.
Sorry for the English, by google translator.
You can use DHCP option 67 to change the boot file name, in fact ive been using that to easily change PXE and UEFI boot mode from winbox, and yes you can set a dhcp option to one filename and having a dhcp option set pointing to the other one(what i think he was missing on the last command) active at the same time on a network but it dosent work.