getting IP address of router

David Mayerlen dmz-yBkl/NpmZwtWk0Htik3J/w at public.gmane.org
Mon Feb 7 22:39:36 UTC 2005


Hey,

 I used to keep a few websites up and running on "unlimited dialup"
accounts. The classic problem was that the ip address would change. Here's
how I got around it. I'd keep the link to the websites up on a website
with a permanent hostname etc. Back inside my LAN I ran a cronjob to check
my ip address and when I'd find that it changed I'd ftp up the new link.

 We used to call this a "pirate" website ... somehow like the pirate radio
stations that float around in ships and ...

Step1:

 Place a simple cgi script up on some permanent well-known website you
have access to. You can call that script and have it return back to you
the ip address of your router.

 That script need only contain:

#!/usr/bin/perl
print "Content-type: text/html\n\n$ENV{'REMOTE_ADDR'}";

Step2:

 Call that script using "wget" or "lynx". Here's an example but you'd want
to format the output from the cgi script to be something you are
comfortable with parsing. I have used both Lynx and wget for
automated/cron retrieval of stuff ... I prefer wget these days...

wget http://www.specstock.com/cgi-bin/ip.cgi

Regards,

=========================================================
| David Mayerlen
| Upstart Associates
| http://www.upstartx.com
| dmz-yBkl/NpmZwtWk0Htik3J/w at public.gmane.org
| 416-424-6739
=========================================================

On Mon, 7 Feb 2005, jim ruxton wrote:

> On Mon, 2005-02-07 at 16:22, Peter L. Peres wrote:
> > On Mon, 7 Feb 2005, jim ruxton wrote:
> >
> > > Thanks again Adam. I didn't have Lynx, guess it doesn't come with
> > > Fedora. I installed it and this works, thanks. What I'd like to easily
> > > be able to do is grab my internet IP address and pass it on to a script.
> > > I guess I could parse what comes back from myip.dk but I keep thinking
> > > there must be an easier way.
> >
> > What system are you on ? On linux you don't need an external host to
> > tell you who you are unless you run through a NAT firewall atyour
> > premises or your isp's.
> >
> > Both lynx and, better, wget, can be used to obtain the source of a web
> > page. wget is easier to use than lynx in this context.
> >
> > Is that host behind a NAT firewall ?
>
> Yes that is my problem. I am behind the NAT firewall.
> Jim
> >
> > Peter
> > --
> > The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
> > TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> > How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
> >
>
> --
> The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
>
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list