I have a gretap interface which connects to its peer via a Wireguard VPN interface. This is all technically working fine, but I'm running into an issue when the router reboots where the gretap interface seems to come up before the Wireguard interface which results in it creating a route to the gretap peer via the default WAN interface - which then prevents traffic going via the VPN.
The /etc/config/network for the two interfaces:
config interface 'wg5'
option proto 'wireguard'
option private_key '...'
list addresses '192.168.20.2/30'
config interface 'gretap1'
option proto 'gretap'
option ipaddr '192.168.20.2'
option peeraddr '192.168.20.1'
option zone 'none'
route output after normal startup (note the route created to the peer address 192.168.20.1):
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.68.1 0.0.0.0 UG 10 0 0 eth0.2
192.168.8.0 * 255.255.255.0 U 0 0 0 br-lan
192.168.20.0 * 255.255.255.252 U 0 0 0 wg5
192.168.20.1 192.168.68.1 255.255.255.255 UGH 10 0 0 eth0.2
192.168.68.0 * 255.255.252.0 U 10 0 0 eth0.2
If I disable the gretap interface and manually start it after the system has booted then the route to the peer isn't created, the output of route looks like this and everything works as expected:
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.68.1 0.0.0.0 UG 10 0 0 eth0.2
192.168.8.0 * 255.255.255.0 U 0 0 0 br-lan
192.168.20.0 * 255.255.255.252 U 0 0 0 wg5
192.168.68.0 * 255.255.252.0 U 10 0 0 eth0.2
Can anyone advise on the best way to handle this. Is there a config option to set the order that the interfaces come up, or to specifically tell it that the gretap should come up after the Wireguard interface? Or is there a gretap config option to tell it not to create a route to the peer?
Thanks