[Dnsmasq-discuss] PID file option problem
Mohsen Zohrevandi
mohsen-lists at asu.edu
Fri Jul 25 18:35:15 BST 2014
Hi,
I am using dnsmasq 2.68 on Ubuntu 14.04 and when I run the following
command I get an error:
$ sudo dnsmasq --no-dhcp-interface --bind-interfaces
--listen-address=169.254.1.1
dnsmasq: failed to create listening socket for port 53: Address already in
use
Running "sudo netstat -anlp | grep -w LISTEN" shows:
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN
1272/dnsmasq
tcp 0 0 10.0.3.1:53 0.0.0.0:* LISTEN
1140/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
1033/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
2190/cupsd
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN
2484/dropbox
tcp6 0 0 fe80::1c44:45ff:fec7:53 :::* LISTEN
1140/dnsmasq
tcp6 0 0 :::22 :::* LISTEN
1033/sshd
tcp6 0 0 ::1:631 :::* LISTEN
2190/cupsd
However, if I run the following command there is no error and dnsmasq
successfully binds to the specified address:
$ sudo dnsmasq --no-dhcp-interface *--pid-file* --bind-interfaces
--listen-address=169.254.1.1
$ sudo netstat -anlp | grep -w LISTEN
* tcp 0 0 169.254.1.1:53 <http://169.254.1.1:53>
0.0.0.0:* LISTEN 3345/dnsmasq *
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN
1272/dnsmasq
tcp 0 0 10.0.3.1:53 0.0.0.0:* LISTEN
1140/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
1033/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
2190/cupsd
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN
2484/dropbox
tcp6 0 0 fe80::1c44:45ff:fec7:53 :::* LISTEN
1140/dnsmasq
tcp6 0 0 :::22 :::* LISTEN
1033/sshd
tcp6 0 0 ::1:631 :::* LISTEN
2190/cupsd
So somehow when I specify --pid-file option, it works, but not otherwise.
Also I noticed that no matter what is specified for the pid-file option, it
writes the pid to /var/run/dnsmasq.pid even in the above case when it is
supposed to disable pid-file:
$ cat /var/run/dnsmasq.pid
*3345*
If I specify another file to be used for pid-file, it still writes the pid
to /var/run/dnsmasq.pid:
$ sudo kill 3345
$ sudo netstat -anlp | grep -w LISTEN
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN
1272/dnsmasq
tcp 0 0 10.0.3.1:53 0.0.0.0:* LISTEN
1140/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
1033/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
2190/cupsd
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN
2484/dropbox
tcp6 0 0 fe80::1c44:45ff:fec7:53 :::* LISTEN
1140/dnsmasq
tcp6 0 0 :::22 :::* LISTEN
1033/sshd
tcp6 0 0 ::1:631 :::* LISTEN
2190/cupsd
$
sudo rm /var/run/dnsmasq.pid
$ sudo dnsmasq --no-dhcp-interface
* --pid-file=/tmp/test.pid* --bind-interfaces --listen-address=169.254.1.1
$ sudo netstat -anlp | grep -w LISTEN
* tcp 0 0 169.254.1.1:53 <http://169.254.1.1:53>
0.0.0.0:* LISTEN 3362/dnsmasq *
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN
1272/dnsmasq
tcp 0 0 10.0.3.1:53 0.0.0.0:* LISTEN
1140/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
1033/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
2190/cupsd
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN
2484/dropbox
tcp6 0 0 fe80::1c44:45ff:fec7:53 :::* LISTEN
1140/dnsmasq
tcp6 0 0 :::22 :::* LISTEN
1033/sshd
tcp6 0 0 ::1:631 :::* LISTEN
2190/cupsd
*$ cat /var/run/dnsmasq.pid *
*3362*
*$ cat /tmp/test.pid*
*cat: /tmp/test.pid: No such file or directory*
I searched the CHANGELOG in the git repository to see if there was a bug
related to this in later versions (I know I don't have the latest version)
but I did not find anything.
The strange thing about this is that I have two other instances of dnsmasq
running on my machine and they both have their separate pid files:
$ ps ax | grep dnsmasq
*1140* ... dnsmasq -u lxc-dnsmasq --strict-order --bind-interfaces
*--pid-file=/run/lxc/dnsmasq.pid* --conf-file= --listen-address 10.0.3.1
--dhcp-range 10.0.3.2,10.0.3.254 --dhcp-lease-max=253 --dhcp-no-override
--except-interface=lo --interface=lxcbr0
--dhcp-leasefile=/var/lib/misc/dnsmasq.lxcbr0.leases --dhcp-authoritative
*1272* ... /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts
--bind-interfaces
*--pid-file=/run/sendsigs.omit.d/network-manager.dnsmasq.pid*
--listen-address=127.0.1.1 --conf-file=/var/run/NetworkManager/dnsmasq.conf
--cache-size=0 --proxy-dnssec
--enable-dbus=org.freedesktop.NetworkManager.dnsmasq
--conf-dir=/etc/NetworkManager/dnsmasq.d
3362 ... dnsmasq --no-dhcp-interface --pid-file=/tmp/test.pid
--bind-interfaces --listen-address=169.254.1.1
...
$ cat /run/lxc/dnsmasq.pid
*1140*
$ cat /run/sendsigs.omit.d/network-manager.dnsmasq.pid
*1272*
Thanks,
Mohsen Zohrevandi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20140725/8a5dc897/attachment.html>
More information about the Dnsmasq-discuss
mailing list