Skip to content

Instantly share code, notes, and snippets.

@Paul-Reed
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Paul-Reed/0bec4c91340ed18154be to your computer and use it in GitHub Desktop.
Save Paul-Reed/0bec4c91340ed18154be to your computer and use it in GitHub Desktop.
no-ip.com update client

This flow inspired by 'hovissimo' updates no-ip.com whenever your dynamic IP address changes.

The flow needs little explanation, it obtains your current public IP address via http://bot.whatismyipaddress.com/ but there are other services available - http://echoip.com/ and http://ipecho.net/plain and passes the result through a 'switch' node programmed only to accept data in the format of a IP address - regex validity check (thanks Nick). The IP address is then compared to the previous recorded IP address, and if they differ - then your new IP address will update the no-ip.com service to reflect the change.

The 'Test IP address' inject node simply injects an IP address into the flow to enable you to check that all is well. You could simply delete it if you wish.

The only node needing updating is the 'http response' node with your own no-ip.org details in the following format;

http://username:password@dynupdate.no-ip.com/nic/update?hostname=yourhost.no-ip.org&myip={{payload}}

where username:password are self explanatory (note the comma between the two), and hostname= your no-ip hostname (such as mysite.no-ip.org)

Further information about using no-ip.com with your own update client can be found at http://www.noip.com/integrate

Paul

[{"id":"deea5450.2115a8","type":"inject","name":"Get IP","topic":"ip","payload":"eth0","payloadType":"none","repeat":"300","crontab":"","once":false,"x":81,"y":393,"z":"7fc7e6a6.803818","wires":[["797671a6.86899"]]},{"id":"70afee7f.8f501","type":"function","name":"Compare IP","func":"context.lastip = context.lastip || 'initial';\nvar currentip = msg.payload;\n\nif (context.lastip == 'initial') {\ncontext.lastip = currentip;\n}\nelse if (context.lastip != currentip) {\nmsg.payload = currentip;\ncontext.lastip = currentip;\nreturn msg;\n}\n\n","outputs":"1","x":702,"y":394.5,"z":"7fc7e6a6.803818","wires":[["d4f456a4.2b0ba8"]]},{"id":"797671a6.86899","type":"exec","command":"wget -qO- http://bot.whatismyipaddress.com/ ; echo","append":"","useSpawn":"","name":"Call IP - whatismyipaddress.com","x":284,"y":393.5,"z":"7fc7e6a6.803818","wires":[["df21839f.20de8"],[],[]]},{"id":"df21839f.20de8","type":"switch","name":"Integrity check","property":"payload","rules":[{"t":"regex","v":"\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"},{"t":"else"}],"checkall":"true","outputs":2,"x":526,"y":393.5,"z":"7fc7e6a6.803818","wires":[["70afee7f.8f501"],[]]},{"id":"2c81c9c9.d37e36","type":"debug","name":"","active":true,"console":false,"complete":false,"x":712,"y":437,"z":"7fc7e6a6.803818","wires":[]},{"id":"d4f456a4.2b0ba8","type":"http request","name":"Update no-ip.com","method":"GET","url":"http://username:password@dynupdate.no-ip.com/nic/update?hostname=yourhost.no-ip.org&myip={{payload}}","x":531,"y":437,"z":"7fc7e6a6.803818","wires":[["2c81c9c9.d37e36"]]},{"id":"427821cd.bd87e","type":"inject","name":"Test IP address","topic":"","payload":"192.168.1.9","payloadType":"string","repeat":"","crontab":"","once":false,"x":526,"y":351,"z":"7fc7e6a6.803818","wires":[["70afee7f.8f501"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment