5

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

  • I believe what dnsmasq does is set your DNS address to 127.0.0.1, which dnsmasq listens to, and then it forwards the query to the appropriate external server. – saiarcot895 Jul 6 '15 at 15:44
2

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.

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.