Is there any way to set priority of network interfaces at bootup?
auto lo
iface lo inet loopback
#iface eth0 inet manual
auto eth0
iface eth0 inet static
address 192.168.10.1
netmask 255.255.255.0
auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
metric 0
auto zzzwg0
iface zzzwg0 inet static
pre-up /sbin/ip link add dev zzzwg0 type wireguard
post-up /usr/bin/wg setconf zzzwg0 /home/pi/zwg0.conf
post-up /sbin/ip route add 192.168.2.0/24 dev zzzwg0
post-down /sbin/ip link del zzzwg0
address 192.168.5.1
netmask 255.255.255.0
The problem: Wireguard (zzzwg0) interface needs a working internet connection (which is coming from wlan0).
Man page says: There can be multiple "auto" stanzas. ifup brings the named interfaces up in the order listed. But from boot log I see that this is not true. Armbian first tries to bring up my zzzwg0 interface and then wlan0:
Sep 24 14:02:18 raspberrypi3 kernel: wireguard: loading out-of-tree module taints kernel.
Sep 24 14:02:18 raspberrypi3 kernel: wireguard: WireGuard 0.0.20170918-12-gce3a380 loaded. See www.wireguard.com for information.
Sep 24 14:02:18 raspberrypi3 kernel: wireguard: Copyright (C) 2015-2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
Sep 24 14:02:18 raspberrypi3 networking[273]: Configuring network interfaces...Name or service not known: `nana.mihalko.eu:500`
Sep 24 14:02:18 raspberrypi3 networking[273]: Configuration parsing error
Sep 24 14:02:18 raspberrypi3 networking[273]: Failed to bring up zzzwg0.
Sep 24 14:02:18 raspberrypi3 networking[273]: done.
Sep 24 14:02:18 raspberrypi3 systemd[1]: Started LSB: Raise network interfaces..
...
Sep 24 14:02:18 raspberrypi3 wpa_supplicant[366]: wlan0: Trying to associate with freq=2437 MHz)
Sep 24 14:02:18 raspberrypi3 avahi-daemon[441]: Found user 'avahi' (UID 105) and group 'avahi' (GID 110).
Sep 24 14:02:18 raspberrypi3 avahi-daemon[441]: Successfully dropped root privileges.
Sep 24 14:02:18 raspberrypi3 avahi-daemon[441]: avahi-daemon 0.6.31 starting up.
Sep 24 14:02:18 raspberrypi3 wpa_supplicant[366]: wlan0: Associated with
Sep 24 14:02:18 raspberrypi3 wpa_supplicant[366]: wlan0: WPA: Key negotiation completed with [PTK=CCMP GTK=CCMP]
Sep 24 14:02:18 raspberrypi3 wpa_supplicant[366]: wlan0: CTRL-EVENT-CONNECTED - Connection to completed [id=0 id_str=]
Is there any way to wait for setting up zzzwg0 until wlan0 is connected to the network?