SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
Rep:
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.
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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.