IP address, how to find
Chris Devers
cdevers at pobox.com
Thu Sep 11 17:24:42 EDT 2003
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)'
More information about the Discuss
mailing list