Although this is a far from complex solution, I thought I would post it here to potentially save someone the 2 minutes of typing. Basically, my problem is thus: I have DSL service with a dynamic IP, as well as dynamic DNS. The inside machines are all natted through the router, and have no conception of their own outside addresses. In order to automate any potential change of ip I need my firewall box to know what its external ip is to forward changes to my DNS service. The two ways to get my ip to hand off to the DNS service were A: Log into my router, query it, and parse the output (Dangerous!) and B: Get it from an external source. This is the result of my implementation of plan B.
#!/usr/bin/perl -w use LWP::Simple; use strict; my $ippage = get 'http://www.eb.com/cgi-bin/IP'; if ($ippage =~ /(\d+)(\.\d+)(\.\d+)(\.\d+)/) { print "$1$2$3$4\n" }

Replies are listed 'Best First'.
Re: Getting your real external ip from an external source.
by Hero Zzyzzx (Curate) on Jan 13, 2002 at 08:27 UTC

    I wrote a little something about this here, showing few possible ways to do this with perl. It's kind of geared towards *nix.

    -Any sufficiently advanced technology is
    indistinguishable from doubletalk.