9

The OS is Scientific Linux 6.3 (which is similar to redhat, centos and fedora) and I have installed dnsmasq with the following configuration

interface=eth1
domain=hpclab
expand-hosts
dhcp-range=10.0.2.51,10.0.2.100,static
dhcp-option=42,0.0.0.0
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/var/lib/tftpboot
dhcp-host=08:00:27:69:73:7A,ws04,10.0.2.51

and current node (which runs dnsmasq) has this ip

eth1  Link encap:Ethernet  HWaddr 08:00:27:A9:20:C0  
      inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
      inet6 addr: fe80::a00:27ff:fea9:20c0/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

However, I get error when trying to start the dnsmasq service

[root@localhost mahmood]# /etc/init.d/dnsmasq status
dnsmasq is stopped
[root@localhost mahmood]# /etc/init.d/dnsmasq start
Starting dnsmasq: 
dnsmasq: failed to create listening socket: Address already in use
                                                       [FAILED]

netstat command shows the following information

[root@localhost mahmood]# netstat -anlp | grep -w LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1252/rpcbind        
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1445/cupsd          
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1685/master         
tcp        0      0 0.0.0.0:46556               0.0.0.0:*                   LISTEN      1348/rpc.statd      
tcp        0      0 :::111                      :::*                        LISTEN      1252/rpcbind        
tcp        0      0 :::80                       :::*                        LISTEN      4884/httpd          
tcp        0      0 ::1:631                     :::*                        LISTEN      1445/cupsd          
tcp        0      0 :::51096                    :::*                        LISTEN      1348/rpc.statd      

and

[root@localhost mahmood]# netstat -aunp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
udp        0      0 0.0.0.0:69                  0.0.0.0:*                               5110/xinetd         
udp        0      0 0.0.0.0:34136               0.0.0.0:*                               1323/avahi-daemon   
udp        0      0 0.0.0.0:38756               0.0.0.0:*                               1348/rpc.statd      
udp        0      0 0.0.0.0:5353                0.0.0.0:*                               1323/avahi-daemon   
udp        0      0 0.0.0.0:1003                0.0.0.0:*                               1252/rpcbind        
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               1252/rpcbind        
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               1445/cupsd          
udp        0      0 0.0.0.0:676                 0.0.0.0:*                               1348/rpc.statd      
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               5189/dhclient       
udp        0      0 :::1003                     :::*                                    1252/rpcbind        
udp        0      0 :::111                      :::*                                    1252/rpcbind        
udp        0      0 :::43248                    :::*                                    1348/rpc.statd      

What can cause such error and how can I fix that?

  • Please also post the output of netstat -anup. My guess is that there is some process bound to UDP/53 and/or UDP/67. – Steven Monday Aug 1 '14 at 14:29
  • I updated the post – mahmood Aug 1 '14 at 14:33
5

The issue is that you have configured dnsmasq to provide TFTP service (via the enable-tftp option in dnsmasq.conf). The service port for TFTP is UDP/69, so dnsmasq wants to bind to it, but xinetd has already done so, and it is impossible for two different processes to bind to the same service port.

If you want dnsmasq to provide TFTP service, you will need to edit the xinetd configuration (likely /etc/xinetd.conf) to turn off its TFTP service. Or, if you prefer to have xinetd provide TFTP service, then you will need to remove enable-tftp from dnsmasq.conf.

| improve this answer | |
  • 1
    what did not help me was that the errror dnsmasq: failed to create listening socket for 192.168.2.1: Address already in use is possibly a bit mis-leading with its "Address already in use" as it is actually the port already in use but applying similar logic to this answer netstat -anup pointed me to in.tftp which i stopped with service tftpd-hpa stop – northern-bradley Apr 7 '18 at 21:11

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.