EdgeRouter - Define custom DHCP options


Readers will learn how to configure the DHCP server to transmit custom options to clients.

Note: This configuration presumes that the DHCP subnet is already configured as described in EdgeMAX - Configure static IP addresses

Steps for DHCP server

To configure a DHCP server, four settings are required:

  • name
  • subnet
  • option number
  • option string

Here is an example of how to set add option 242 to an existing dhcp configuration:

set service dhcp-server global-parameters 'option option-242 code 242 = string;'
set service dhcp-server shared-network-name LABNET subnet subnet-parameters 'option option-242 "L2Q=1,L2QVLAN=118";'


This shows the DHCP server configuration:

dhcp-server {
global-parameters "option option-242 code 242 = string;" shared-network-name LABNET { subnet { default-router dns-server start { stop }
subnet-parameters "option option-242 "L2Q=1,L2QVLAN=123";" } } }



In the example above the custom option string requires quotes to be injected directly into the dhcpd.conf. As literal quotes are not allowed in the cli command we replace our quotes with the special entity format for a quote " this will be translated back to a literal quote when building the dhcpd.conf

The above example helps configure some types of SIP phones to join a specific VLAN after booting.


The above settings will inject strings directly into the dhcpd.conf with no validation. The result may prevent the daemon from starting properly and may not report any errors when committed. Check the system log after applying these settings to confirm the daemon started properly.