You are not logged in.

#1 2013-04-25 22:40:50

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Checkip - Notify yourself when a server's external IP changes.

Checkip is simple (and lightweight) script that checks to see if your external IP address changed and if so sends an email with the new IP address.  Useful if you manage remote boxes whose external IP addresses change periodically.  The only dependencies are curl and either mailsend or heirloom-mailx.

Tested with my free gmail account and works great.  As always, feedback is welcomed.  Plz comment here or send a pull request if you can improve the code.

Upstream URL: https://github.com/graysky2/checkip
AUR Package: https://aur.archlinux.org/packages/checkip

Last edited by graysky (2013-09-21 13:34:30)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2013-04-25 22:50:57

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Checkip - Notify yourself when a server's external IP changes.

I was really surprised that you had 5 votes on the AUR page just after posting this, until I noticed the "first submitted" date. wink

Incidentally, the checksum needs to be updated.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2013-04-25 23:10:38

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Checkip - Notify yourself when a server's external IP changes.

@Xyne - Yeah, I wrote this a few years ago with the version 1.x series using a perl script for mail sending but I found it [the perl script] to be unreliable in a few cases and looked elsewhere; version 2.x keeps the underlying code base but has been updated to use mailsend which seems more robust to me and also offers more sophisticated authentication options.

Last edited by graysky (2013-04-27 12:32:30)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2013-04-25 23:34:35

vitor14
Member
From: /dev/urandom
Registered: 2013-04-19
Posts: 15

Re: Checkip - Notify yourself when a server's external IP changes.

Nice script! The address http://icanhazip.com gives your external IP in plain-text format (not a single HTML tag). Maybe you could cross-check the values from both websites to increase your confidence that no one is lying (who knows these days...)

Offline

#5 2013-04-27 12:38:57

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Checkip - Notify yourself when a server's external IP changes.

@vitor - Thanks for link. It could simplify the code but strategically, I would like to avoid an external service all together.  Does anyone have a suggestion to find the external IP address without relying on an external website?  Tools like /usr/sbin/ip will only return the internal IP address to my knowledge.

Last edited by graysky (2013-04-27 12:41:09)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2013-04-27 13:03:46

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,543

Re: Checkip - Notify yourself when a server's external IP changes.

curl ifconfig.me

Offline

#7 2013-04-27 13:05:26

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Checkip - Notify yourself when a server's external IP changes.

skunktrader wrote:
curl ifconfig.me

Right but this is invoking an external webserver... I'd like to do it without this need.  I have been poking around in the iproute2 package but haven't found anything.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#8 2013-04-28 06:16:27

vitor14
Member
From: /dev/urandom
Registered: 2013-04-19
Posts: 15

Re: Checkip - Notify yourself when a server's external IP changes.

graysky wrote:

Does anyone have a suggestion to find the external IP address without relying on an external website?

I think you will only be able to get the information you are looking for directly from your modem or from external servers. From inside my network I am able to telnet to my modem and run ifconfig, which has an interface called ppp_something displaying the external IP address. I can also accomplish the same by parsing the http interface, and this thread contains some related information. However allowing the perl script to handle all types of modem would probably require user input, at least the first time the script was run on that system.

Offline

#9 2013-04-28 11:53:19

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Checkip - Notify yourself when a server's external IP changes.

Thank for the link.  As you pointed out, I too think that presented too much complicity.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#10 2013-09-21 12:59:34

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Checkip - Notify yourself when a server's external IP changes.

Updated to v3.01 this morning which includes support for mailx via heirloom-mailx.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#11 2014-01-10 21:17:53

lakechfoma
Member
Registered: 2014-01-10
Posts: 2

Re: Checkip - Notify yourself when a server's external IP changes.

There's a way to use a DNS server here. dnsutils contain dig.

Offline

#12 2014-01-10 23:30:04

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Checkip - Notify yourself when a server's external IP changes.

lakechfoma wrote:

There's a way to use a DNS server here. dnsutils contain dig.

Thank you for that link.  Updated.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB