Suppose that you want to stay always connected to a vpn server which has a dynamic ip, using Mikrotik RouterOS
Lets say that we want to connect to the vpn server test.no-ip.biz via a mikrotik vpn client interface named pptp-out1. The problem with mikrotik is that it accepts the domain name and resolves it but only for the first time. So, if the server changes ip, the vpn connection is history. So we want a slave to check when the server changes ip and pass it to vpn client interface.
So, here is the slave :)
Just go System -> Scripts -> Add and give the following code
Source
(be sure to include the ” : ” at the beginning of each line, except if you want to start scratching your head wondering what the $#%@ is wrong - I promise to write a more detailed guide to mikrotik scripting another time)
After finishing check that the script runs fine by hitting run script and that the run counter increases by 1.
So, now its time to add it to the scheduler.
System -> Scheduler ->Add
Give a name, start date, start time and set the interval to a frequency depending on the severity of the link (the highest, the greatest) (a zero interval mean no scheduling - just 1 execution and thats all)
On event give :
/system script run “THE NAME OF THE SCRIPT EXACTLY”otherwise the scheduler goes to Bahamas for holidays :P
So simple… :)