2

I'm running OpenVPN and dnsmasmq on my wheezy system. Dnsmasq is only necessary for VPN and local users, so I don't want it to listen on all devices (yes, there is also a firewall, anyways).

When the services get started at boot, openvpn is started first from S02openvpn, dnsmasq right afterwards, S03dnsmasq. When I let dnsmasq bind on all devices, this works fine, but if I restrict it to tun0+loop with interface=tun0 in the config, I get errors at boot time from dnsmasq, complaining that it can't bind to tun0.

So, how can I make sure that some devices, namely tun0 in my case, are available before some other init script gets executed? Any other less elegant quickfix would also be welcome!

Michael
  • 123
  • 1
  • 8

1 Answers1

2

I finally found it out myself. Recent Debian init scripts feature some special comments in the beginning of the files. There can be specified, which kind of services they provide, and which have to be available first. It's described here quite well:

https://wiki.debian.org/LSBInitScripts

So for my special case, I had to edit /etc/inti.d/dnsmasq and add openvpn to the requirements:

# Required-Start: $network $remote_fs $syslog openvpn
Michael
  • 123
  • 1
  • 8
  • Hi, I've run into the same problem, and here's the thing that confuses me: why isn't openvpn started before dnsmasq, provided that it is `S02` and dnsmasq is `S03`? – Limbo Peng Aug 07 '14 at 03:58
  • According to the bug report [here](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=681961), somehow it can fail as the tunnel may not have been set up when starting dnsmasq. – Limbo Peng Sep 08 '14 at 03:59