dnsmasq: failed to create listening socket for port 53: Address already in use
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 0.0.0.0:53 0.0.0.0:* LISTEN -
tcp6 0 0 :::53 :::* LISTEN -
tcp6 0 0 :::53755 :::* LISTEN -
udp 0 0 0.0.0.0:53 0.0.0.0:* -
udp 0 0 0.0.0.0:5353 0.0.0.0:* -
udp6 0 0 :::53 :::* -
udp6 0 0 :::5353 :::* -
so how to solve this or how to stop those sockets.
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
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:
#!/bin/bash
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.