Community discussions

 
kiutsitsu
just joined
Topic Author
Posts: 7
Joined: Mon Apr 25, 2016 3:56 pm

Forwar VPN through specific Dynamic Wan

Sat Aug 31, 2019 10:03 pm

Good evening,
As you read from the title i need help on that. I have one Mikrotik with two pppoe clients (Wan1 , Wan2) which are dynamic. I want the 1st Wan to be used for work and the 2nd Wan i want to be used for remote backup through VPN (L2tp) in another location again with Mikrotik and again with dynamic pppoe wan. If i take the dynamic ip of the remote location and put it directly in routes (dst addr = ip, Gateway = Wan2) of the 1st Mikrotik then it works fine. But Ip changes every day so i cant work with that.
Any ideas cause i'm out of them...

Thank you
 
Sob
Forum Guru
Forum Guru
Posts: 4527
Joined: Mon Apr 20, 2009 9:11 pm

Re: Forwar VPN through specific Dynamic Wan

Sun Sep 01, 2019 12:02 am

PPPoE can run scripts when it connects or disconnects, you can configure routes from there.

Manual (look for on-up and on-down): https://wiki.mikrotik.com/wiki/Manual:P ... r_Profiles
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
kiutsitsu
just joined
Topic Author
Posts: 7
Joined: Mon Apr 25, 2016 3:56 pm

Re: Forwar VPN through specific Dynamic Wan

Mon Sep 02, 2019 2:25 pm

Good evening
Thank you for the reply but i can't manage to understand your solution. Maybe i didnt explain correct.
Site1
Mikrotik
2 Wan (WAN1, WAN2) via PPPOE Client through internet provider that takes random ip from now and then (i want to use WAN2 for vpn)
Server

Site2
Mikrotik
1 Wan via PPPOE Client through internet provider that takes random ip from now and then
Nas

L2TP VPN
Site 1 L2tp Client via Mikrotik Cloud of site2 L2tp Server.
How can i use the pppoe Scipt for site 1 to renew route ip taken from Site 2?

Hope it is more clear now.
Thank you in advance
 
kiutsitsu
just joined
Topic Author
Posts: 7
Joined: Mon Apr 25, 2016 3:56 pm

Re: Forwar VPN through specific Dynamic Wan

Mon Sep 02, 2019 4:42 pm

Ok i made a new profile for VPN and added this script on up and worked.
-----
:log info "Starting VPN update"
:global RemoteIp [:resolve <<remote cloud>>]
:log info "New remote IP is $RemoteIp"
/ip route set 0 dst-address=$RemoteIp


Thank you
 
Sob
Forum Guru
Forum Guru
Posts: 4527
Joined: Mon Apr 20, 2009 9:11 pm

Re: Forwar VPN through specific Dynamic Wan  [SOLVED]

Mon Sep 02, 2019 8:04 pm

That's it. Only instead of using rule number directly, you may want to give the route some unique comment and use that to find it, i.e.:
/ip route set [/ip route find comment="my-route"] dst-address=$RemoteIp
That way it will work even if you make some changes in routes and this one will no longer be number 0.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
kiutsitsu
just joined
Topic Author
Posts: 7
Joined: Mon Apr 25, 2016 3:56 pm

Re: Forwar VPN through specific Dynamic Wan

Mon Sep 02, 2019 11:52 pm

You are the best. Thank you

Who is online

Users browsing this forum: No registered users and 11 guests