Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

Determine IP address on machine

Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2006, 09:15 PM
Default Determine IP address on machine



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.



sandeep.de@gmail.com
Reply With Quote
  #2  
Old 02-08-2006, 09:24 PM
Bit Twister
Guest
 
Posts: n/a
Default Re: Determine IP address on machine

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
  #3  
Old 02-08-2006, 09:34 PM
Alo
Guest
 
Posts: n/a
Default Re: Determine IP address on machine

-----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
  #4  
Old 02-08-2006, 10:22 PM
Unruh
Guest
 
Posts: n/a
Default Re: Determine IP address on machine

(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
  #5  
Old 02-08-2006, 10:57 PM
ace
Guest
 
Posts: n/a
Default Re: Determine IP address on machine

(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
  #6  
Old 02-08-2006, 11:13 PM
Allodoxaphobia
Guest
 
Posts: n/a
Default Re: Determine IP address on machine

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
  #7  
Old 02-08-2006, 11:25 PM
Olivier
Guest
 
Posts: n/a
Default Re: Determine IP address on machine

(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
  #8  
Old 02-09-2006, 05:57 PM
Michael Heiming
Guest
 
Posts: n/a
Default Re: Determine IP address on machine

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

Tags
address, determine, machine

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
Forum Jump


All times are GMT. The time now is 04:43 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.