On Monday, June 10, 2002, at 05:26 PM, Todd Wade wrote:
> Bob Ackerman wrote: > >> my box is behind a D-Link router 704. >> The router gets its ip from my isp using dhcp. >> anyone know how to get that external ip from the router? >> is any module designed to find your external ip when you are on a lan? >> router is admined from a web page, so i guess it is possible to using LWP >> (or some other module?) to retrieve the info from the web page. > > I run a cron job on my internal network that sends a request every 10 > minutes to a cgi program that sits on my public web server. The cgi > program > does some authenticication, and then sticks the value of $ENV{REMOTE_HOST} > in a DB_File. This works because the router makes the request, so > $ENV{REMOTE_HOST} is populated with my router's dynamically assigned ip > address. > > I then have a redirector cgi program that sits on my public web server > that > redirects to my router. So http://my.public.site.com/redirector.cgi > redirects my browser to the router, which handles the port forwarding. > > This way, I always have access to my current dynamic ip address. Unless, > of > course, it changes and the cron job hasnt run ret, which has happened. > > The other suggestions are just as good, but as always TMTOWTDI. indeed. that is muy cleverly. i may just try that. i found ipcheck.py on source forge which works doing like so in python: params = urllib.urlencode({'RC': '@D', 'ACCT' : "root", 'PSWD' : "71:29: 26", 'URL': 'admin' }) ipurl = "http://" + iphost + "/cgi-bin/logi" urlfp = urllib.urlopen(ipurl, params) i can't quite figure out how to do this in perl. i have: use LWP::UserAgent; # Fetch the page $admin = ARGV[0]; #password print $admin,"\n"; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(GET => 'http://192.168.0.1/status.htm'); $req->authorization_basic('', $admin); #not working my $thePage = $ua->send_request($req); but it doesn't seem to authenticate. i have tried various usernames: 'root' , 'admin'. my logged in user name. doesn't help. so i will ask on python group what those params might mean. > Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]