gethostbyname/1 on Freebsd

Raimo Niskanen raimo@REDACTED
Thu Oct 16 17:15:18 CEST 2003


How is /etc/host.conf and|or /etc/nsswitch.conf?

Try       inet_db:set_lookup([file,native]).
And then  inet:gethostbyname("haruki").

If that works and you can not fix it with your /etc/host.conf and such 
files, create a file .inetrc in your home directory containing:

{lookup,["file","native"]}.

You may skip the "file" options above. Just "native" should work fine.
This trick will force Erlang to use the operating system (native) name 
resolver and not try to interprete all the very operating system 
dependent weird files.

-- 
/ Raimo Niskanen, Erlang/OTP, Ericsson AB


Olivier wrote:
> 
>     hi all,
> 
>     i'm having problems with gethostbyname/1 on FreeBSD:
> 
> 1> inet:gethostbyname("localhost").
> {ok,{hostent,"localhost",["naboo.dolphian.priv","naboo"],inet,4,[{127,0,0,1}]}} 
> 
> 2> inet:gethostbyname("naboo").
> {ok,{hostent,"localhost",["naboo.dolphian.priv","naboo"],inet,4,[{127,0,0,1}]}} 
> 
> 3> inet:gethostbyname("haruki").
> {error,nxdomain}
> 
>     /etc/resolv.conf is ok:
> search dolphian.priv
> nameserver 192.168.100.1
> 
> $ host haruki
> haruki.dolphian.priv has address 192.168.100.239
> 
>     same configuration on a linux box works as expected:
> 
> 1> inet:gethostbyname("penelope").
> {ok,{hostent,"penelope.dolphian.priv",[],inet,4,[{192,168,100,173}]}}
> 
>     any idea ? erlang is:
> 
> Erlang (BEAM) emulator version 5.3 (installed from the ports)
> 
>     thanks in advance,
> 
> -- 
> olivier
> 




More information about the erlang-questions mailing list