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:
Code: Select all
# 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";
}
}
Another example is a mix of VoIP phones. Depending on the manufacturer I have to send different options...
Code: Select all
# 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:...;
Best regards,
Chris