Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 01-23-2002, 11:03 PM   #1
beverson
Prospect
 
Join Date: Jan 2002
Location: Indianapolis
Posts: 3
Question tracking my dynamic IP address remotely by e-mail

I currently have @home cable modem, and a static IP through them. I have a broadband router and inside that three Macs, including my trusty rev. B iMac which is the Web and file server. I bought a domain name to make such things easier, but as of tomorrow Comcast is forcing us to use DHCP for dynamic IP addresses. Dynamic DNS is too expensive, but I'm spoiled by having my own Web/FTP/AFP server at my own domain -- very handy when I'm at work and realize I need a file or three that I left at home.

Now with the router taking care of getting and renewing an IP from DHCP I figure (but don't know for sure yet) that I'll be able to keep the same IP for semi-extended lengths of time. And I can administer my domain name online and change the IP in the domain record as needed; however, this is only really useful when I'm at home and can check my IP from inside my LAN.

So here's what I want to accomplish: I want to somehow get an e-mail from the iMac, look at the headers, determine the new IP, and fix the domain record. I'm not sure of the best approach, nor the best tools. One idea I had is to be able to send an e-mail that would trigger a response from the iMac, maybe by sending to a POP box elsewhere that the iMac checks every X minutes or something. Another would be to have the iMac send out a blank e-mail to me at intervals, though that's less desireable as I don't want to have dozens of blank e-mails from myself every day.

I figure this has got to be possible somehow, but I don't have enough UNIX know-how to know where to begin. Also, I may be thinking about it totally wrong, so perhaps someone else has a better approach sans e-mail. I would prefer to keep the overhead low and do it all terminal-side if possible, though I'm not entirely opposed to using something in Aqua as long as it's fairly unobtrusive since the iMac isn't as peppy as it once was.

I would love to be able to get this to work. But some outside help is definitely required.
beverson is offline   Reply With Quote
Old 01-23-2002, 11:56 PM   #2
griffman
Site Admin
 
Join Date: Dec 2001
Location: Portland, OR
Posts: 1,441
Via a web page...

Hmm ... dyndns.org is free, or so I thought?

In any event, I'm sure this is quite possible. You can grab the IP number from the command line with "wget http://checkip.dyndns.org" and send the output to a file. The next trick is to get that file to you remotely. You could upload it to your iDisk from the command line via a cron job every so often, for example. If you have another UNIX box (OS X or other) elsewhere, you could do a secure copy directly to that box on some scheduled basis. And there very well may be a way to use the command-line mail program to send you a file automagically as well, but that's beyond my skill set!

-rob.
griffman is online now   Reply With Quote
Old 01-23-2002, 11:56 PM   #3
hschickel
All Star
 
Join Date: Jan 2002
Location: NY, NY
Posts: 776
You're going about it the wrong way. Sign up for a free account with www.hn.org and you will be able to keep your domain name and have a dynamic ip address. The website explains it all. It works great.

Hugh

Last edited by hschickel; 01-24-2002 at 12:03 AM.
hschickel is offline   Reply With Quote
Old 01-24-2002, 09:10 AM   #4
beverson
Prospect
 
Join Date: Jan 2002
Location: Indianapolis
Posts: 3
Yeah, it appears I didn't research dynamic DNS as thoroughly as I thought I had. Between these and other similar suggestions, I think I'll probably go that route now.

Still, would be interesting to figure out how to do something like this.
beverson is offline   Reply With Quote
Old 01-24-2002, 10:22 AM   #5
n9
Prospect
 
Join Date: Jan 2002
Location: Manhattan, NY
Posts: 5
Something like this?

#!/usr/bin/perl

$my_email = "your\@email.net";

`wget http://checkip.dyndns.org`;
`mail -s Your_ip_address $my_email < index.html`;
`rm index.html`;



---

just plop in your email address.

this is a perl script. To use it:

copy and paste this text into a text editor. make sure the lines are not broken where they should not be. save the file. On the command line type:

#chmod +x script_name

where script_name stands for whatever you saved the script as.

the 'mail' program can be very handy for sending email from the command line.
n9 is offline   Reply With Quote
Old 01-24-2002, 10:31 AM   #6
beverson
Prospect
 
Join Date: Jan 2002
Location: Indianapolis
Posts: 3
Re: Something like this?

Quote:
Originally posted by n9
#!/usr/bin/perl

$my_email = "your\@email.net";

`wget http://checkip.dyndns.org`;
`mail -s Your_ip_address $my_email < index.html`;
`rm index.html`;



---

just plop in your email address.

this is a perl script. To use it:

copy and paste this text into a text editor. make sure the lines are not broken where they should not be. save the file. On the command line type:

#chmod +x script_name

where script_name stands for whatever you saved the script as.

the 'mail' program can be very handy for sending email from the command line.

Sweet. I'll play around with this too. Thanks.
beverson is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


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


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Site design © Mac Publishing LLC; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of Mac Publishing LLC.