[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Getting a Dinamic Remote IP



Just for a different take on this...

In cases where you don't want to link a domain name to the dynamic IP, you can set up a cron job to send you the IP address via e-mail.

Incidentally, I can't think of any arguments - security wise - against using something like dyndns, but I can't say I've put a great deal of thought into it. I set up a cron-job script mostly out of curiosity than anything (the 'there must be a way' motive). Anyway, my script (which borrows the key part from Douglas Ward's - thank you Douglas) looks like:

---start script---
#!/bin/bash
#get the current IP address for this connection off the internet and mail it

to="someone@somewhere.com"
subject="IP Address for x"

#this next bit is on one line
curl http://checkip.dyndns.org/ 2>/dev/null | grep "Current" | awk '{print $6}' | sed 's/<\/body><\/html>//' | sed 's/\///' | mail -e -s "$subject" "$to"
---end script---

It works perfectly for me. Next thing I'm going to do (out of curiosity, best way to learn) is output the result into a file and then only send the e-mail when the IP address is different to what's in the file - i.e. only send an e-mail when the IP address changes.

Cheers,

Romulo Sousa wrote:
Hi folks,

I would like to get an remote IP. It's about my girlfriend's computer
where I share some directories and install some packages. The problem
is that all the time I need to connect via ssh into her computer I
must call her asking for its IP provided by her ISP throughout
ifconfig output.
What can I do in order to get the IP from her computer all the time
the machine is booted? Is it possible to send a message by email, SMS
or whatever way to do that? Further, her computer is connected by a
ADSL (dinamic) and my computer uses cable modem (dinamic also).

Best regards,

Romulo Sousa


--
David Powell                                                       _
Information Systems Developer               ASCII ribbon campaign ( )
Moondrake Trust                               against HTML email   X
e: moondrake at optusnet dot com dot au                           / \



Reply to: