I'm trying to create a systemd service on Debian Jessie.
I need it to start after network-online.target
is reached.
The problem is network-online.target
fires at the same time as network.target
and at that time my interfaces are not configured yet, just started DHCP query.
It looks like this issue is specific to Debian because it uses legacy network configuration.
How to bypass this problem or how to make network-online.target
working?
Best Answer
Since you're using
/etc/network/interfaces
, you'll need a systemd service to monitor the status of each interface. Check to see if you have/lib/systemd/system/ifup-wait-all-auto.service
(installed by theifupdown
package in Ubuntu 15.04). If not, then create/etc/systemd/system/ifup-wait-all-auto.service
, and paste in the following:This is the service file as present on an Ubuntu 15.04 system, but with the
[Install]
section added in to make things a little easier. I'm hoping that the behavior ofifup
in Ubuntu 15.04 is the same as the behavior ofifup
in Debian Jessie. If not, some modification will be necessary (particularly with the last line).Then, run
sudo systemctl enable ifup-wait-all-auto.service
. After rebooting your computer, you should see that thenetwork-online.target
is reached after the interfaces are brought up (at least).