You are not logged in.
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
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
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
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
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