LEDE/OpenWRT — Defining DHCP Options
As with most settings in LEDE/OpenWRT, defining your DHCP option is a matter of changing a couple lines in a config file.
It is not recommended to manually mess around with these sort of settings, but it is very useful for some specific use cases, as it allows you to set specific options to DHCP clients.
SSH to your LEDE/OpenWRT device
If you are using Windows then start PuTTY and click Session on the left side, select SSH from the options, and then enter in the IP Address of your LEDE/OpenWRT box into the Host Name field.
Once you’ve done this just click on Open to start up the SSH connection.
If you are connecting via terminal, then just SSH to your LEDE/OpenWRT device using the following command, where 192.168.1.1 is your LEDE/OpenWRT device’s IP address.
ssh root@192.168.1.1
Configuration
First we will need to open the config file we are going to make changes to. Simply run the following command:
vi /etc/config/dhcp
By default you should find a DHCP section defined for your device’s LAN that looks similar to this:
config 'dhcp' 'lan'
option 'interface' 'lan'
option 'start' '100'
option 'limit' '150'
option 'leasetime' '24h'
option ra server
option dhcpv6 server
Most of these options have been covered in our previous guide here.
To set specific DHCP Options, we need to add the following to it:
list ‘dhcp_option’ ‘66,172.16.60.64’
A full list of DHCP options can be found here.
Once you’ve added your DHCP Options in, you should be left with something similar to the following:
config 'dhcp' 'lan'
option 'interface' 'lan'
option 'start' '100'
option 'limit' '150'
option 'leasetime' '24h'
option ra server
option dhcpv6 server
list 'dhcp_option' '66,172.16.60.64'
list 'dhcp_option' '150,172.16.60.64'
Once you are happy with your changes, save them, and reboot your device by running the following:
reboot
If you found this post helpful please let us know by clicking the ♥ below.
This blog was brought to you by Cucumber WiFi. Cucumber helps you run a more efficient WiFi network. Check it out here.
Cucumber WiFi — control any (WiFi) device from the cloud.