[Solved]Trouble setting up DHCP-Options for DNS on single VLAN (802.1q)[Solved]

Greetings:

High overview:
I have 6 VLAN (802.1q) interfaces on openwrt created that are passed down to POE switch that does tagging. Some goes to IP cameras network and some go to Unify WiFi AP to be distributed across 4 different SSIDs. Everything work great, all vlans have unique ip address group distributed by openwrt dhcp.

What I am trying to accomplish (End Goal):
Specific to Vlan "50", I want DHCP client be able to assigned with opendns DNS servers to filter this traffic. It will be for kids only as you can imaging.

What is the issue right now:
I am having trouble setting up DHCP-Options for DNS on single VLAN (802.1q) name "50" with any DNS server I put in there resulting in dnsmasq barking that specific line in /var/etc/dnsmasq.conf.cfg01411c is bad.

Symptoms:
Once I implement config above, I can not renew IP from any VLANs. Whatever was connected can still talk to the router until IP is renewed.

What have I been doing:
From Luci UI I go to interfaces > eth0.50 > edit > DHCP Server > Advanced Settings > DHCP-OPTIONS to enter and save:

6,208.67.222.222,208.67.220.220

Save config and apply

So in System Log I am getting:

Wed Apr  3 15:12:12 2024 daemon.info dnsmasq[1]: exiting on receipt of SIGTERM
Wed Apr  3 15:12:12 2024 daemon.crit dnsmasq[1]: bad IPv4 address at line 40 of /var/etc/dnsmasq.conf.cfg01411c
Wed Apr  3 15:12:12 2024 daemon.crit dnsmasq[1]: FAILED to start up
Wed Apr  3 15:12:12 2024 daemon.info procd: Instance dnsmasq::cfg01411c s in a crash loop 7 crashes, 0 seconds since last crash

line 40 of /var/etc/dnsmasq.conf.cfg01411c is:

dhcp-option=50,6,208.67.222.222,208.67.220.220

Here is entire /var/etc/dnsmasq.conf.cfg01411c:

# auto-generated config file from /etc/config/dhcp
conf-file=/etc/dnsmasq.conf
dhcp-authoritative
domain-needed
strict-order
localise-queries
read-ethers
enable-ubus=dnsmasq
expand-hosts
bind-dynamic
local-service
all-servers
cache-size=1000
edns-packet-max=1232
domain=lan
local=/lan/
addn-hosts=/tmp/hosts
dhcp-leasefile=/tmp/dhcp.leases
resolv-file=/tmp/resolv.conf.d/resolv.conf.auto
stop-dns-rebind
rebind-localhost-ok
dhcp-broadcast=tag:needs-broadcast
conf-dir=/tmp/dnsmasq.d
user=dnsmasq
group=dnsmasq


dhcp-ignore-names=tag:dhcp_bogus_hostname
conf-file=/usr/share/dnsmasq/dhcpbogushostname.conf


bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf
dhcp-range=set:lan,192.168.1.100,192.168.1.249,255.255.255.0,12h
no-dhcp-interface=eth1
dhcp-range=set:20,192.168.20.100,192.168.20.249,255.255.255.0,12h
dhcp-range=set:30,192.168.30.100,192.168.30.249,255.255.255.0,12h
dhcp-range=set:40,192.168.4.100,192.168.4.249,255.255.255.0,12h
dhcp-range=set:50,192.168.50.100,192.168.50.249,255.255.255.0,12h
dhcp-option=50,6,208.67.222.222,208.67.220.220
dhcp-range=set:60,192.168.60.100,192.168.60.249,255.255.255.0,12h
dhcp-range=set:10,192.168.1.100,192.168.1.249,255.255.255.0,12h





Here is my /etc/config/dhcp config:

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option cachesize '1000'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'
	option strictorder '1'
	option allservers '1'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config dhcp '20'
	option interface '20'
	option start '100'
	option limit '150'
	option leasetime '12h'

config dhcp '30'
	option interface '30'
	option start '100'
	option limit '150'
	option leasetime '12h'

config dhcp '40'
	option interface '40'
	option start '100'
	option limit '150'
	option leasetime '12h'

config dhcp '50'
	option interface '50'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option force '1'
	list dhcp_option '6,208.67.222.222,208.67.220.220'

config dhcp '60'
	option interface '60'
	option start '100'
	option limit '150'
	option leasetime '12h'

config dhcp '10'
	option interface '10'
	option start '100'
	option limit '150'
	option leasetime '12h'

I am guessing after heavy research that I might have to setup another dnsmasq which is not possible from Luci UI so CLI although I am not sure about that.

Any help would be appriciated.

Try splitting this into 2 separate lines:

	list dhcp_option '6,208.67.222.222'
	list dhcp_option '6,208.67.220.220'

Greetings:

Just tried it and got same results:

Wed Apr  3 17:55:51 2024 daemon.info dnsmasq[1]: exiting on receipt of SIGTERM
Wed Apr  3 17:55:51 2024 daemon.crit dnsmasq[1]: bad IPv4 address at line 40 of /var/etc/dnsmasq.conf.cfg01411c
Wed Apr  3 17:55:51 2024 daemon.crit dnsmasq[1]: FAILED to start up
Wed Apr  3 17:55:51 2024 daemon.info procd: Instance dnsmasq::cfg01411c s in a crash loop 9 crashes, 0 seconds since last crash
Wed Apr  3 17:55:52 2024 daemon.warn odhcpd[2561]: No default route present, overriding ra_lifetime!

line 40 of /var/etc/dnsmasq.conf.cfg01411c that complain is:

dhcp-option=50,6,208.67.222.222

Maybe is the name of the network?? Try vlan50 instead of 50 (obviously this needs to be updated and consistent across several places).

That did it @psherman . Thank you so much as I did exactly what you suggested. Everything now is working and I verified on SSID the get vlan50 that opendns is working. I switched to other SSID that get different vlan and opendns dns server are not advertised.

Resolution:

  1. Network > Interfaces < deleted "eth0.50"
  2. save and apply
  3. Network > Interfaces > Devices < deleted eth0.50 ( I probably did not had to do that)
  4. save and apply
  5. Network > Interfaces > Devices > added back eth0.50 as VLAN (802.1q) type
  6. save and apply
  7. Network > Interfaces > added " vlan50" bonded to device "eth0.50" just like before with DHCP.
  8. save and apply
  9. Network > Interfaces > vlan50 > DHCP server > Advanced .. > DHCP-Options > add
    "6,208.67.220.220,208.67.222.222"
  10. save and apply

Great! Glad it worked.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Thanks! :slight_smile:

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