[olug] Unix Tip: GET YOUR IP-ADDRESS, Omaha Perl Mongers

Jeff Hinrichs jlh at cox.net
Sat Mar 22 20:31:06 UTC 2003


> I did what you suggested and got this
>
>  python -c "import socket; print
socket.gethostbyname(socket.gethostname())"
> 10.90.0.0
>
> I did what the tip suggested and got this.
>
> /sbin/ifconfig | grep "inet addr" |  grep -v "127.0.0.1" | awk '{print
> $2;}' |  awk -F':' '{print $2;}'
> 10.90.2.237
>
> I know why --  it hearkens back to something I had  questions on but
> never got a satisfactory answer about. I'd still like an answer because
> I don't think I've got the system set up correctly. What it amounts to
> is that I don't know how to get the hostname to pull an IP from dhcp
> when the system is starting up. The hostname seems to need a dedicated IP.


I checked a dhcp'd client (linux and win) and static ip'd machines also.
I'm
interested why it doesn't work on yours.

What do you get when;
 ping -a hostname*
            *where hostname is the name of the machine that you are on.
Is it 10.90.0.0 or 10.90.2.237, I'd be surprised if its not 10.90.0.0 .

-Jeff





More information about the OLUG mailing list