Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-19-2013, 09:58 PM   #1
Registered: May 2007
Location: North Carolina
Distribution: RHEL 7, CentOS7
Posts: 77

Rep: Reputation: 18
Ubuntu Server needs to inform me of a new IP address when it changes

I am running an Ubuntu gaming server on my home network, behind a router and firewall. My ISP is Verizon, and my external IP address changes from day to day, rarely going a week the same. This makes it difficult for other people to access my server consistently, and requires me to get a complaint, go home, check my IP, and then tell them all. Verizon doesn't think I pay enough to have a static IP, and I agree.

How can I get Ubuntu to check what the external IP is, and then forward that information in the form of a text or email if the results have changed? I have rudimentary Ubuntu skills, and my reaction was to write a script checking the IP and then sending the updated address to an (e)mailing list of recipients. I would then have cron run the script every ten minutes or so.

1: Is that idea feasible?
2: Would someone help me write that script if so?
3: What is a better idea?
Old 04-19-2013, 11:07 PM   #2
Registered: Aug 2012
Location: USA
Distribution: Slackware64-14.2
Posts: 86

Rep: Reputation: 23
I use a similar script on a server at my house. There are a couple parts of the script that need to be set up first beforehand, like the mutt email program. Here is the script:

NEWIP=`curl; echo`
OLDIP=`cat /tmp/currentip`

if [[ "$NEWIP" != "$OLDIP" ]]; then
MESSAGE="`date +\"%m-%d-%Y_%R\"` Server's IP changed from $OLDIP to $NEWIP" echo $MESSAGE > /tmp/ipsmg mutt -F /home/casualfred/.muttrc -s "Server IP Change" $EMAILLIST < /tmp/ipmsg && echo $NEWIP > /tmp/currentip
Here is a handy guide for setting up mutt with gmail - it's pretty easy:

Here is another link about sending texts to your phone via email:

I found that since I have AT&T (but used to be Cingular) I can send texts to my phone by sending an email to or It would depend on your carrier.

So, there's some ideas for you
Old 04-20-2013, 03:23 AM   #3
Registered: Aug 2002
Posts: 16,028

Rep: Reputation: 1851Reputation: 1851Reputation: 1851Reputation: 1851Reputation: 1851Reputation: 1851Reputation: 1851Reputation: 1851Reputation: 1851Reputation: 1851Reputation: 1851
You can use a free dynamic IP service like dyndns or noip. Your URL (e.x. is updated with the IP address via a client that either is built into the router (typically dyndns) or runs on your server.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Server: Block all MAC address with exceptions Zanto Linux - Networking 13 05-04-2012 08:47 PM
IP address on static assigned ubuntu server keeps changing! dontworryaboutme Linux - Networking 8 03-30-2012 04:32 PM
Ubuntu Server ip address ansrewdps Linux - Newbie 21 04-13-2011 12:05 PM
Cannot connect to Ubuntu server through the internet after I fixed the IP address mrotsliah Linux - Server 1 06-22-2009 04:02 PM
No IP address from DHCP server on Ubuntu 6.06, 6.1, Knoopix, Fedoce 5 and SuSE 10.1 MatWab Linux - Wireless Networking 8 06-19-2007 05:44 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:27 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration