0

I'm hosting a hotspot on a device (e.g. Raspberry Pi) that has no internet connection running Ubuntu 20.04. I use the hotspot so that other devices can connect it to and make HTTP requests to a server running on it. However, I notice that clients (e.g. Mobile phones, laptops) that connect to it often lose the ability to use the internet because of DNS issues (even though they are still connected to their 4G/ethernet) - The error I usually see when using Chrome on my mobile phone while connected to the hotspot is "DNS_PROBE_FINISHED_NO_INTERNET".

I think that the clients are prioritising the wifi hotspot for DNS/internet connection, even though the hotspot does not provide one? Is there a way to tell clients to not prioritise/use the hotspot network (without any client-side modification), except for e.g. requests to 192.168.10.0/24 or certain addresses such as www.foobar.com?

The hotspot network is set up using nmcli, with dnsmasq as the DHCP server. The setup more specifically is:

WIFI_IF="wlan0"
CON_NAME="myhotspot"
SSID="myhotspot"
MY_IP="192.168.10.1"
sudo nmcli con add type wifi ifname $WIFI_IF con-name $CON_NAME autoconnect yes ssid $SSID
sudo nmcli con modify $CON_NAME 802-11-wireless.mode ap ipv4.method manual ipv4.addresses $MY_IP/24 ipv4.gateway $MY_IP
sudo nmcli con modify $CON_NAME wifi-sec.key-mgmt wpa-psk
sudo nmcli con modify $CON_NAME wifi-sec.psk $2 # password
sudo nmcli con modify $CON_NAME connection.autoconnect-priority 10
sudo nmcli con up $CON_NAME

I use the following dnsmasq.conf for the dnsmasq DHCP server:

no-resolv
bind-interfaces
interface=wlan0
listen-address=192.168.10.1,127.0.0.1

# address=/www.foobar.com/192.168.10.1 # redirect queries to this address to myself


dhcp-range=192.168.10.100,192.168.10.250,255.255.255.0,12h
dhcp-option=option:router,192.168.10.1
dhcp-leasefile=/var/lib/misc/dnsmasq.leases

I have tried setting port=0 in dnsmasq to turn off DNS functionality without success.

1
  • What kind of devices are these clients? If they are not general-purpose computers (e.g. PCs, Macs, Raspberry Pis), then the question you should be asking is "are these devices even capable of connecting to more than one IP network at a time?" Most phones and tablets just drop (or switch to standby mode) any other IP connection when they connect to a WiFi network: they won't act as true multi-homed hosts and their user interface typically does not allow you to change that. And the hardware might not be able to maintain multiple WiFi connections simultaneously even if the OS would allow it.
    – telcoM
    Commented Aug 28, 2023 at 8:56

1 Answer 1

0

If you don't want the hotspot to act as a default gateway, then you shouldn't advertise so, i.e., you should remove:

dhcp-option=option:router,192.168.10.1

P.S. While I think port=0 is still a good idea, technically the clients won't assume there's a DNS server either way, because a corresponding dhcp-option= is what's relevant in the client context.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .