LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-10-2009, 05:03 PM   #1
eur0disciple
LQ Newbie
 
Registered: Jan 2009
Posts: 15

Rep: Reputation: 0
Dynamic IP Script


My ISP assigns me a dynamic IP address. I would like to be able to run a script on my Slackbox that sends an email when the public IP address changes. Can anyone point me in the right direction? Has/is anyone used/using a script that performs this task. Any help would be much appreciated.
 
Old 01-10-2009, 05:18 PM   #2
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
You could use the services of no-ip.com or dyndns.com. They have scripts that updates their dns when your ip changes. I'm not sure how these work if you're behing a nat'ed router. Some routers have this functionality built in. If you are behind a router using Nat then it may be difficult, but not impossible, to sense when your public ip changes from the attached pc.

There are other scripts available - Google finds these although the same limitations would apply.
 
Old 01-10-2009, 05:53 PM   #3
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado, USA
Distribution: Slackware
Posts: 930

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
I use a few free subdomains from dyndns.com and then use http://ddclient.wiki.sourceforge.net/ as the update program. SlackBuilds.org has a ddclient package builder which makes it easier.
 
Old 01-10-2009, 07:37 PM   #4
larryhaja
Member
 
Registered: Jul 2008
Distribution: Slackware 13.1
Posts: 305

Rep: Reputation: 80
I've used dyndns.com in the past. Most newer routers have the feature built in so that it takes care of any updated dhcp ip address. Using a client also works but I've never tried it. The only issue I've found with dyndns.com is that when using their free service you have to log in every now and then or else they close your account. I believe it is once every 28 days, which is reasonable for a free service.

Last edited by larryhaja; 01-10-2009 at 07:49 PM.
 
Old 01-10-2009, 07:52 PM   #5
amnesiavivace
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: suse, redhat, ubuntu, fedora
Posts: 17

Rep: Reputation: 0
Quote:
Originally Posted by eur0disciple View Post
My ISP assigns me a dynamic IP address. I would like to be able to run a script on my Slackbox that sends an email when the public IP address changes. Can anyone point me in the right direction? Has/is anyone used/using a script that performs this task. Any help would be much appreciated.
I have a script that checks the status page of my Linksys router.
curl the status page, parse the IP line, check against a saved file containing the original IP. send email if its different. I also have the script update my zoneedit.com settings for dns.
 
Old 01-10-2009, 09:32 PM   #6
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado, USA
Distribution: Slackware
Posts: 930

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Quote:
Originally Posted by larryhaja View Post
The only issue I've found with dyndns.com is that when using their free service you have to log in every now and then or else they close your account. I believe it is once every 28 days, which is reasonable for a free service.
You set ddclient to force updates every 28 days even if your IP doesn't change which keeps your account current.
 
Old 01-10-2009, 10:30 PM   #7
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
Yep ddclient is the way to go.. been using it for years.
 
Old 01-11-2009, 02:47 PM   #8
eur0disciple
LQ Newbie
 
Registered: Jan 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks for the replies. Does anyone know a good resource to read up on bash scripting?

I think this will be beneficial in the future.
 
Old 01-11-2009, 02:55 PM   #9
TSquaredF
Member
 
Registered: Dec 2005
Location: "The South Coast of Texas"
Distribution: Slackware64-current
Posts: 564

Rep: Reputation: Disabled
Quote:
Originally Posted by eur0disciple View Post
Thanks for the replies. Does anyone know a good resource to read up on bash scripting?

I think this will be beneficial in the future.
Advanced BASH Scripting Guide
 
Old 09-01-2009, 08:22 AM   #10
mangec
LQ Newbie
 
Registered: Apr 2004
Location: france
Distribution: slackware gentoo
Posts: 17

Rep: Reputation: 0
Hello,

Did somebody experience connection problem to dynamic.zoneedit.com since less than 2 weeks. Before starting to involve DDCLIENT, I would like to know if I am the only victim since ZONEEDIT already had problems one year ago.

Symptom is :
Aug 29 03:00:27 orinoco ddclient[1394]: FAILED: updating blog.xxxxx.net,xxxxx.net,emg.xxxxx.net,telem.xxxxx.net: Could not connect to dynamic.zoneedit.com.

thanks to all
 
Old 09-01-2009, 08:55 AM   #11
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 277

Rep: Reputation: 41
Here is a simple little script is used to to check when my ip changes and restart my ftp server.
Bad, bad coding...added comments.
Code:
#!/bin/sh
FILEPATH='/var/run/proftpd'
IPfile='masq_ip'

# Check if ip file exits. Create it if its not present.
if [ ! -r ${FILEPATH}/${IPfile} ]; then
        touch ${FILEPATH}/${IPfile}
fi

# Check if noip is running. NOIP is used for my dynamic dns. Start it if its not.
if [ ! "`ps -ef | grep noip2 | grep -v grep`" ]; then
        /usr/local/bin/noip2 2>&1>/dev/null
        sleep 15
fi

# Get old IP from IP file
oldip=`cat ${FILEPATH}/${IPfile}`

# Get current IP from noip
newip=`/usr/local/bin/noip2 -S 2>&1 | grep "IP Address" | awk {'print $5'}`

# Restart proftpd and update ip file if the IP has changed.
if [  "$oldip" != "$newip" ]; then
        /etc/rc.d/rc.proftpd restart 2>&1>/dev/null
        echo $newip > ${FILEPATH}/${IPfile}
fi

Last edited by tux_dude; 09-01-2009 at 09:00 AM. Reason: Add comments.
 
  


Reply



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
Shell Script and Dynamic variable xanthium Programming 11 07-12-2011 06:05 AM
dynamic ip check script? jeru Debian 4 11-30-2004 09:48 AM
Nice script for Dynamic IP and DNS gnashley Slackware 1 12-17-2003 02:35 PM
How to find out dynamic IP address in a script? J_Szucs Linux - Networking 1 06-09-2003 07:13 PM
Script to capture dynamic IP address scon Linux - General 4 02-21-2003 03:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:06 PM.

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
Open Source Consulting | Domain Registration