Internet connection lost after installing dnsmasq

I’m currently trying to set up an access point on my raspberry pi, but as soon as I install ‘dnsmasq’, the internet connection is lost (‘unknown host’ when trying to ping any server).

What causes this and how do I connect it to the internet again?

P.S.: i can access it via ssh, so local network is still working…

edit: so apparently it’s just the dns-server, because it works when pinging the numeric ip instead of e.g. google.com; I assume the dnsmasq/nscd service is overwriting the working configuration

Asked By: Simon

||

dnsmasq should read /etc/resolv.conf and use the DNS servers there. In case that doesn’t work for some reason, you can manually specify what DNS servers to use. To do that, in /etc/dnsmasq.conf, add server= followed by the IP address of the DNS server. For example, to use 8.8.8.8 and 8.8.4.4 as your DNS servers, use:

server=8.8.8.8
server=8.8.4.4
Answered By: saiarcot895

You need to configure dnsmasq. Look in /etc/dnsmasq.conf. I don’t know much about your situation, but I’m certain that you’ll need to set these options:

resolv-file=/etc/dnsmasq.resolv
listen-address=127.0.0.1
listen-address=10.0.0.3  # Or whatever the machine's IP address is.

The file /etc/resolv.conf is what every process other than dnsmasq looks into to find what IP address to send a DNS query to. On the machine running dnsmasq, /etc/resolv.conf should have it’s own IP address in resolv.conf.

Then, you need to have /etc/dnsmasq.resolv containing the IP address of the next level up’s DNS server. That might be your company’s DNS server, or your ISP’s DNS server, or something like 8.8.8.8, or whoever you use.

I have a superstition that after changing dnsmasq.conf or dnsmasq-resolv, you have to stop and start the dnsmasq process. I could be wrong.

Answered By: user732
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.