FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
767 views 1 comments
by

I have a problem were I need to know if a device is connected on WIFI or Mobile. I would like to setup 2x OpenVPN connections, one to only be used when connected on WIFI and the other when connected by Mobile. The 2 OpenVPN will have different IP ranges so on the OpenVPN server end I can tell what type of connection I have to the remote device before downloading data from it as I only want to download large amounts of data when on WIFI. I have currently got to the point where I have 2 OpenVPN clients that connect to the server but am stuck trying to restrict WIFI to using one tunnel and Mobile using the other. I don’t know if anyone can help with this problem.

1 Answer

+1 vote
by anonymous

Hello,

You can try to specify pseudo server address for each openvpn configuration, do DNAT in firewall and if source interface is wifi do DNAT to server IP. Same with mobile.
So your tunnel will be available if interface is alive.
In example:
Mobile VPN:
iptables -o wwan0 -d 1.0.0.1 DNAT to "server IP"
WIFI VPN:
iptables -o wlan0 -d 1.0.0.2 DNAT to "server IP"
by anonymous
save two profiles "OnMobile", "OnWifi"
Switch between them either manually from the gui, via SMS , or geofenced GPS
to trigger an SMS message to the routers own number to switch the profile.

Before I fitted an "all you can eat" SIM I used to do geofenced "OnRoad" , "OnDriveway" , "AtOffice"