VPN for specific WAN using Multi-WAN

I have configured Multi-WAN in failover mode on the Flint (GL-AX1800) and I would like to configure the VPN to be used with only one of these WAN connections. Is this possible through the GUI or do I need to tinker around with OpenWRT/luci?

1 Like

Hey :wave:

definitely something for more advanced users so you will have to with luci instead of the standard GUI.

I am not even sure if there is a proper way to configure it. I would assume it involves manually routing, firewalling and stuff. Maybe some other users know more.

Thanks for the response @admon. Guess I have some reading to do

if you use 2 wans and activate the VPN, the first connection will be used and there will be no load balance effect

@marcowireless I’m using it in failover mode

Hey, I'm interested in this matter as well. I have my own broadband which is connected to Ethernet and my work internet via Wi-Fi. I have set-up the Multi WAN and it works well but I also would like to use VPN automatically when the work internet is in use and no VPN when my own broadband. I believe my goal is the same as yours.

Okay, playing around the interface and CLI, I found the solution for my problem. The key for me is in the /etc/mwan3.user. I added some code to it, pretty bare but it does the job.
Straight after the headline comments:

# Handle `disconnected` action on interface "wan"
if [ "$INTERFACE" = "wan" ] ; then
   if [ "$ACTION" = "disconnected" ]; then
       mcu_send_message "Turning WG ON" "wireguard"
       flock /var/lock/gl-switch.lock "/etc/gl-switch.d/wireguard.sh" "on" &
   elif [ "$ACTION" = "connected" ]; then
       mcu_send_message "Turning WG OFF" "wireguard"
       flock /var/lock/gl-switch.lock "/etc/gl-switch.d/wireguard.sh" "off" &
   fi
fi


I came to this final solution after many many detailed steps but at the end, 1 line does the whole job, no need to tinker with interfaces and ifups and downs. So this is it for me.
The button gave me the solution, which does this by flipping it left or right. I just checked the code for that and voila.