Mikrotik pptp, l2tp, eoip tunnel dns adress resolve script – VPN by domain name

Script is searching for interface by given name. It resolves dns name to ip addres, then checks if resolved ip addres is equal to address given in connect-to field of the interface. If ip address is different then script will update it to keep Your VPN connected to ip address given by a domain name.

—————– cut below —————

# Written by vberry.net
# tested on MT 4.17

:global InterfaceName „eoipPPTP”
:global VpnDnsName „eoip.vberry.net”
:log warning $InterfaceName
:global NewVpnIp [:resolve $VpnDnsName]
:global CurrentVpnIp [/interface pptp-client get $InterfaceName connect-to]

:if ($CurrentVpnIp != $NewVpnIp) do={/interface pptp-client set [find name=$InterfaceName] connect-to=$NewVpnIp};

Comments are closed.