What would be the easiest way to find, with a script, if my IP address has changed?
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.