LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-19-2013, 10:58 PM   #1
JoseCuervo
Member
 
Registered: May 2007
Location: North Carolina
Distribution: Debian 8+, RHEL 7, Fedora22, CentOS7, Ubuntu 14.04
Posts: 74

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-20-2013, 12:07 AM   #2
casualfred
Member
 
Registered: Aug 2012
Location: USA
Distribution: Slackware64-14.2
Posts: 84

Rep: Reputation: 16
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:
Code:
#!/bin/bash

EMAILLIST="johnboy@yahoo.com jeff@gmail.com 8829833382@txt.att.net"
NEWIP=`curl http://ipecho.net/plain; 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
fi
Here is a handy guide for setting up mutt with gmail - it's pretty easy:
http://lifehacker.com/5574557/how-to...ent-with-gmail

Here is another link about sending texts to your phone via email:
http://www.email-unlimited.com/stuff...l-to-phone.htm

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 mynumber@txt.att.net or mynumber@cingularme.com. It would depend on your carrier.

So, there's some ideas for you
 
Old 04-20-2013, 04:23 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,961

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


Reply


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 09:47 PM
IP address on static assigned ubuntu server keeps changing! dontworryaboutme Linux - Networking 8 03-30-2012 05:32 PM
Ubuntu Server ip address ansrewdps Linux - Newbie 21 04-13-2011 01:05 PM
Cannot connect to Ubuntu server through the internet after I fixed the IP address mrotsliah Linux - Server 1 06-22-2009 05: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 06:44 PM


All times are GMT -5. The time now is 01:36 AM.

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