Community discussions

MikroTik App
 
mschulz
just joined
Topic Author
Posts: 1
Joined: Mon Apr 20, 2009 1:55 pm

DNS Names for PPTP

Mon Apr 20, 2009 2:12 pm

Hi All,

i run a MT Router that must permanently connect as PPTP client to a private PPTP Server. This private server changes every day its public IP adress due to the ISP. So I made a dynDNS account for it.

The problem is, that the PPTP client "connect-to" only accepts plain IP adresse and no DNS Names. So the client disconnects every time the server changes its IP address and i have to set the new connection IP for the client manually.

Is there a workarround for this problem?

Thanks alot, Marco.
 
User avatar
NAB
Trainer
Trainer
Posts: 542
Joined: Tue Feb 10, 2009 4:08 pm
Location: UK
Contact:

Re: DNS Names for PPTP

Mon Apr 20, 2009 2:20 pm

I'll second that request - I have exactly the same problem with NTP.

We use the ntp.org pool service, so I'd like to set primary and secondary NTP to:

0.uk.pool.ntp.org
1.uk.pool.ntp.org

However, I can't!

Nick.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7054
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: DNS Names for PPTP

Mon Apr 20, 2009 2:29 pm

run scheduled script that is resolving ip address and tehen comparing it with currently set ntp or pptp address. If it is not the same replace it.
 
User avatar
NAB
Trainer
Trainer
Posts: 542
Joined: Tue Feb 10, 2009 4:08 pm
Location: UK
Contact:

Re: DNS Names for PPTP

Mon Apr 20, 2009 3:43 pm

OK. First time at a script more than one line long! Seems to work, but can somebody sanity check this?
:local ntpaip [:resolve "0.uk.pool.ntp.org"];
:local ntpbip [:resolve "1.uk.pool.ntp.org"];

:local ntpcura [/system ntp client get primary-ntp];
:local ntpcurb [/system ntp client get secondary-ntp];

:if ($ntpaip != $ntpcura) do={
    /system ntp client set primary-ntp="$ntpaip";
    }

:if ($ntpbip != $ntpcurb) do={
    /system ntp client set secondary-ntp="$ntpbip";
    }
My main concern is that I usually do all sorts of paranoid checks on values, but after having read the scripting documentation, I can't see how to:
  • 1 - Make a log entry if either of the ':resolve' commands fail.
    2 - Check that what's returned is reasonably valid (simple regex to exclude known invalid addresses - e.g. 0.0.0.0, 127.0.0.0/8, 192.168.0.0/16 etc.)
    3 - Probably some other things somebody else will pick up on!
So, what do you think?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7054
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: DNS Names for PPTP

Mon Apr 20, 2009 4:00 pm

Your script looks good.

1- script will stop instantly if :resolve fails, so it is not possible to write log if it fails. In v4.0 it will be fixed
2- v3.23 has new operator '~' that does exactly what you need
http://wiki.mikrotik.com/wiki/Scripting#Other_Operators
 
User avatar
NAB
Trainer
Trainer
Posts: 542
Joined: Tue Feb 10, 2009 4:08 pm
Location: UK
Contact:

Re: DNS Names for PPTP

Mon Apr 20, 2009 6:08 pm

Since I've just got the e-mail to say 3.23 is available, I'd better try it!
 
User avatar
hilton
Long time Member
Long time Member
Posts: 634
Joined: Thu Sep 07, 2006 5:12 pm
Location: Jozi (aka Johannesburg), South Africa

Re: DNS Names for PPTP

Mon Apr 20, 2009 6:54 pm

Since I've just got the e-mail to say 3.23 is available, I'd better try it!
Great stuff, let us know please.
 
User avatar
NAB
Trainer
Trainer
Posts: 542
Joined: Tue Feb 10, 2009 4:08 pm
Location: UK
Contact:

Re: DNS Names for PPTP

Wed Apr 22, 2009 2:11 pm

Not got as far as using Regexes, but I've put the NTP pool script up on http://wiki.mikrotik.com/wiki/Scripting-examples

Nick.
 
User avatar
hilton
Long time Member
Long time Member
Posts: 634
Joined: Thu Sep 07, 2006 5:12 pm
Location: Jozi (aka Johannesburg), South Africa

Re: DNS Names for PPTP

Wed Apr 22, 2009 2:50 pm

thanks for this Nick. Good stuff.

Who is online

Users browsing this forum: mtkvvv and 116 guests