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 the ifupdown package in Ubuntu 15.04). If not, then create /etc/systemd/system/ifup-wait-all-auto.service, and paste in the following:
[Unit]
Description=Wait for all "auto" /etc/network/interfaces to be up for network-online.target
Documentation=man:interfaces(5) man:ifup(8)
DefaultDependencies=no
After=local-fs.target
Before=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
TimeoutStartSec=2min
ExecStart=/bin/sh -ec '\
for i in $(ifquery --list --exclude lo --allow auto); do INTERFACES="$INTERFACES$i "; done; \
[ -n "$INTERFACES" ] || exit 0; \
while ! ifquery --state $INTERFACES >/dev/null; do sleep 1; done; \
for i in $INTERFACES; do while [ -e /run/network/ifup-$i.pid ]; do sleep 0.2; done; done'
[Install]
WantedBy=network-online.target
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 of ifup in Ubuntu 15.04 is the same as the behavior of ifup 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 the network-online.target is reached after the interfaces are brought up (at least).
systemctl list-dependencies network-online.target? Also, note that thenetwork-online.targetmay not necessary mean that there is Internet access. See this page for more info. – saiarcot895 Jul 22 '15 at 23:10network-online.target ● └─systemd-networkd-wait-online.serviceI've read that page already, I understand the basic concept there, but still it is very strange to have no defined point where network critical services can start. At least it could wait for proper DHCP assign. – 10robinho Jul 22 '15 at 23:42network-online.targetdepends only on thesystemd-networkd-wait-online.servicesaying that it is ready. It doesn't depend on NetworkManager saying it's ready, nor check thatifupbrought all links up successfully (if you use that method to configure your network). Ubuntu, on the other hand, depends onifupand NetworkManager, but not forsystemd-networkd-wait-online.. – saiarcot895 Jul 23 '15 at 0:12/etc/network/interfaces, systemd.networkfiles, or NetworkManager? – saiarcot895 Jul 23 '15 at 0:18network-online.targetandnetwork.targetare triggered right afterifup. I use debian default, so/etc/network/interfaceswith dhcp address. It looks like networkd could be better solution, but it's not straightforward to implement. – 10robinho Jul 23 '15 at 0:24