dnsmasq fails to start on boot Ubuntu 13.10

1

1

dnsmasq fails to start on boot of Ubuntu 13.10, showing the error in the syslog:

dnsmasq failed to create listening socket for 192.168.0.10: Cannot assign requested address

When I start it manually, it works great. Here is the dnsmasq.conf:

bogus-priv
server=212.27.40.240
server=212.27.40.241
local=/mydomain.0./
# interface=eth0
listen-address=127.0.0.1
listen-address=192.168.0.10
expand-hosts
domain=mydomain.0.
dhcp-range=192.168.0.20,192.168.0.100,24h
dhcp-option=3,192.168.0.1
dhcp-option=vendor:MSFT,2,1i
cname="www.mydomain.0",myhost

As I understand it, NetworkManager uses an instance of a cut-down version of dnsmasq that can conflict with the full version. I am guessing this is the cause of the problem. I would like to have the host with the server on it, plus all of the other hosts on the network, use dnsmasq.

Any ideas about what is going on?

Paul B

Posted 2013-12-05T18:31:37.720

Reputation: 53

Answers

0

Had the same error, I didn't start my interface eth0, and IP address of server was not assigned. So solving the problem was

  1. Start the eth0 interface and assign IP with sudo ifup eth0 and check it with sudo ip a
  2. Restart the dnsmask server sudo service dnsmasq restart

If it helps my config was following /etc/network/interfaces

allow-hotplug eth0
iface eth0 inet dhcp
    address 192.168.2.1
    netmask 255.255.255.0
    network 192.168.2.0
    broadcast 192.168.2.255
    dns-nameservers 8.8.8.8
    dns-search lan
    post-up /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

/etc/dnsmasq.conf

interface=eth0      # Use interface eth0  
listen-address=192.168.2.1 # Explicitly specify the address to listen on  
bind-interfaces      # Bind to the interface to make sure we aren't sending things elsewhere  
server=8.8.8.8       # Forward DNS requests to Google DNS  
domain-needed        # Don't forward short names  
bogus-priv           # Never forward addresses in the non-routed address spaces.  
dhcp-range=192.168.2.50,192.168.2.150,12h # Assign IP addresses between 172.24.1.50 and 172.24.1.150 with a 12 hour lease time  

My perpose was to get a dhcp server to be able to reroute cabled trafic to wlan of my lptp

Philippe Gachoud

Posted 2013-12-05T18:31:37.720

Reputation: 545

0

It sounds like the address or the port is being used already. Try disabling networkmanager to see if this helps. This is most likely not the cause as you are able to get to the address when you manually start the service.

Also, this can happen during boot time if your address has not been assigned to the server before the dnsmasq service starts. If this is the case, make sure that your server is assigned a static IP address.

Atari911

Posted 2013-12-05T18:31:37.720

Reputation: 718

I removed networkmanager and rebooted, but dnsmasq did not start. I have assigned the server a static IP address (using the Network Manager). – Paul B – 2013-12-06T15:24:45.333

0

I had the same problem in 14.04. It turned out to be a combination of NetworkManager and dnsmasq. In /var/log/syslog you might see, that eth0 is not ready when dnsmasq tries to start as well.

My solution was to disable eth0 for NM by configuring eth0 within /etc/network/interfaces. Add iface eth0 inet dhcp ... or similar to the config. Thus eth0 is available when dnsmasq starts.

Claus

Posted 2013-12-05T18:31:37.720

Reputation: 13