Determining IP addr via script?

Bill Campbell bill
Mon May 17 11:34:34 PDT 2004


On Mon, Jul 08, 2002 at 04:39:59PM -0500, Michael Hipp wrote:
>I have a Linux box behind a LinkSys NAT router that gets a public address 
>from DSL on the WAN side. I'm wanting to be able from the Linux box to 
>determine what addr has been assigned by SWBell to the LinkSys box.

This is tricky since the LinkSys boxen only want to talk http to an
interior machine.  I had thought that traceroute might be useful, but my
LinkSys VPN router box here doesn't seem to pass anything useful back.

I did get a basic connection using lynx, entered the username and password,
and see the IP address in lynx.  Given this, one could probably use the
appropriate perl modules to gather this information in a script or even use
expect to do it via lynx.

Another CBE (Crude But Effective) method might be to run a
command on a remote machine which would return the appropriate
information.  Something like this might work:

ssh -l root remotemachine grep 'sshd.*connection from' /var/log/messages |
	tail -1

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``Liberty don't work as good in practice as it does in speeches.''
    Will Rogers



More information about the Linux-users mailing list