11
4
What would be the easiest way to find, with a script, if my IP address has changed?
Background info:
I have a standard home cable modem connexion, and my ISP assigns me a dynamic IP. It changes every now and then, the DHCP lease times seems irregular.
Basically, I'm doing my own dynamic DNS thing, and can update the DNS records pointing to my home server with a click. The only thing remaining is to detect an IP change so I can fully automate the process.
Now there are several websites here which can return your IP address, and I could use a cron job to wget
one of these pages and grep
the IP address from it... But it seems overkill in terms of CPU / bandwidth usage, and it's not very KISS.
Am I missing some simple and elegant way to retrieve my public IP and check if it has changed?
Extra info: my modem/router is a cheap brick, it does nothing very interesting in that regard. My server runs with Centos 6.
2
Also http://ifconfig.me/ip and https://wtfismyip.com/text
– Dmitry Fedorkov – 2017-08-31T19:55:44.793Good ideas and links. +1, if only for the icanhazip website that I did not know, and makes the downloading of extra HTML and parsing unnecessary. – Silver Quettier – 2013-03-06T14:54:36.760
1Or checkip.net-me.net/plain – Alex – 2013-03-06T15:44:59.500