Community discussions

MikroTik App
 
mTvGqH2
just joined
Topic Author
Posts: 4
Joined: Wed Jan 17, 2018 9:43 pm

Use specific internet connection for VPN client connection

Wed Jan 17, 2018 9:50 pm

I have 2 internet connections on my Mikrotik router.
To decide which is used for outgoing connections I use Mangle prerouting rules.
1st rule to add a Connection Mark to new connections and 2nd rule to add corresponding Routing Mark.
Finally I have different Routing tables.

Here comes my question:
My routing connects to a VPN server (free-nl.hide.me).
I want that a specific internet connection is used for that VPN connection.
How do I have to define my rule to catch this connection for adding a connection mark? I can't use the IP "dst. address" because it is not constant...

Any hints are welcome... Thanks !
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Use specific internet connection for VPN client connection

Wed Jan 17, 2018 9:58 pm

Step1: create a static host route to whatever IP address the VPN endpoint currently uses - make the GW be the preferred IP address. Place a useful comment on this route such as "VPN"
Step2: copy this route into all of your routing tables
Step3:
You could write a script that runs every minute and does a :resolve on your VPN peer's hostname, and then update the GW address of your static routes having the comment "VPN"
 
mTvGqH2
just joined
Topic Author
Posts: 4
Joined: Wed Jan 17, 2018 9:43 pm

Re: Use specific internet connection for VPN client connection

Tue Jan 30, 2018 1:05 pm

I also thought about a cyclic script solution similar to your suggestion... but I wondered if there isn't a "clean" solution for that problem.
What about the "Proxy" setting of the VPN connection. Maybe it's possible to abuse this for forcing a specific internet gateway!?
 
mTvGqH2
just joined
Topic Author
Posts: 4
Joined: Wed Jan 17, 2018 9:43 pm

Re: Use specific internet connection for VPN client connection

Sun Feb 11, 2018 11:55 am

Nobody an idea except of the scripting solution?

Who is online

Users browsing this forum: Bing [Bot], Kanzler and 181 guests