| Author |
find outside ipadress of router with perl
|
|
| Bert Huygens 2004-05-14, 8:30 am |
| Dear All,
is it possible in Perl to find the outside ip-address from an adsl-router
without using an outside box.
i need to restart a script when the outside address of the router changes
Greetings
thx in advance
---------------------------------
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
| |
| Andrew Gaffney 2004-05-14, 10:30 am |
| bert huygens wrote:
> Dear All,
>
> is it possible in Perl to find the outside ip-address from an adsl-router
> without using an outside box.
>
> i need to restart a script when the outside address of the router changes
Yeah, use LWP to goto 'http://privacy.net/' and run the following regex against
the results:
/Your IP address is (\d+\.\d+\.\d+\.\d+)<br>/
The router's outside IP should be in $1.
--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548
| |
| Wiggins D Anconia 2004-05-14, 11:30 am |
| >
> Dear All,
>
> is it possible in Perl to find the outside ip-address from an adsl-router
> without using an outside box.
>
> i need to restart a script when the outside address of the router changes
>
Not sure what you mean by "using an outside box"? Do you mean beyond the
router? or off the local machine? Don't think there is a way to do this
from the local machine only, since that would defeat the purpose of the
router. If you mean getting the info from the router you might want to
look at "ddclient", you can find its homepage on freshmeat or probably
with a google search.
http://danconia.org
| |
| Harry Putnam 2004-05-14, 2:30 pm |
| bert huygens <berth1974@yahoo.com> writes:
> Dear All,
>
> is it possible in Perl to find the outside ip-address from an adsl-router
> without using an outside box.
>
> i need to restart a script when the outside address of the router changes
Don't think you can get it without hitting a remote machine. Unless
the router itself can be queriedd for it.
You could put the small cgi script on a web server somewhere and hit
it with:
lynx -dump http://remote.server.com/remadd.cgi
cat remadd.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "REMOTE_ADDR = $ENV{'REMOTE_ADDR'}";
print <<EOM;
</BODY></HTML>
EOM
lynx -dump http://remote.server.com/remadd.cgi
should return something like:
REMOTE_ADDR = 69.44.143.256
|
|
|
|