Networking Forums

Networking Forums > Computer Networking > Linux Networking > Determine IP address on machine

Reply
Thread Tools Display Modes

Determine IP address on machine

 
 
sandeep.de@gmail.com
Guest
Posts: n/a

 
      02-08-2006, 08:15 PM
Hi ,

What is the best way to determine the IP address of a machine ? I have
to parse the IP and assign it to a variable using a script .

Thanks,
Sandeep.

 
Reply With Quote
 
 
 
 
Bit Twister
Guest
Posts: n/a

 
      02-08-2006, 08:24 PM
On 8 Feb 2006 13:15:06 -0800, (E-Mail Removed) wrote:
> Hi ,
>
> What is the best way to determine the IP address of a machine ? I have
> to parse the IP and assign it to a variable using a script .


ping -c 1 $(hosthame)
ifconfig
 
Reply With Quote
 
Alo
Guest
Posts: n/a

 
      02-08-2006, 08:34 PM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(E-Mail Removed) wrote:

> What is the best way to determine the IP address of a machine ? I have
> to parse the IP and assign it to a variable using a script .


For example : "host machinename"

- --
Un saludo
Alo [alo(@)uk2.net]
PGP en http://pgp.eteo.mondragon.edu [Get "0xF6695A61 "]
Usuario registrado Linux #276144 [http://counter.li.org]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFD6mP/vzPPcPZpWmERAvxoAJ44uYmJLl8f5yBUpjZ/TSYjKQ0gLwCfZ9vP
nK4oA4Wkpp/FwqJqT6RqzbI=
=gRw+
-----END PGP SIGNATURE-----
 
Reply With Quote
 
Unruh
Guest
Posts: n/a

 
      02-08-2006, 09:22 PM
(E-Mail Removed) writes:

>Hi ,


>What is the best way to determine the IP address of a machine ? I have
>to parse the IP and assign it to a variable using a script .


ifconfig

>Thanks,
>Sandeep.


 
Reply With Quote
 
ace
Guest
Posts: n/a

 
      02-08-2006, 09:57 PM
(E-Mail Removed) wrote:

> Hi ,
>
> What is the best way to determine the IP address of a machine ? I have
> to parse the IP and assign it to a variable using a script .
>
> Thanks,
> Sandeep.


ping -c 1 $HOSTNAME
 
Reply With Quote
 
Allodoxaphobia
Guest
Posts: n/a

 
      02-08-2006, 10:13 PM
On Wed, 08 Feb 2006 15:24:53 -0600, Bit Twister wrote:
> On 8 Feb 2006 13:15:06 -0800, (E-Mail Removed) wrote:
>> Hi ,
>>
>> What is the best way to determine the IP address of a machine ? I have
>> to parse the IP and assign it to a variable using a script .

>
> ping -c 1 $(hosthame)
> ifconfig


Here's my script for getting the "inside" and
the "outside" IP addy's for the machines on my SOHO
LAN.
:
|#!/bin/sh
|echo -n ' PC ip: ' && /sbin/ifconfig | grep 'inet addr:' | \
| grep -v '127.0.0.' | cut -d: -f2 | cut -d' ' -f1
|echo -n 'Net ip: ' && \
| wget -O- http://cfaj.freeshell.org/ipaddr.cgi 2>/dev/null

It's not original by me. I pieced it together from the contents of many
other postings I slogged through via groups.google.com.

HTH, but YMMV
Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
*** Killfiling google posts: <http//jonz.net/ng.htm>
 
Reply With Quote
 
Olivier
Guest
Posts: n/a

 
      02-08-2006, 10:25 PM
(E-Mail Removed) wrote:
> Hi ,
>
> What is the best way to determine the IP address of a machine ? I have
> to parse the IP and assign it to a variable using a script .
>
> Thanks,
> Sandeep.
>

You have to understand what you want to do.
You might have several ip addresses on your box ( typically if you have
several network cards ).
ifconfig
or ifconfig <interface name> is of help theree


Then if are NAT-ed maybe you need in fact to know your NAT ip address?

 
Reply With Quote
 
Michael Heiming
Guest
Posts: n/a

 
      02-09-2006, 04:57 PM
In comp.os.linux.networking (E-Mail Removed):
> Hi ,


> What is the best way to determine the IP address of a machine ? I have
> to parse the IP and assign it to a variable using a script .


Curious, is there a special reason for using a fresh google throw
away account though an open proxy?

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo (E-Mail Removed) | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 139: UBNC (user brain not connected)
 
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
determine mac address of an access point tim braun Wireless Internet 1 11-05-2007 02:38 PM
determine netmask on remote machine OM Windows Networking 4 07-18-2006 05:39 PM
How to Determine my Internet IP Address Dave Farrance Linux Networking 24 07-01-2006 10:31 AM
Determine IP address assigned to MAC Ian Pilcher Linux Networking 14 01-16-2006 06:20 AM
Determine IP address of WRT54G Another Newsgroup User Wireless Internet 13 08-02-2004 01:32 AM



1 2 3 4 5 6 7 8 9 10 11