I got this error when i done the setup dnsmasq.

ashokkrishna@krishna:~$ sudo dnsmasq

dnsmasq: failed to create listening socket for port 53: Address already in use

ashokkrishna@krishna:~$ netstat -lpn | grep :53
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0    *               LISTEN      -               
tcp6       0      0 :::53                   :::*                    LISTEN      -               
tcp6       0      0 :::53755                :::*                    LISTEN      -               
udp        0      0    *                           -               
udp        0      0  *                           -               
udp6       0      0 :::53                   :::*                                -               
udp6       0      0 :::5353                 :::*                                - 

so how to solve this or how to stop those sockets.

3 Answers 3


You can do this:

netstat -tupln

you will get result like this:

tcp   0  0 :::80   :::*      LISTEN    713/httpd

take the pid for the process that listening on th port 53 and kill it with this command

kill -9 pid
  • 1
    actually the process is nsd i cannot kill that process
    – ashok
    May 30, 2015 at 7:32
  • that is again coming into existence
    – ashok
    May 30, 2015 at 7:33
  • I thought you wanna run another DNS server and you wanna stop the first one May 30, 2015 at 7:35
  • no i havent any dns servers my server is itself a dns server
    – ashok
    May 30, 2015 at 7:37
  • This is only a temporary solution. For a permanent solution please consider my answer below. Jan 20, 2021 at 3:29

I just spent hours trying to resolve this issue in a reasonable manner without any major system modifications.

Stop dnsmasq from auto starting.

servicectl disable dnsmasq

Create file /etc/rc.local or /etc/rc.d/rc.local depending on distro.

Set perms chmod +x /etc/rc.local

Edit file:

service systemd-resolved stop
service dnsmasq start

Simply stopping systemd-resolved then starting dnsmasq after full boot works perfect, at least on Mint. I can't speak on other distros.

  • systemd-resolved is part of the systemd init system and therefore you would use the appropriate commands; sudo systemctl stop systemd-resolved sudo systemctl disable systemd-resolved
    – coxe87b
    Apr 12 at 2:51

Check for port usage with;

lsof -i -n -P

In my case, systemd-resolved was blocking port 53 from use as below:

systemd-r  640 systemd-resolve   12u  IPv4  22295      0t0  UDP
systemd-r  640 systemd-resolve   13u  IPv4  22296      0t0  TCP (LISTEN)

Simply disable systemd-resolved before enabling dnsmasq;

sudo systemctl disable systemd-resolved --now
sudo systemctl enable dnsmasq --now

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.