Page 1 of 1
disable VPN out interface when on 4G backup
Posted: Wed Jul 23, 2014 11:01 am
by Yogo
Hi all,
unsure where to put this, so it'll start here...
Basically I want to disable a PPTP outgoing interface when my main connection fails and starts routing through my 4G backup connection.
It would also be ideal if all my firewall rules changed interface name as well (if that's possible) ... pretty sure this will have to be done with some funky scripting.
Anyone know how to do either of these?
Any help is appreciated
Thanks
Re: disable VPN out interface when on 4G backup
Posted: Thu Jul 24, 2014 5:05 pm
by noib
Get a random IP internet address ( like
http://www.mikrotik.com 159.148.147.196 :p), or one of yours if you own one.
Add a route to force route to 159.148.147.196 via the 4G interface
Use netwatch tool to monitor connectivity to 159.148.147.196 ( = connectivity of 4G interface)
UP event script = disable VPN, change default route to 4G
DOWN event script: enable VPN, change default route to VPN
Re: disable VPN out interface when on 4G backup
Posted: Thu Jul 24, 2014 7:30 pm
by tavanajafar
HI
you can easily solve this problem without special Scripts.
you can have tow VPN Connection activate synchronously and have 2 Default route or any route for your destination but one for your General port and other route for your 4G Interface . The 4G Route must have distance Greater than distance field of general Interface route .
everything your general port has been disconnected, your router automatically switch to 4G port for transfer your trafic data and when come back your general port , traffic switched in general port for trawling in network !
(sorry sorry .... my language English is very bad
![Smile :)](./images/smilies/icon_smile.gif)
)
Re: disable VPN out interface when on 4G backup
Posted: Mon Jul 28, 2014 1:20 am
by Yogo
Hi all,
thanks for the replies.. but ...
what about the firewall rules? they are interface specific... how do i swap the interface in the firewall rules to the 4G interface when the main connection goes down?
Re: disable VPN out interface when on 4G backup
Posted: Tue Jul 29, 2014 3:18 pm
by Rudios
Hi all,
thanks for the replies.. but ...
what about the firewall rules? they are interface specific... how do i swap the interface in the firewall rules to the 4G interface when the main connection goes down?
Quick and dirty solution can be to duplicate all rules with both interfaces. Not the best and cleanest solution but can be workable.
Otherwise a script is needed to change all the relevant rules
Can be something like
ros code
/ip firewall filter set [/ip firewall filter find where in-interface=oldVPN] in-interface=newVPN
Re: disable VPN out interface when on 4G backup
Posted: Wed Jul 30, 2014 12:57 am
by Yogo
Many thanks Rudios! works a treat!