# PPP Dial-out server with dynamic ip address \[SOLVED\]

**URL:** <https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299>\
**Category:** General\
**Created:** [March 20, 2010, 4:48pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299 "2010-03-20T16:48:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![darengr](https://forum.mikrotik.com/letter_avatar/darengr/32/6_449c533f586939b6e5f246632a46421f.png) [@darengr](https://forum.mikrotik.com/u/darengr)\
**Post date:** [March 20, 2010, 4:48pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/1 "2010-03-20T16:48:43Z")

</div>

Hi,  
while I am trying to setup some pptp client interfaces, I need to specify the pptp server host with its dynamic dns name (server by [dyndns.org](http://dyndns.org)), and not the ip address, which is changing all the time by the host server ISP.  
In the winbox setup window (new interface, dial out tab, connect to field), I do indeed use the dyndns host name, but mikrotik resolves it immediatelly, to the current ip address.  
How can I keep this un-resolved, so whenever the link falls, it will make a dns lookup to find the current dynamic address and use it to dial out to the server?  
I searched a lot, but all I have found was the dyn dns update script and scheduler command (which is to update the dns service).  
Can anyone please help?  
thanks a lot!  
darengr

---

<div class="post-metadata">

**Author:** ![fewi](https://forum.mikrotik.com/letter_avatar/fewi/32/6_449c533f586939b6e5f246632a46421f.png) [@fewi](https://forum.mikrotik.com/u/fewi)\
**Post date:** [March 20, 2010, 4:53pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/2 "2010-03-20T16:53:36Z")

</div>

You can’t natively. You’ll have to adapt that dyndns to not update a dyndns record, but to instead change the IP address of the server in your configuration. Run it scheduled every 10 minutes or something.

---

<div class="post-metadata">

**Author:** ![darengr](https://forum.mikrotik.com/letter_avatar/darengr/32/6_449c533f586939b6e5f246632a46421f.png) [@darengr](https://forum.mikrotik.com/u/darengr)\
**Post date:** [March 20, 2010, 5:21pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/3 "2010-03-20T17:21:28Z")

</div>

> but to instead change the IP address of the server in your configuration

many thanks for quick reply, however, although I think I can moderatelly understand that script, how can I do the above? any references or hints as to where the info for the dial out host resides?  
regards!  
ps It could make an nice suggestion for the next version of router os. I have seen software that collects ip cams (that usually are on dynamic addresses) and it has a little tickbox to use dns, and you can type the un-resolved dns name, instead of the ip.

---

<div class="post-metadata">

**Author:** ![fewi](https://forum.mikrotik.com/letter_avatar/fewi/32/6_449c533f586939b6e5f246632a46421f.png) [@fewi](https://forum.mikrotik.com/u/fewi)\
**Post date:** [March 20, 2010, 5:37pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/4 "2010-03-20T17:37:53Z")

</div>

Something like this, completely untested:

```plaintext
:local serverName "edit.me.to.the.server.instance.name";
:global pptp-ip;
:if ([:typeof $pptp-ip] = "nothing" ) do={ :global pptp-ip 0.0.0.0/0 }
:local current [:resolve "pptp.dnsname.com"];
:if ($pptp-ip = $current) do={
  :log "No PPTP server IP address change necessary";
} else={
  /interface pptp-client set [/interface pptp-client find name="$serverName"] connect-to="$current";
  :global pptp-ip $current;
}

```

---

<div class="post-metadata">

**Author:** ![darengr](https://forum.mikrotik.com/letter_avatar/darengr/32/6_449c533f586939b6e5f246632a46421f.png) [@darengr](https://forum.mikrotik.com/u/darengr)\
**Post date:** [March 20, 2010, 5:52pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/5 "2010-03-20T17:52:10Z")

</div>

😃  
fewi, many-many thanks, I will try it as soon as possible and let you know whether it is ok!  
have a nice weekend and regards from athens!

---

<div class="post-metadata">

**Author:** ![darengr](https://forum.mikrotik.com/letter_avatar/darengr/32/6_449c533f586939b6e5f246632a46421f.png) [@darengr](https://forum.mikrotik.com/u/darengr)\
**Post date:** [March 20, 2010, 7:43pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/6 "2010-03-20T19:43:20Z")

</div>

Well, this was tested out fine! Here is my version (and my first script!):

```plaintext
:log info ("Start check for possible change of PPTP server dynamic IP address");
:local pptpServerDnsName "your.dynamicDnsName.com";
:local interfaceName "pptp-out1";
:global pptpserverip;
:if ([:typeof $pptpserverip] = "nothing" ) do={ :global pptpserverip 0.0.0.0/0 }
:local current [:resolve "$pptpServerDnsName"];
:log info ("$pptpserverip" . " vs " . "$current");
:if ($pptpserverip = $current) do={
  :log info ("No PPTP server IP address change necessary");
} else={
  /interface pptp-client set [/interface pptp-client find name="$interfaceName"] connect-to="$current";
  :log info ("PPTP server dynamic IP address changed from " . "$pptpserverip" . " to " . "$current" );
  :global pptpserverip $current;
}

```

Next I will try to schedule it. Hope this helps also somebody else, with dynamic addresses on the server side 😉  
Many thanks, fewi!  
darengr

---

<div class="post-metadata">

**Author:** ![oceanmaster](https://forum.mikrotik.com/letter_avatar/oceanmaster/32/6_449c533f586939b6e5f246632a46421f.png) [@oceanmaster](https://forum.mikrotik.com/u/oceanmaster)\
**Post date:** [July 15, 2010, 2:30pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/7 "2010-07-15T14:30:38Z")

</div>

Can somone please confirm this works and suggest any better coding / method?

---

<div class="post-metadata">

**Author:** ![Lominus](https://forum.mikrotik.com/letter_avatar/lominus/32/6_449c533f586939b6e5f246632a46421f.png) [@Lominus](https://forum.mikrotik.com/u/Lominus)\
**Post date:** [January 1, 2011, 3:23pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/8 "2011-01-01T15:23:45Z")

</div>

@ first i wish a Happy new Year at all 🙂

Here is an / script to resolve hostnames through the internet !

The Script works in ROS 4.16

```plaintext
/system script

add name=dyndns policy=\
    ftp,reboot,read,write,policy,test,winbox,password source="# Dynamic DNS Up\
    date / Simple Edition\r\
\n:global pptpinterfacename \"pptp-out1\"\r\
\n:global pptpdnsname \"dyndns.dyn.org\"\r\
\n:global pptpdnsip [:resolve \$pptpdnsname]\r\
\n:global currentip [/interface pptp-client get \$pptpinterfacename connect-to]\r\
\n:if (\$currentip != \$pptpdnsip) do={ /interface pptp-client set [find name=\$pptpinterfacename] connect-to=\$pptpdnsip}\r\
\n\r\
    \n}"

```

Please change pptpinterfacename default is “pptp-out1” and change the pptpdnsname what you will resolve !

And then set the sheduler.

That was all 🙂

Best regards

Lominus

---

<div class="post-metadata">

**Author:** ![spaxton](https://forum.mikrotik.com/letter_avatar/spaxton/32/6_449c533f586939b6e5f246632a46421f.png) [@spaxton](https://forum.mikrotik.com/u/spaxton)\
**Post date:** [June 14, 2011, 9:18pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/9 "2011-06-14T21:18:12Z")

</div>

Thank You all for many usefull posts in this topic. Thank You fewi for many usefull posts generally…

Best Regards!

---

<div class="post-metadata">

**Author:** ![oceanmaster](https://forum.mikrotik.com/letter_avatar/oceanmaster/32/6_449c533f586939b6e5f246632a46421f.png) [@oceanmaster](https://forum.mikrotik.com/u/oceanmaster)\
**Post date:** [August 7, 2011, 9:48pm UTC](https://forum.mikrotik.com/t/ppp-dial-out-server-with-dynamic-ip-address-solved/36299/10 "2011-08-07T21:48:41Z")

</div>

Yep, I have used this on many of my sites and works a charm,  
cheerz
