Custom DHCP Options, PXE Boot, and Vendor Option Sets
Custom DHCP Options, PXE Boot, and Vendor Option Sets
Section titled “Custom DHCP Options, PXE Boot, and Vendor Option Sets”Overview
Section titled “Overview”RouterOS DHCP server supports arbitrary DHCP options beyond the standard gateway
and DNS fields. You define options under /ip dhcp-server option, group them into
named option sets, then attach those sets to servers, networks, or individual
leases. A matcher lets you dynamically select which option set a client receives
based on the content of options the client sends — for example, its vendor-class
string (option 60) or client architecture (option 93).
| Component | Menu | Purpose |
|---|---|---|
| Option | /ip dhcp-server option | Define a single option: code, name, value |
| Option Set | /ip dhcp-server option sets | Group multiple options under one name |
| Matcher | /ip dhcp-server matcher | Map client-sent option values to server option sets |
Assignment precedence (highest wins): RADIUS > per-lease > per-server > per-network.
Defining Custom Options
Section titled “Defining Custom Options”Value Encoding
Section titled “Value Encoding”RouterOS accepts several value formats for the value field. The encoding
determines exactly what bytes the client receives:
| Format | Example | Result |
|---|---|---|
| Quoted string | 'pxelinux.0' | ASCII bytes (auto-detected) |
s'...' prefix | s'192.168.1.10' | ASCII string bytes literally |
| Quoted IP | '192.168.1.10' | 4-byte IP encoding |
| Decimal | '10' | Single byte (0x0a) |
| Raw hex | 0x0a0a0a0a | Exact bytes, no conversion |
| Concatenation | '10.0.0.1'.'10.0.0.2' | Two IPs back-to-back |
Use s'...' when the option expects the value as a readable ASCII string (e.g.,
option 66 TFTP server name, option 67 boot filename). Use raw hex (0x...) for
binary TLV payloads such as option 43 vendor-specific data.
Creating an Option
Section titled “Creating an Option”/ip dhcp-server optionadd name=tftp-server code=66 value=s"192.168.88.10"add name=bios-bootfile code=67 value=s"pxelinux.0"add name=uefi-bootfile code=67 value=s"bootx64.efi"add name=vendor-class code=60 value=s"PXEClient"add name=vendor-specific code=43 value=0x0104C0A85810Note: Option code 67 can be defined with different names for BIOS and UEFI. Matchers select which one to use per client. Only one option 67 is sent per DHCP response.
The force Flag
Section titled “The force Flag”By default, RouterOS only sends an option if the client requests it (Parameter
Request List, option 55). Set force=yes to always send the option regardless:
/ip dhcp-server option set [find name=tftp-server] force=yes/ip dhcp-server option set [find name=bios-bootfile] force=yesOption Sets
Section titled “Option Sets”Group related options under a named set for easy reuse:
/ip dhcp-server option setsadd name=pxe-bios options=tftp-server,bios-bootfileadd name=pxe-uefi options=tftp-server,uefi-bootfileAssigning an Option Set
Section titled “Assigning an Option Set”To a DHCP network (all clients on a subnet):
/ip dhcp-server networkset [find address="192.168.88.0/24"] dhcp-option-set=pxe-biosTo a specific DHCP server (all clients on that server):
/ip dhcp-server set [find name=dhcp1] dhcp-option-set=pxe-biosTo a single client lease (highest precedence, overrides network/server):
/ip dhcp-server leaseset [find mac-address="AA:BB:CC:DD:EE:FF"] dhcp-option-set=pxe-biosDHCP Matchers
Section titled “DHCP Matchers”Matchers dynamically assign option sets based on options the client sends. Rules are evaluated in order — the first match wins. Place specific rules above generic ones.
/ip dhcp-server matcheradd name=<rule-name> server=<server-name|all> code=<option-code> \ matching-type=<exact|substring> value=<string|hex> option-set=<name>| Field | Description |
|---|---|
code | DHCP option code to inspect in the client’s request |
matching-type | exact — full match; substring — value appears anywhere |
value | String or hex to match against |
option-set | Option set to apply when this rule matches |
server | Limit rule to a specific server, or all for any server |
PXE Network Boot
Section titled “PXE Network Boot”PXE boot requires the DHCP server to tell the client where to find a TFTP server (option 66) and which file to download (option 67). BIOS and UEFI firmware expect different boot files, so use matchers to serve each correctly.
Option Reference for PXE
Section titled “Option Reference for PXE”| Option | Code | Purpose |
|---|---|---|
| Vendor Class Identifier | 60 | Client identifies itself (e.g., PXEClient) |
| TFTP Server Name | 66 | Hostname or IP of the TFTP server |
| Boot File Name | 67 | Path to the boot file on the TFTP server |
| Vendor-Specific | 43 | Binary TLV payload (iPXE sub-options, UNDI info) |
| Client System Architecture | 93 | 0x0000 = BIOS x86, 0x0007 = UEFI x64 |
Full PXE Configuration (BIOS + UEFI)
Section titled “Full PXE Configuration (BIOS + UEFI)”This example serves BIOS clients pxelinux.0 and UEFI x64 clients bootx64.efi
from a TFTP server at 192.168.88.10:
# Step 1: Define options/ip dhcp-server optionadd name=opt66-tftp code=66 value=s"192.168.88.10"add name=opt67-bios code=67 value=s"pxelinux.0"add name=opt67-uefi code=67 value=s"bootx64.efi"
# Step 2: Build option sets/ip dhcp-server option setsadd name=pxe-bios options=opt66-tftp,opt67-biosadd name=pxe-uefi options=opt66-tftp,opt67-uefi
# Step 3: Add matchers (most-specific first)/ip dhcp-server matcher# UEFI x64 clients send option 93 = 0x0007add name=match-uefi64 server=dhcp1 code=93 matching-type=exact \ value=0x0007 option-set=pxe-uefi# All other PXEClient firmware falls back to BIOSadd name=match-pxeclient server=dhcp1 code=60 matching-type=substring \ value=PXEClient option-set=pxe-bios
# Step 4: Set default option set on the network (non-PXE clients get nothing extra)/ip dhcp-server networkset [find address="192.168.88.0/24"] gateway=192.168.88.1 dns-server=192.168.88.1iPXE Chainloading
Section titled “iPXE Chainloading”iPXE clients identify themselves with vendor-class iPXE. Once booted into iPXE,
they re-request DHCP and need a different boot file (e.g., an iPXE script):
/ip dhcp-server optionadd name=opt67-ipxe-script code=67 value=s"http://192.168.88.10/boot.ipxe"
/ip dhcp-server option setsadd name=pxe-ipxe options=opt66-tftp,opt67-ipxe-script
/ip dhcp-server matcher# iPXE re-request — must be above the generic PXEClient ruleadd name=match-ipxe server=dhcp1 code=60 matching-type=exact \ value=iPXE option-set=pxe-ipxeMatcher order in the list determines priority. Place match-ipxe above
match-pxeclient so iPXE clients receive the script URL rather than the
initial boot file.
Option 43 for iPXE / Vendor-Specific Extensions
Section titled “Option 43 for iPXE / Vendor-Specific Extensions”Option 43 carries a binary TLV blob whose format is defined by the vendor. For iPXE, the suboptions control features like PXE extensions and server discovery. RouterOS sends it as a raw hex value:
/ip dhcp-server optionadd name=opt43-ipxe code=43 value=0x0104C0A85810The exact bytes depend on your PXE stack. Consult your iPXE or PXE vendor documentation for the correct suboption encoding.
Vendor-Specific Option Sets
Section titled “Vendor-Specific Option Sets”VoIP Phones
Section titled “VoIP Phones”Many IP phones use option 66 (TFTP) or option 43 to discover their provisioning server, and announce themselves with a vendor-class string in option 60.
/ip dhcp-server optionadd name=voip-tftp code=66 value=s"192.168.1.200"add name=voip-vendor code=43 value=0x0104C0A801C8
/ip dhcp-server option setsadd name=voip-set options=voip-tftp,voip-vendor
/ip dhcp-server matcheradd name=match-voip server=dhcp1 code=60 matching-type=substring \ value=Polycom option-set=voip-setReplace Polycom with the vendor-class string your phones send. Use
/tool sniffer or packet-capture to inspect what option 60 your phones
advertise if unknown.
Cable Modems (DOCSIS)
Section titled “Cable Modems (DOCSIS)”DOCSIS modems expect option 43 with DOCSIS-specific sub-options. RouterOS supports vendor option spaces for building these payloads:
/ip dhcp-server option spaceadd name=docsis code=4491
/ip dhcp-server optionadd name=cm-tftp code=2 value=s"/nvram/modem.cfg" space=docsisadd name=cm-swver code=4 value=s"DOCSIS3.0" space=docsis
# Combine suboptions into a single option 43 payloadadd name=docsis-opt43 code=43 \ value=0x02112F6E7672616D2F6D6F64656D2E63666704084443534953332E30
/ip dhcp-server option setsadd name=docsis-set options=docsis-opt43
/ip dhcp-server matcheradd name=match-docsis server=dhcp1 code=60 matching-type=substring \ value=docsis option-set=docsis-setThe hex payload in
value=0x...must encode the full TLV sub-option structure per DOCSIS specification. Use your cable vendor’s tools to generate the correct bytes.
Thin Clients
Section titled “Thin Clients”Thin clients often announce themselves with a vendor-class string and require a specific boot server or configuration file. Use the same option 60 matcher pattern:
/ip dhcp-server optionadd name=tc-bootserver code=66 value=s"192.168.10.50"add name=tc-bootfile code=67 value=s"thinOS/wtos.pkg"
/ip dhcp-server option setsadd name=thinclient-set options=tc-bootserver,tc-bootfile
/ip dhcp-server matcheradd name=match-wyse server=dhcp1 code=60 matching-type=substring \ value=Wyse option-set=thinclient-setDHCP Relay and Option 82
Section titled “DHCP Relay and Option 82”When RouterOS acts as a DHCP relay (/ip dhcp-relay), it can insert option 82
(Relay Agent Information) to identify the subscriber port and location. This is
used in ISP, wholesale/retail, and CGNAT deployments.
See DHCP Relay Option 82 for full configuration details,
including add-relay-info, relay-info-remote-id, and lease-script usage of
lease-agent-circuit-id / lease-agent-remote-id variables.
Troubleshooting
Section titled “Troubleshooting”Client Not Receiving Options
Section titled “Client Not Receiving Options”Check that the option code is in the client’s Parameter Request List:
/tool sniffer start filter-ip-protocol=udp filter-port=67,68/tool sniffer printLook for option 55 in the DISCOVER/REQUEST packets. If the client does not
request the option code, enable force=yes on the option definition.
Verify the option set is attached:
/ip dhcp-server network print detail/ip dhcp-server print detailCheck matcher order: Matchers run top-to-bottom; earlier rules take priority. Print matchers in list order and verify the intended rule appears before any overlapping rule:
/ip dhcp-server matcher printPXE Client Gets Wrong Boot File
Section titled “PXE Client Gets Wrong Boot File”Capture the DHCP exchange and inspect which options the client sends (especially
option 60 and option 93). Compare against your matcher rules — the client’s
option 60 string or option 93 architecture value may not match the matcher value
exactly. Use matching-type=substring for partial matches, exact only when
you know the full string.
Option 43 Not Working
Section titled “Option 43 Not Working”Option 43 is vendor-specific and must be encoded as a binary TLV matching exactly what your client firmware expects. Capture the PXE exchange with Wireshark on the LAN side to decode what bytes the client expects in option 43.
Related Features
Section titled “Related Features”- DHCP Relay Option 82 — relay agent information for ISP and subscriber tracking
- DHCP — DHCP server, client, relay, and lease management overview
- IPv6 Prefix Delegation and DHCPv6 — IPv6 DHCP and prefix delegation
References
Section titled “References”- RFC 2132 — DHCP Options and BOOTP Vendor Extensions
- RFC 3046 — DHCP Relay Agent Information Option (Option 82)
- RFC 4578 — Dynamic Host Configuration Protocol (DHCP) Options for the Intel Preboot eXecution Environment (PXE)
- RFC 5071 — Dynamic Host Configuration Protocol Options Used by PXELINUX
- MikroTik DHCP Documentation