View previous topic :: View next topic |
Author |
Message |
radagast Apprentice


Joined: 20 Mar 2004 Posts: 217 Location: sydney, .au
|
Posted: Tue Oct 25, 2005 7:40 am Post subject: really simple dynamic dns notification? |
|
|
hello helpful people.
i've set up a computer for my dad.
he likes it.
it's running vnc all the time so i can help him when all his icons disappear.
but he has a dynamic IP address (i don't), so i need to know what it is.
i've looked at the free dyndns-type services, but that seems like overkill when i just want to know the ip once a day.
i haven't installed any mail servers or clients, and setting all that up seems like overkill too.
my best idea is to make his machine ping mine whenever the ip address changes (how do i find that out?)
and catch those pings on my machine (probably there are a hundred ways to do that, but which?)
anyone got a really neat suggestion?
thanks,
andrew |
|
Back to top |
|
 |
Sleipnir Guru


Joined: 20 Sep 2005 Posts: 372 Location: Germany
|
Posted: Tue Oct 25, 2005 7:55 am Post subject: |
|
|
So if you know that the IP only changes once a day and you are able to get
the IP of the PC, I would suggest a cron job that copies the IP over to your
pc. Put somewhat like
Code: |
/sbin/ifconfig <interface> | grep "inet addr" > <IPfile> && scp -i <identfile> <IPfile> <Your PC>:/<path>
|
into your cron daily (hourly)! _________________ A)bort, R)etry, I)nfluence with large hammer. |
|
Back to top |
|
 |
javeree_work Tux's lil' helper

Joined: 13 Apr 2005 Posts: 84
|
Posted: Tue Oct 25, 2005 7:58 am Post subject: |
|
|
Actually I would recommend dyndns for exactly this kind of application. To me the solution you're after sounds more complicated. Checking if the IP changes is also a thing that needs to be done if you're working with dyndns. I have used two methods.
My current method is logging on to my router using wget. A specific page on my router contains the IP address of the router, which I extract using grep/sed.
A previous method I used was getting http://www.whatismyip.com/ and also grepping the IP address.
The advantage of calling the router versus calling the webpage is that there is no guarantee that the source of the webpage will remain unchanged in the future => some maintenance to the grep expressions might be necessary.
The script that does this can be called in a cron-job. You will have to save the IP you get in a file in order to compare it and see if it has changed. |
|
Back to top |
|
 |
Monkeh Veteran


Joined: 06 Aug 2005 Posts: 1656 Location: England
|
Posted: Tue Oct 25, 2005 8:35 am Post subject: |
|
|
If you sign up for DynDNS, there are many free and open source updating clients available. It's not overkill, and is far easier than typing in an IP address every time you want to connection. |
|
Back to top |
|
 |
PaulBredbury Watchman


Joined: 14 Jul 2005 Posts: 7310
|
Posted: Tue Oct 25, 2005 8:38 am Post subject: |
|
|
Set up a free account at dyndns, and emerge ddclient
In /etc/ddclient/ddclient.conf:
Code: | # http://ddclient.sourceforge.net/
pid=/var/run/ddclient.pid
protocol=dyndns2
use=if, if=ppp0
server=members.dyndns.org
login=yourusername
password=yourpassword
yourpcname.dyndns.org |
In /etc/ppp/ip-up.local:
Code: | /usr/sbin/ddclient -daemon 300 -syslog |
In /etc/ppp/ip-down.local:
Code: | # Required to stop multiple spawnings of ddclient
killall ddclient |
Then, you can just refer to the PC as yourpcname.dyndns.org |
|
Back to top |
|
 |
radagast Apprentice


Joined: 20 Mar 2004 Posts: 217 Location: sydney, .au
|
Posted: Tue Oct 25, 2005 1:45 pm Post subject: |
|
|
thankyou everyone,
and thankyou Sleipnir for the elegant solution i was looking for.
his computer writes it's address by scp to my server,
i connect with a line like
Code: | vncviewer `cat dadsip` |
i know dyndns (and it's clones) are good, and i'm sure i'll come back to this thread another day when i have a bigger problem. but there are only two computers involved and all i need is one number, and my internal efficiency freak just didn't want to use hundreds of lines of code and someone else's server to do something that simple.
but again, thanks.
every problem is a learning experience. |
|
Back to top |
|
 |
xanthax Tux's lil' helper


Joined: 16 Apr 2004 Posts: 91 Location: Bi Nary State
|
Posted: Tue Nov 08, 2005 6:58 pm Post subject: |
|
|
The command to get your ip is:
Code: | ifconfig eth0 | grep "inet addr" | cut -d ':' -f2 | cut -d ' ' -f1 |
For getting your DNS ip you could use:
Code: | resolveip yourdns.dnshost.com | cut -d ' ' -f 6 |
and for you who are new to linux to get it into file just add a " > /wherever/myip" on the end
Make a shellscritp comparing these two and if not equal run "updatedd"  _________________ God is only an imaginary friend for adults... |
|
Back to top |
|
 |
crazyweber n00b

Joined: 01 Feb 2004 Posts: 58 Location: Lawrence, KS
|
Posted: Sat Dec 31, 2005 1:27 am Post subject: |
|
|
i was looking to configure ddclient. all was going will till i had to modify /etc/ppp/ip-up.local and /etc/ppp/id-down.local. My /etc/ppp folder doesn't exsist. Is there something else I must install or is it safe to create these files? |
|
Back to top |
|
 |
Katphish Apprentice

Joined: 05 Dec 2005 Posts: 155
|
Posted: Sat Dec 31, 2005 6:15 am Post subject: |
|
|
Quote: | i was looking to configure ddclient. all was going will till i had to modify /etc/ppp/ip-up.local and /etc/ppp/id-down.local. My /etc/ppp folder doesn't exsist. Is there something else I must install or is it safe to create these files? |
That example was probably for a PPPoE or dialup connection.
If you are on a plain old LAN then you don't need that part.
Replace:
with:
Code: | use=web, web=checkip.dyndns.org/, web-skip='IP Address' # found after IP Address |
If you have your account setup at dyndns.org and have ddclient configured run:
Code: | rc-update add ddclient default |
and you are good to go on your next reboot. Run:
Code: | /etc/init.d/ddclient start |
to start it now. `tail /var/log/messages` to see if it worked okay. |
|
Back to top |
|
 |
blob2004 n00b

Joined: 12 Jul 2004 Posts: 59
|
Posted: Wed Jan 25, 2006 7:03 pm Post subject: |
|
|
I emerged ddclient, then I checked out the init script for ddclient:
$ cat /etc/init.d/ddclient
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/ddclient/files/ddclient.rc6,v 1.4 2004/07/14 23:21:59 agriffis Exp $
depend() {
need net
}
checkconfig() {
if [ ! -e /etc/ddclient/ddclient.conf ] ; then
eerror "You need a /etc/ddclient/ddclient.conf file to run ddclient"
eerror "There is a sample file in /etc/ddclient/"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting DDClient"
start-stop-daemon --start --quiet --exec /usr/sbin/ddclient
eend $?
}
stop() {
ebegin "Stopping DDClient"
start-stop-daemon --stop --quiet --pidfile /var/run/ddclient.pid
eend $?
}
Then I started it:
$ sudo /etc/init.d/ddclient start
[ ok ]ing DDClient ...
But there is no ddclient.pid file:
$ sudo ls /var/run/ddclient.pid
ls: /var/run/ddclient.pid: No such file or directory
Which at least means that I can't stop it:
$ sudo /etc/init.d/ddclient stop
[ !! ]ing DDClient ..
Also, after starting, it doesn't seem to be running:
$ sudo /etc/init.d/ddclient start
[ ok ]ing DDClient ...
$ sudo pgrep dd
$
Although it thinks it is!
$ sudo /etc/init.d/ddclient status
* status: started
Anyone know what's up with this? is it really started and running? |
|
Back to top |
|
 |
|