|
||||||||
|
|
#1
|
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
-----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----- |
|
#4
|
|||
|
|||
|
(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. |
|
#5
|
|||
|
|||
|
(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 |
|
#6
|
|||
|
|||
|
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> |
|
#7
|
|||
|
|||
|
(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? |
|
#8
|
|||
|
|||
|
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) |
![]() |
| Tags |
| address, determine, machine |
| Thread Tools | |
| Display Modes | |
|
|