0

So I'm running an apache2 server and hostapd on a raspberry pi 2, with raspbian. When I try to run dnsmasq with dnsmasq.conf localhost=127.0.0.1 (among others settings I don't think they are important now) it says

dnsmasq: failed to create listening socket for port 53: Address already in use [fail].

But I have tried

lsof -i -P -n | grep '53' 

and I only get dnsmasq.

When I run net netstat -ap46 I get

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address   Foreign Address State  PID/Program name    
tcp        0      0 localhost:mysql 0.0.0.0:*       LISTEN 559/mysqld          
tcp        0      0 0.0.0.0:domain  0.0.0.0:*       LISTEN 438/dnsmasq         
tcp        0      0 0.0.0.0:ssh     0.0.0.0:*       LISTEN 445/sshd            
tcp6       0      0 [::]:http       [::]:*          LISTEN 627/apache2         
tcp6       0      0 [::]:domain     [::]:*          LISTEN 438/dnsmasq         
tcp6       0      0 [::]:ssh        [::]:*          LISTEN 445/sshd            
udp        0      0 0.0.0.0:mdns    0.0.0.0:*              327/avahi-daemon: r 
udp        0      0 0.0.0.0:domain  0.0.0.0:*              438/dnsmasq         
udp        0      0 0.0.0.0:bootpc  0.0.0.0:*              370/dhcpcd          
udp        0      0 0.0.0.0:59990   0.0.0.0:*              327/avahi-daemon: r 
udp6       0      0 [::]:mdns       [::]:*                 327/avahi-daemon: r 
udp6       0      0 [::]:55646      [::]:*                 327/avahi-daemon: r 
udp6       0      0 [::]:domain     [::]:*                 438/dnsmasq         
raw6       0      0 [::]:ipv6-icmp  [::]:*             7   370/dhcpcd   

I dont't have installed Network Manager. Is dnsmasq interfering with itself? How can I fix it?

2
  • What doesnetstat -ap46 say? It lists the open sockets with their owning processes for the IPv4 and IPv6 protocols. If port 53 is in use, I would expect it to be listed. – Mr. Donutz Jan 5 '20 at 13:26
  • You'll have to edit your question to add the whole list in proper order. There should be an "edit" link at the bottom of the question. – Mr. Donutz Jan 5 '20 at 14:51
0

Under Local Address, port 53 is named as :domain and listed as used by process "438/dnsmasq" for all the protocols. If you use netstat -ap46n, you will see the numbers instead of names.

The Program Name is dnsmasq, which means that it is already running indeed. If you have htop, you can search for it by process id, which is 438 in this case. It will show you the command that was used to start the process. Alternatively, use cat /proc/438/cmdline to display that information.

So with dnsmasq already running, you'll want to check the configuration file(s) and a hint towards which one is used can be found in the command as found in /proc/438/cmdline. The manpage for dnsmasq on my system does list a number of files, but not the directory /etc/dnsmasq.d and the default config file /etc/default/dnsmasq. Checking the latter file may be a good place to start. For example, use sudo nano /etc/default/dnsmasq to do it on the CLI.

I hope that's enough to get you going on this one.

1
  • Okay, so by checking all the configuration files and doing some research, I discovered that although you set ENABLE=0 on /etc/default/dnsmasq in order to stop the daemon, you need to delete the /etc/init.d/dnsmasq file or to run /etc/init.d/dnsmasq stop in order to stop the process. Thanks for the support – hacefresko Jan 6 '20 at 14:03

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.