# How to change dynamic IP address (changip.com) using Node-RED?

**URL:** <https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164>\
**Category:** General\
**Created:** [21 October 2018 11:03 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164 "2018-10-21T11:03:07Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [21 October 2018 11:03 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/1 "2018-10-21T11:03:07Z")

</div>

Hi,

I would like to create a Node-RED flow which allows me to change my dynamic IP address ([changeip.com](http://changeip.com)) 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:

> [http://nic.changeip.com/nic/update?hostname=bo....onmypc.org&amp;myip=81.241.37.232](http://nic.changeip.com/nic/update?hostname=bo....onmypc.org&amp;myip=81.241.37.232)

After I have entered the above in the browser, I get a screen in which I need to enter my [changeip.com](http://changeip.com) user name and password.

The following page explains the actual API of [changeip.com](http://changeip.com):  
[DDNS API Information - Knowledgebase - ChangeIP, Inc.](https://www.changeip.com/accounts/knowledgebase.php?action=displayarticle&id=34)

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.

Jan

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [21 October 2018 12:06 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/2 "2018-10-21T12:06:39Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f4a543ffbf5ee0f5fe47a9bfc82149db6090308f.png)

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":"[https://nic.changeip.com/nic/update?hostname=boXXXXXX.onmypc.org&myip=87.67.108.163](https://nic.changeip.com/nic/update?hostname=boXXXXXX.onmypc.org&myip=87.67.108.163)"}

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [21 October 2018 21:20 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/3 "2018-10-21T21:20:09Z")

</div>

Why?

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.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [21 October 2018 21:32 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/4 "2018-10-21T21:32:17Z")

</div>

Hi Jan,

Glad you got it working. For completeness I use [duckdns.org](http://duckdns.org) 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 .._.' 🤨

Thanks for sharing the solution !  
Bart

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [21 October 2018 22:13 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/5 "2018-10-21T22:13:05Z")

</div>

> [@SteveMann](#):
>
> Why?
> 
> 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.

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 [changeip.com](http://changeip.com).

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [21 October 2018 22:15 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/6 "2018-10-21T22:15:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [22 October 2018 03:08 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/7 "2018-10-22T03:08:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [22 October 2018 07:14 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/8 "2018-10-22T07:14:05Z")

</div>

> [@SteveMann](#):
>
> 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.

Hi Steve,

It is not really working like that. A DDNS host provider (like [changeip.com](http://changeip.com)) 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 [changeip.com](http://changeip.com) DDNS provider so therefore I did this in a Node-Red flow.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [22 October 2018 08:10 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/9 "2018-10-22T08:10:56Z")

</div>

[changeip.com](http://changeip.com) appear to have an api to update your IP address. See [https://www.changeip.com/accounts/knowledgebase.php?action=displayarticle&id=34](https://www.changeip.com/accounts/knowledgebase.php?action=displayarticle&id=34)

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 [changeip.com](http://changeip.com) api to update your new IP by using a `http request` node.
- save your new IP address back to context.

Paul

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 October 2018 08:30 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/10 "2018-10-22T08:30:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [22 October 2018 08:33 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/11 "2018-10-22T08:33:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [22 October 2018 08:41 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/12 "2018-10-22T08:41:55Z")

</div>

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.

Jan.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 October 2018 15:26 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/13 "2018-10-22T15:26:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [5 November 2018 19:21 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/14 "2018-11-05T19:21:35Z")

</div>

Evening Jan,

Last week a new contribution [node-red-contrib-ip](https://github.com/okhiroyuki/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 ...

Bart

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [5 November 2018 20:43 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/15 "2018-11-05T20:43:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 November 2018 21:29 UTC](https://discourse.nodered.org/t/how-to-change-dynamic-ip-address-changip-com-using-node-red/4164/16 "2018-11-05T21:29:01Z")

</div>

> [@janvda](#):
>
> 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.

This page has a download of a script (Rinker.sh) 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.

[https://www.changeip.com/accounts/downloads.php?action=displaycat&catid=4](https://www.changeip.com/accounts/downloads.php?action=displaycat&catid=4)
