MikroTik Wiki:Community Portal

From MikroTik Wiki
Jump to: navigation, search

Below is a simple script I created in order to connect to a PPtP Server with a Dynamic IP Address.

1) Change the vpn-interface-name to the name of your PPtP interface (default pptp-out1)

2) Change the vpn-dns-name to your Dynamic DNS address (eg demo.changeip.net)

3) Add a schedule to run the script as often as needed.


SCRIPT:


global vpn-interface-name "<PPtP Interface Name>"
global vpn-dns-name "<demo.changeip.net>"


global new-vpn-ip [:resolve $vpn-dns-name]
global current-vpn-ip [/interface pptp-client get $vpn-interface-name connect-to]
if ($current-vpn-ip != $new-vpn-ip) do={/interface pptp-client set [find name=$vpn-interface-name] connect-to=$new-vpn-ip}