You are not logged in.

#1 2008-01-13 23:31:17

SiD
Member
From: Germany
Registered: 2006-09-21
Posts: 729

ncmpc and /etc/hosts question

I have a question about /etc/hosts and ncmpc.

in /etc/rc.conf I have HOSTNAME="acer01"

my/etc/hosts

127.0.0.1       localhost.localdomain   acer01

ncmpc is only working if my LAN cable is plugged in and the router at the other end is powered on.
if not ncmpc gives me this error

error [12]: host "localhost" not found

With this /etc/hosts ncmpc is working even if the network-device is not connected with the router.

127.0.0.1       localhost.localdomain   localhost acer01

I don't know much about networks.
Seems that the (powered on) router compensates the missing "localhost" in /etc/hosts.
Could someone explain me this behavior?

Offline

#2 2008-01-14 21:27:06

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: ncmpc and /etc/hosts question

you need to set it to something like this:

127.0.0.1               localhost.localdomain   localhost
192.168.1.2             hell.com    satan

if your machine name is satan and hell.com is ur domain and 192.168.1.2 is ur ip

Offline

#3 2008-01-15 04:09:11

SiD
Member
From: Germany
Registered: 2006-09-21
Posts: 729

Re: ncmpc and /etc/hosts question

it's working with this /etc/hosts

127.0.0.1       localhost.localdomain   localhost acer01

I want to know why it's only working when the network-adapter is connected to my router with this /etc/hosts

127.0.0.1       localhost.localdomain    acer01

Offline

#4 2008-01-16 01:56:29

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: ncmpc and /etc/hosts question

Because you didn't specify what localhost was in your hosts file. It only knows of localhost.localdomain(does not imply 'localhost') and acer being the loopback. 'localhost' is universally understood as the loopback.

Offline

#5 2008-01-16 08:22:22

lloeki
Member
From: France
Registered: 2007-02-20
Posts: 456
Website

Re: ncmpc and /etc/hosts question

Because you didn't specify what localhost was in your hosts file. It only knows of localhost.localdomain(does not imply 'localhost') and acer being the loopback.

I think he understood that.

'localhost' is universally understood as the loopback.

this is some kind of 'magic' answer isn't it? the resolving doesn't come out as a miracle... and that is IMHO what needs explanation.

his computer alone doesn't (obviously) get it because sure, it's not set. now what 'magic' makes it known when a cable is plugged in? the computer tries to reslove locally (via /etc/hosts), fails at it, and then asks the dns server about it. so I reckon the dns server is instructed on replying '127.0.0.1' for a 'localhost' hostname request. why so? because dns servers have an option to look at their local /etc/host for resolving before delegating to bigger servers, so the dns server certainly has localhost matching 127.0.0.1 in his /etc/host, and blindly replies accordingly, oblivious to the fact that he is replying about his 'own' 127.0.0.1 to someone else.

Last edited by lloeki (2008-01-16 08:24:12)


To know recursion, you must first know recursion.

Offline

Board footer

Powered by FluxBB