Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IP address, how to find



On Thu, 11 Sep 2003, heidi wrote:

> (I'll be a newbie for ever.  Thanks for help at last fall's InstallFest.)
> How do I find my own computer's ip address.  If I type ifconfig I get
> the standard:
>
> inet addr:192.168.0.101  Bcast:192.168.0.255  Mask:255.255.255.0
>
> Someone wants to look into the Red Hat Linux 9 I have installed on my
> computer to help me troublshoot.  This is a pieced together computer
> with an ethernet connection.

The best way I know of to find out is `ifconfig -a`. If you know which
interface you're dealing with, you can narrow that down a bit, e.g.:

    $ ifconfig -L ppp0
    ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1492
        inet WWW.XXX.YYY.ZZZ --> AAA.BBB.CCC.DDD netmask 0xff000000

Where 'www.xxx.yyy.zzz' is your IP and 'aaa.bbb.ccc.ddd' is your gateway.

The only way to get the IP & only the IP, afaik, is something like:

    $ ifconfig -L ppp0 | grep inet | awk '{print $2}'

But that's flaky & maybe non-portable.

Red Hat may provide a more direct command, or you might be able to poke at
one of the pseudo-files under /proc, but mucking around with `ifconfig -a`
seems to be the most portable answer (I'm using OSX, for example, but the
command should be identical to Red Hat).



-- 
Chris Devers      cdevers at pobox.com
http://devers.homeip.net:8080/blog/

np: 'The Dead Flag Blues'
     by Godspeed You Black Emperor!
     from 'F# A# (Infinity)'




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org