2

I have setup dnsmasq on ubuntu 14.04. The dnsmasq part works fine. However on boot, dnsmasq runs BEFORE eth0 is up. This causes dnsmasq to not respond to queries on eth0. In syslog I can see dnsmasq start and about 3 seconds later eth0 comes up.

If i just restart dnsmasq all is fine.

I have tried moving the order of dnsmasq around in rd2.d. I can get closer but it still runs first.

Is there a way to force it to wait for eth0 to be up, or is there a way to force a 10 second delay before dnsmasq starts. Perhaps there is a script that I can run in rc2.d to stall the whole init process for a few seconds? (This is a server that is rarely down, I don't care if it takes a few extra seconds to restart)

(as a side note: syslog also tells me that anything that needs DNS at boot time is also annoyed that dnsmasq is not running)

3 Answers 3

3

I fixed this without changing the book order. Just add :

After=network-online.target
Wants=network-online.target

to the [Unit] section of /lib/systemd/system/dnsmasq.service

https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/1531184

0

See http://smallbusiness.chron.com/change-start-order-processes-linux-61730.html for information on changing order of processes during boot.

The process that starts eth0 up should be "network", so I expect that in your /etc/rc3.d or /etc/rc5.d directories, network is set to start up after dnsmasq.

0

Not directly for Ubuntu, but I have this for raspberry pi OS and the ONLY way I got this to work is to put it in crontab,

So: disable it on startup:

sudo update-rc.d dnsmasq disable

open crontab. IF its the first time, select nano as default

crontab -e

add in:

@reboot sudo service dnsmasq start

save and exit. I used nano so

ctrl + o

ctrl + x

Finally worked after 3 hours.

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.