5

I have a Hotspot configured to share my wired Internet connection with other devices, the hotspot is started using nmcli con up Hotspot ifname virtual.

The hostspot is up and use the IP 10.42.0.1

At this point all works fine, any device can connect to the hotspot and use the internet.

Now I'm trying to setup dnsmasq to access to some virtual hosts in my computer from my phone, but when try to start the service I got the following error:

dnsmasq[1034]: failed to create listening socket for 10.42.0.1: Address already in use

I can see "some" process already listening on port 53

netstat -anlp | grep LISTEN | grep 10.42.0.1:53
tcp        0      0 10.42.0.1:53            0.0.0.0:*               LISTEN      -

The hotspot is launching some dns server?, can disable this to use dnsmasq or at least configure to read hosts from /etc/hosts?

rafrsr
  • 1,296

1 Answers1

4

I found a solution:

Firstly remove any change made in the dnsmasq config file.

Create the following file /etc/NetworkManager/dnsmasq-shared.d/hosts.conf

with:

address=/.local/10.42.0.1

Where .local is the last part of all my virtual domains in /etc/hosts

127.0.0.1    somedomain.local
127.0.0.1    another.domain.local

Restart the network manager and works like a charm.

Apparently the network manager run his own dnsmasq.

The following links gave me an idea:

Configure NetworkManager's dnsmasq to use /etc/hosts

http://manpages.ubuntu.com/manpages/zesty/en/man8/dnsmasq.8.html

rafrsr
  • 1,296