Networking Forums

Networking Forums > Computer Networking > Linux Networking > Sensing dynamic network address.

Reply
Thread Tools Display Modes

Sensing dynamic network address.

 
 
John Culleton
Guest
Posts: n/a

 
      02-10-2005, 10:48 PM
For my own nefarious purposes I would like to set up a routine that sniffs
out the current address assigned by my cable host to my computer. I know it
changes every few hours.

Netstat, ifconfig etc. give me the information but they give me too much
information. All I want back is a one liner that contains the ip address,
for further processing. I can write a program that plows through an
ifconfig or netstat reply but I'd rather not. Any quick hints?
--
John Culleton
Able Indexers and Typesetters
 
Reply With Quote
 
 
 
 
Baho Utot
Guest
Posts: n/a

 
      02-10-2005, 11:27 PM
On Thu, 10 Feb 2005 18:48:14 -0500, John Culleton wrote:

> For my own nefarious purposes I would like to set up a routine that sniffs
> out the current address assigned by my cable host to my computer. I know it
> changes every few hours.
>
> Netstat, ifconfig etc. give me the information but they give me too much
> information. All I want back is a one liner that contains the ip address,
> for further processing. I can write a program that plows through an
> ifconfig or netstat reply but I'd rather not. Any quick hints?


INTERNET_IPADDR=`ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d ' ' -f
1`

 
Reply With Quote
 
chris-usenet@roaima.co.uk
Guest
Posts: n/a

 
      02-11-2005, 12:00 PM
John Culleton <(E-Mail Removed)> wrote:
> Netstat, ifconfig etc. give me the information but they give me too much
> information. All I want back is a one liner that contains the ip address,


ifconfig eth0 | sed -n 's/^.*inet addr:\([0-9.]*\).*/\1/p'

Chris
 
Reply With Quote
 
John Culleton
Guest
Posts: n/a

 
      02-11-2005, 01:01 PM
chris-(E-Mail Removed) wrote:

> John Culleton <(E-Mail Removed)> wrote:
>> Netstat, ifconfig etc. give me the information but they give me too much
>> information. All I want back is a one liner that contains the ip address,

>
> ifconfig eth0 | sed -n 's/^.*inet addr:\([0-9.]*\).*/\1/p'
>
> Chris


Beautiful! Thanks to both who replied.
--
John Culleton
Able Indexers and Typesetters
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plusnet Dynamic IP address Mark Carver Broadband 24 09-09-2011 09:17 AM
Dynamic & Static IP Address Charlie Wireless Internet 2 07-02-2005 09:47 PM
Get Dynamic IP Address used by hardware Yazmin Broadband Hardware 1 02-02-2005 08:23 PM
Can't get dynamic ip address from ISP =?Utf-8?B?TWFydGluIE4=?= Broadband Hardware 1 12-21-2004 05:21 PM
MN-100 and Dynamic Address Jessica Broadband Hardware 1 06-03-2004 10:02 AM



1 2 3 4 5 6 7 8 9 10 11