How to change dynamic IP address ( using Node-RED?


I would like to create a Node-RED flow which allows me to change my dynamic IP address ( to a new IP address as my ISP is regularly changing the WAN IP address of my router.

I already figure out how to automatically detect that my routers WAN IP address changed and I can easily manually change the IP address by entering the following URL in a browser:

After I have entered the above in the browser, I get a screen in which I need to enter my user name and password.

The following page explains the actual API of

So I only need to know how to create a Node-RED flow that allows me to change my dynamic IP address to another specific IP address in a secure way.


In managed to get it working by using a http request node and by specifying the user name and the password in the URL (see screenshot above). For this I had to use the query string parameters "u=" and "p=" for the user name and the password.

Note that It didn't work when I selected "Use Basic Authentication" and specified the user name and the password there instead of in the URL. In that case I got following 401 HTTP response:

{"_msgid":"4587d1ac.fea2","topic":"","payload":"401 Access Denied - Failed to Authenticate (0)","statusCode":401,"headers":{"date":"Sun, 21 Oct 2018 12:08:35 GMT","server":"Apache","x-powered-by":"PHP/5.6.36","www-authenticate":"basic realm="DDNS"","cache-control":"max-age=2592000","expires":"Tue, 20 Nov 2018 12:08:35 GMT","vary":"Accept-Encoding","content-length":"46","connection":"close","content-type":"text/plain;charset=UTF-8","x-node-red-request-node":"eb2849ee"},"responseUrl":""}


I am certainly not the expert to be asking, or answering your question, but... why do you want to change your dynamic IP address? And which IP? The one assigned by your ISP or your local network? The logic escapes me.

Hi Jan,

Glad you got it working. For completeness I use which also works fine. And when the update of my new IP address on duckdns fails for some reason, I send a mail to myself with the new IP address. Then at least I can logon via the new URL in my mail. My wife always says 'trust is good, but control is better ...' :face_with_raised_eyebrow:

Thanks for sharing the solution !

I don't want to change it - it is my ISP that is reassigning from time to time a new WAN IP address to my internet router. If this happens I have to change also the IP address that is linked to my hostname that is managed by

Thanks for the comment.

I have configured it a bit similar but instead of sending a mail it will post a comment in my slack workspace that specifies the success or failure of the change.

The whole idea of a dynamic DNS is that you don't need to care what your public IP is. If your ISP changes your public IP, your Dynamic DNS host should pick up your new IP fairly quickly.

1 Like

Hi Steve,

It is not really working like that. A DDNS host provider (like will not detect and automatically change the IP address of my public hostname if my ISP has changed the IP address of my WAN router.

Some WAN routers support Dynamic DNS (or at least some DDNS host providers) which means that you can configure those routers so that they will automatically detect if their WAN IP address changes and in that case they will request the DDNS host provider to change the IP address of your public hostname. The problem in my case that my WAN router doesn't work with the DDNS provider so therefore I did this in a Node-Red flow.

1 Like appear to have an api to update your IP address. See

Could you -

  • within node-RED, check your IP address say every 10 minutes.
  • on first run, save your IP to context, thereafter compare your IP address with context.
  • if it's the same - do nothing
  • if it's different (IP has changed), then send your new IP to the api to update your new IP by using a http request node.
  • save your new IP address back to context.


1 Like

And while you are at it, why not update your LAN DNS with the new address so that you can use the same IP name internally as externally. I'm now doing that at home so that I can use Let's Encrypt certificates. In my case, my WAN IP address is fixed thanks to an enlightened ISP but all I have to do is update the hosts file on my router. I use the router for LAN DNS.

Hi Paul,
Thanks for your advice that is exactly what I am doing.

Hi Julian,

I admit that your comment is not fully clear to me.
I am also not using "Let's Encrypt certificates" so I do not immediately see the benefit.


Sorry, maybe that was a side-track - all I was saying was that if you set things up right, you can use the same IP name whether you are on the internal network or an external one.

Evening Jan,

Last week a new contribution node-red-contrib-ip has been published on NPM. I use that one now in my flow to get the current WAN ip address. This way my flow looks a bit cleaner ...



You could also feed the ip address through a RBE node, it will only get sent if it changes.

This page has a download of a script ( that will update your ip for you. Download that, fill in your user name and so on, and run it every 5 or 10 minutes using cron (or from node-red if you prefer) and that should do it.

1 Like