How do I find my own IP address?

Chappell, Simon P Simon.Chappell@REDACTED
Wed Jan 21 17:27:01 CET 2004


<snip>

>> 2> inet:gethostbyname("enfield").
>>  
>> {ok,{hostent,"localhost.localdomain",
>>              ["localhost","enfield"],
>>              inet,
>>              4,
>>              [{127,0,0,1}]}}
>> 
>> But 127.0.0.1 is not my IP address
>> 

<snip>

>before using undocumented functions i would suggest a close 
>look at the 
>configuration of your computer. the #hostent{} claims your canonical 
>name is "localhost.localdomain". this does not sound correct.
>what does your /etc/hosts say?

Actually, the default hostname for RedHat Linux Workstation (others may vary) has been "localhost.localdomain" for as long as I've been using it (5 years now).

Also, the actual IP address of a workstation may vary according to the information available at startup, especially if DHCP is selected. If no network connection is available, then it would not suprise me if DHCP gave you 127.0.0.1 as your IP address.

>
>bengt
>

Simon



More information about the erlang-questions mailing list