Where in LUCI can one add custom lines for dnsmasq

Does LUCI allow one to append custom dnsmasq lines somewhere or must they be entered directly into /etc/dnsmasq.conf

Thanks!

You didn't mention what custom lines you need. See:

https://openwrt.org/docs/guide-user/base-system/dhcp
https://openwrt.org/docs/guide-user/base-system/dhcp.dnsmasq
https://openwrt.org/docs/guide-user/base-system/dhcp_configuration

The file you generally edit in OpenWrt is /etc/config/dhcp

1 Like

I have a separate box running pihole and I want to whitelist a few devices entirely. The lines want to add are specifically:

dhcp-option=tag:googlesdns1,6,8.8.8.8
dhcp-host=AC:15:EA:16:A3:BD,set:googlesdns1

Simply appending them to /etc/dnsmasq.conf followed by /etc/init.d/dnsmasq restart works just fine... just wondering about the potential to do it from LUCI.

EDIT: Ah, I see now... it's better strategy to edit /etc/config/dhcp since that is a backed-up config file whereas /etc/dnsmasq.conf is probably package provided...

Am I correct that I should edit it appending the lines to under the config dhcp 'wan' section? Unclear on the syntax to use for the 2 lines... Thanks!

I realise I'm re-opening an old enquiry but I have the same question and IMHO isn't hasn't been properly answered.

Bear with me as I'm relatively new to OpenWrt - having recently migrated from DDWRT.

I've got two FTTC lines to my home (business & personal) and have two gateways. All devices in the home are on the same network but I need my work devices to use a different gateway (from the DHCP server which is the default).

With DD-WRT I'm able to add Dnsmasq/DHCP entries using the web interface (there's an input panel for additional Dnsmasq options) to achieve this. For example:

dhcp-host=set:tagx,aa:bb:cc:dd:ee:ff,10.0.0.23
dhcp-option=tagx,3,10.0.0.1

My question is whether I can do the same using LuCI (or must I SSH in & edit /etc/config/dhcp instead) ?

Thanks in advance

It's been answered in other threads; this thread is 2 years old.

The example takes MACs to assign IP and another DNS. Assigning another gateway should work in the same manner. As far as I know, it cannot be done within LuCI.

1 Like

Thanks for the pointer. Just for completeness, here's what worked for me (had to edit /etc/config/dhcp rather than use LuC). BTW my work workstation has 3 network adapters.

config host
option mac 'xx:xx:xx:xx:xx:xx yy:yy:yy:yy:yy:yy zz:zz:zz:zz:zz:zz'
option ip '10.0.0.23'
option tag 'work_pc'
config tag 'work_pc'
list 'dhcp_option' '3,10.0.0.1'

Hi There. I’m in the same boat as you were when you posted asking for your clarification.

I have about 80 devices on my home network on my main subnet as well as 10 devices on 2 other subnets (forget about them for now). My main subnet has 2 gateways - one normal gateway that uses my ISP directly, and a second gateway for OpenVPN provided by a dedicated router running DD-WRT. I’m also using DD-WRT as the DHCP server for my home network and 70 of my 80 devices have DHCP reservations configured that each assign the appropriate gateway for the device.

I’ve recently decided to use a raspberry pi as a stand-alone DHCP and DNS server on my network and have flashed it with the latest version of OpenWRT and am now trying to import all of my reservations.

Reading this thread, it appears that my single line per device configuration from DD-WRT is going to require 5 or 6 lines per device in OpenWRT?

My question is - did you ever find a way to copy/paste the configuration directly from DD-WRT or recreate it using a single line per reservation - or did you use the multiple line syntax shown in this thread?

Edit: Both DD-WRT and OpenWRT use dnsmasq, so I would expect that it would be possible to use the same configuration syntax?

hmmmm.......

same syntax... separate UI...

1 Like

Sorry guys, my use case no longer requires this within my OW device (pihole upstream added the this ability).

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.