Dnsmasq – How to Force Host to Use Alternate DNS Servers on Unresolvable Queries

dnsmasqdomain-name-systemlinux

So here is the situation. I have an IOT device running a Digital Signage system. I am trying to set it up so that it hosts it's own WIFI network and a user can connect to that WIFI, enter an http address on their device and be routed to a Webserver that the IOT device is running. It is important to note that this IOT Device itself is not connected to the internet.

This works fine up until someone tries to use a phone, once they have connected to IOT device, they can no longer access any other websites, as in, once they are connected to the WIFI network, their 4g/5g is effectively broken. I suspect this is because dnsmasq is trying to resolve upstream but has no connection itself to any upstream servers. Is there a way that instead of this, it can bounce the query back to the device for it to try it's alternate servers?

Current dnsmasq.conf below.

dhcp-range=192.168.1.101,192.168.1.124,255.255.255.0,24h
domain=wlan
address=/castboard.net/127.0.0.1

server=0.0.0.0

dhcp-option=6,0.0.0.0,8.8.8.8,8.8.4.4

Best Answer

Assuming that dnsmasq runs on the IOT device:

Your approach cannot work. As soon as a mobile phone is connected to a WiFi, it assumes that this wifi has an internet connection. But as you say, your IOT device / WLAN has no internet connection, so any attempt to reach an alternative DNS would fail.

The solution to your problem would be to simply configure your phone not to use this WiFi (or configure the Wifi not to accept connections from mobile phones) - as far as I know, a phone does not have the option "use the mobile data connection" while a WiFi is connected. And nothing you configure in your dnsmasq server would be able to change that...

Related Topic