Community discussions

MikroTik App
just joined
Topic Author
Posts: 2
Joined: Tue Dec 04, 2018 9:55 am

backup internet connection - mikrotik as wifi client and backup over LTE openVPN

Mon Sep 09, 2019 4:56 pm


I have a Mikrotik LTE router installed in a vehicle. The vehicle moves between several locations. There is a wifi with the same SSID in the each location.

I would like to setup my router as follows: when in reach of wifi connect to the wifi (as client), when on the road use openVPN over LTE. I have read some articles, but all uses static IP addresses, however I will have different ip addresses on wlan interface according to where the vehicle connects. I will try to write a script, which would disable LTE interface when connected to wifi, but maybe there is a better solution.
Any advice welcome :-)
Member Candidate
Member Candidate
Posts: 106
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: backup internet connection - mikrotik as wifi client and backup over LTE openVPN

Tue Sep 10, 2019 12:03 am

Instead of a script, you could try to set the "default route distance" in the LTE APN to something higher than 1, say 2, than the DHCP client used by the Wi-Fi interface. What should happen is if the Wi-Fi client interface gets a DHCP address, it would have distance of 1 (the default), and the Mikrotik would use the Wi-Fi route. Since the LTE route is up all the time, it would be only used if the default route from Wi-Fi wasn't there since it have a distance of 2. Mikrotik, like most routers, will use the route with the lowest distance first. Also, the IP route does support a "check gateway" that would take the route offline if there wasn't a connection, but I think a Wi-Fi client interface would be disabled if it's not connected to AP, and thus the route disappear without needing a check gateway setting.

With this scheme, you wouldn't need a VPN if you didn't mind some IP reconnections in your clients when you went from LTE to Wi-Fi - most of the time, this isn't a big deal. But you can use a VPN in the above scheme too, the VPN connection follow the IP distance as noted above...and in theory, long duration connection would not drop when you switched from LTE to/from Wi-Fi since the traffic would be tunnel. Although, I'd try without the VPN first, since you'd get 80%+ of what you'd want by just setting the default route distance.

Who is online

Users browsing this forum: Baidu [Spider], cyon, eworm, Google [Bot], philipaps and 156 guests