This may not be news to any of you folks, but recently I was pleased to find out that 
sshd can listen on more than one port.  So on my home router I forward port 22 to box 
A and port xxx (that I just happen to know is open through my employer's firewall) to 
box B.  sshd on box B listens on ports 22 and xxx.  That way I can ssh directly to 
both from outside, but still just 'ssh hostname' from inside without specifying the 
port. 

As for tracking my comcast IP, I'm just too lazy.  It's only changed once in about 3 
years, and that change was when I got a new modem and the technician had a hard time 
getting it set up.  Some day this will probably bite me but where I live they don't 
seem to be renumbering any more.

Don Silvia
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Uri Guttman
Sent: Tuesday, December 30, 2003 2:09 PM
To: Joel Gwynn
Cc: [EMAIL PROTECTED]
Subject: Re: [Boston.pm] My IP


>>>>> "JG" == Joel Gwynn <[EMAIL PROTECTED]> writes:

  JG> Hey all.  I connect from work via ssh to my home computer, which is
  JG> Comcast broadband.  My IP rarely changes, but I'm worried about the one
  JG> day I'm at work and need something from home, and my IP has changed.

  JG> I'm thinking the best thing would be some sort of script that runs every
  JG> hour, and sends me an email if the IP changes.

  JG> Has anyone done anything like this?  I'm sure I could whip something up
  JG> in an hour, but I don't want to re-invent the wheel.

  JG> Also, since I'm behind a router, what's the best way to find my IP in
  JG> Perl?

asd others have said, dyndns is a good choice. i have a virtual host out
there so i rolled my own version of this. i just fetch (with lwp of
course) the status page of my nat box and parse out my leased IP address
(trivial and in this case it is the first IP on that page). i then ssh
it over to my virtual host. from the outside i first login to the
virtual host, copy the ip to the laptop or local box, and use that to
ssh into my home net.

#!/usr/local/bin/perl

$link_text = `/usr/local/bin/lwp-request -CNAME:PASSWORD  
http://192.168.0.100/Status.htm` ;

@ips = $link_text =~ /(\d+\.\d+\.\d+\.\d+)/g ;

system "/bin/echo $ips[2] | /usr/local/bin/ssh -q cell 'cat > m1_ip'" ;

i think 3 lines of perl is considered simple (even if it forks out twice :).

this runs under crontab every 15 minutes. i haven't had a problem with
it in a long time. note that i don't need a password for the ssh as i
put my public (or private, i forget) keys on the virtual host.

and a critical thing is to configure your nat box to map the incoming
ssh port to the box you want. this can vary depending on the brand and
model. one feature (which i wish i had) is that the map can also switch
the port number so you could ssh to another port and then be connected
to a different box. you could run ssh on a different port on that box
and just use the standard map as well. but once you login to a box, you
should be able to login to any other box behind your nat.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to