This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

dyndns.org
#1
Hello, I would to know if it's possible to send public IP to services like dyndns.org when public IP changes, thank you very much.
Reply
#2
(06.04.2016, 13:58)josep Wrote: Hello, I would to know if it's possible to send public IP to services like dyndns.org when public IP changes, thank you very much.

Check here:
http://forum.logicmachine.net/showthread.php?tid=159
Reply
#3
Most dynamic DNS services can be updated via a simple HTTP request.

Example for Duck DNS (https://www.duckdns.org). Add this code to a scheduled script with run frequency tuned to how often your IP can change.
Code:
domain = 'logicmachine'
token = '12345678-1234-1234-1234-123456789012'
require('ssl.https').request('https://www.duckdns.org/update?domains=' .. domain  .. '&token=' .. token .. '&ip=')
Reply
#4
I use DynDNS account and I find this information, if I need update via HTTP but not HTTPS the expression is require (ssl.hhtps) or anothrer, thank you

https://help.dyn.com/remote-access-api/perform-update/
Reply
#5
(06.04.2016, 15:25)josep Wrote: I use DynDNS account and I find this information, if I need update via HTTP but not HTTPS the expression is require (ssl.hhtps) or anothrer, thank you

https://help.dyn.com/remote-access-api/perform-update/

I beleive it will work with https. Bonus is that it's much more secure than http.

Just tested this 
Code:
http://username:password@members.dyndns.org/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
https://username:password@members.dyndns.org/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
And both gives the same correct result: badauth

When updating any dynamic DNS service make sure you are sending update only when the IP is changed. Many will ban/suspend the account if the update is to frequent. Use the sample from the first link to determine if the IP was changed - only then send the update with the second sample. By this method you can get the fastest possible refresh without risking a much longer delay.
Reply
#6
DynDNS also requires this:
Quote:All clients must send a well-formed user agent that includes company name, model number, and software build revision.

It can be done for both HTTP and HTTPS requests like this (after require):
Code:
socket.http.USERAGENT = 'EMBS - LogicMachine - 1'
Reply
#7
thank you, It works fine!
Reply
#8
(10.04.2016, 16:48)josep Wrote: thank you, It works fine!

Hey Josep,

Can you post your solution for future reference? Don't forget to delete your key and user data before that.
Reply
#9
require('socket.http')

socket.http.timeout = 60

data = socket.http.request('http://checkip.dyndns.org/')


if not data then
log('No se puede comprobar la IP externa')
return
end

wan = "(%d+).(%d+).(%d+).(%d+)"
wan = string.sub(data, string.find(data, wan))
log(wan)

wanip = storage.get('wan_ip')


if wanip == nil then wanip = "0.0.0.0"
storage.set('wan_ip', wanip)
else

if wanip == wan then
--do nothing
else

subject = 'Nova IP: ' .. wan .. ''
message = 'La direcció IP ha canviat: http://' .. wan .. ':8080'
mail('mail@mail.com', subject, message)
--log("La nova IP publica externa es : " .. wan)
alert("La IP publica actual es: " .. wan) --ver registro alertas para cambios de IP
storage.set('wan_ip', wan)
log("S,envia mail. Nova IP: " .. wan)



require('ssl.https').request('https://user:password@members.dyndns.org/nic/update?hostname=name.dyndns.org&myip=' .. wan .. '&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG')


end
end

wan = storage.get('wan_ip')
log("La IP publica actual es: " .. wan)
Reply
#10
How can I add to my script WAN IP address?

I want to communicate with dnsdynamic.org to update my IP address.

Command:
https://login:password@www.dnsdynamic.or...=127.0.0.1

I must change myip to WAN IP.

I tried to do this based on the above example:
Code:
require('socket.http')
socket.http.timeout = 60

wan = socket.http.request('http://myip.dnsdynamic.org/')
log(wan)

require('ssl.https').request('https://buuuudzik@gmail.com:vl!45z8N@www.dnsdynamic.org/api/?hostname=house01.ddns01.com&myip=' .. wan)


I have an error:
Line 0: bad argument #2 to 'connect' (number expected, got string)

Do you what is the problem?
Reply
#11
Code:
ip = require('socket.http').request('http://myip.dnsdynamic.org/')
if ip then
  require('ssl.https').request('https://login:password@www.dnsdynamic.org/api/?hostname=your_hostname&myip=' .. ip)
end
Reply
#12
(09.08.2016, 09:11)admin Wrote:
Code:
ip = require('socket.http').request('http://myip.dnsdynamic.org/')
if ip then
 require('ssl.https').request('https://login:password@www.dnsdynamic.org/api/?hostname=your_hostname&myip=' .. ip)
end

Unfortunately this error is still appearing on my Error listSad

I tried disable and enable the script.
Reply
#13
Since your username has '@', it confuses the url parser. You can do your request like this:
Code:
ip = require('socket.http').request('http://myip.dnsdynamic.org/')
if ip then
  auth = require('mime').b64('USERNAME:PASSWORD')
  host = 'xyz.ddns01.com'

  log(require('ssl.https').request({
    url = 'https://www.dnsdynamic.org/api/?hostname=' .. host .. '&myip=' .. ip,
    headers = { authorization = 'Basic ' .. auth }
  }))
end
Reply
#14
Dear all,
As dnsdynamic.org stopped working recently, I suggest you to replace it with http://checkip.amazonaws.com/.
Works fine for me.
BR


Code:
ip = require('socket.http').request('http://checkip.amazonaws.com/')
Reply


Forum Jump: