I have set up a dnsmasq server on my computer and it works just fine for computers on LAN, but I can't access it externally. Every tutorial/documentation I have seen about dnsmasq seems to focus on internal connections, so I'm not even sure it can be done. I have tried to open port 53 on my router and simply use the external IP address of my computer as the DNS server for a computer in another network, but this doesn't work. Is my approach invalid or does dnsmasq not allow external connections?

Here's the output of netstat -na | grep 53

tcp        0      0*     LISTEN
tcp6       0      0 :::53             :::*          LISTEN
udp        0      0*
udp        0      0*
udp6       0      0 :::53             :::*
udp6       0      0 :::5353           :::*
unix  2      [ ACC ]     STREAM     LISTENING     12538    @/tmp/dbus-iOmdhtTj6j
unix  2      [ ACC ]     STREAM     LISTENING     18760    @aitor-com.canonical.Unity.Scope.files.T2838538736616
unix  2      [ ACC ]     STREAM     LISTENING     13753    /run/user/1000/pulse/native
unix  3      [ ]         STREAM     CONNECTED     12253    
unix  3      [ ]         STREAM     CONNECTED     15381    
unix  3      [ ]         STREAM     CONNECTED     21535    
unix  3      [ ]         STREAM     CONNECTED     18753    
unix  3      [ ]         STREAM     CONNECTED     13539    @/tmp/dbus-wMqgvvSqrL
unix  3      [ ]         STREAM     CONNECTED     12953    
unix  3      [ ]         STREAM     CONNECTED     18761    @aitor-com.canonical.Unity.Scope.files.T2838538736616
unix  3      [ ]         STREAM     CONNECTED     13153    
unix  3      [ ]         STREAM     CONNECTED     15382    
unix  3      [ ]         STREAM     CONNECTED     15386    
unix  3      [ ]         STREAM     CONNECTED     15388    
unix  3      [ ]         STREAM     CONNECTED     15387    
  • Output of netstat -na | grep 53 please. Also, how do you invoke dnsmasq (what arguments dies it run with)? – roaima Feb 20 '15 at 18:22
  • I run dnsmasq with --no-daemon and --log-queries parameters. I have added the netstat output to the question. – XaitormanX Feb 21 '15 at 0:58

By default, dnsmasq is often configured to listen only to connections from the local machine. It can however be reached from anywhere if configured properly; for example it's commonly used on Linux-based network appliances like home routers where it replies to queries from the internal network.

Edit the file dnsmasq.conf and make sure that the interfaces and listen-address are both set to include all the places you want to reach it from. If you want it to be available from the internet, then these two options must not be set. Also make sure that bind-interfaces is not set either.

Note that in order for your computer to respond to DNS queries, it needs to have an IP address that's visible from the internet, i.e. not in a private IP address range.

  • Thank you for your answer. I have none of those parameters set in my dnsmasq.conf . Also, I don't understand what you mean by private IP address range. I thought the private IPs where used to indentify computers on LAN and then there was the external IP to indentify computers on WAN, am I wrong?. Is that external IP what you mean by address visible from the internet? – XaitormanX Feb 21 '15 at 0:56
  • @XaitormanX Most LANs use NAT so that machines inside the LAN have private addresses but can contact machines outside the LAN. But the standard NAT setup doesn't allow machines outside the LAN to contact machines inside the LAN. For that, you need the server to have a public IP address, or to set up the NAT appliance to redirect incoming requests appropriately. – Gilles Feb 21 '15 at 1:06
  • Allright, I have created a virtual server in the router's configuration and also I have set my computer as the DMZ host. Should that be enough? It still does not work – XaitormanX Feb 21 '15 at 10:17
  • I have found that my ISP is the one blocking port 53, so I guess that was the problem. I'll try contacting them – XaitormanX Feb 21 '15 at 10:44
  • @XaitormanX were you able to resolve this situation? if yes then can you please tell me the steps and configuration you followed. – pratibha Apr 10 at 13:21

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.