Community discussions

MikroTik App
 
Yogo
just joined
Topic Author
Posts: 23
Joined: Fri Oct 18, 2013 12:58 pm
Location: Sydney, Australia

disable VPN out interface when on 4G backup

Wed Jul 23, 2014 11:01 am

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
 
noib
Member Candidate
Member Candidate
Posts: 291
Joined: Fri Jan 25, 2013 6:04 pm
Location: France
Contact:

Re: disable VPN out interface when on 4G backup

Thu Jul 24, 2014 5:05 pm

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
 
User avatar
tavanajafar
just joined
Posts: 9
Joined: Thu Jul 24, 2014 5:32 pm

Re: disable VPN out interface when on 4G backup

Thu Jul 24, 2014 7:30 pm

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 :) )
 
Yogo
just joined
Topic Author
Posts: 23
Joined: Fri Oct 18, 2013 12:58 pm
Location: Sydney, Australia

Re: disable VPN out interface when on 4G backup

Mon Jul 28, 2014 1:20 am

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?
 
Rudios
Forum Veteran
Forum Veteran
Posts: 977
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: disable VPN out interface when on 4G backup

Tue Jul 29, 2014 3:18 pm

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
 
Yogo
just joined
Topic Author
Posts: 23
Joined: Fri Oct 18, 2013 12:58 pm
Location: Sydney, Australia

Re: disable VPN out interface when on 4G backup

Wed Jul 30, 2014 12:57 am

Many thanks Rudios! works a treat!