[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: host hostname not found



ok, a fresh install of debian 7.6, here is my settings, I don't have libnss-myhostname installed yet

root@test1:~# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 test1.test.com test1

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


root@test1:~# getent hosts $(hostname)
127.0.1.1       test1.test.com test1


root@test1:~# cat /etc/nsswitch.conf 
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis



root@test1:~# host -v $(hostname)
Trying "test1"
Host test1 not found: 3(NXDOMAIN)
Received 98 bytes from 8.8.8.8#53 in 14 ms


Clearly, it skips /etc/hosts entries.


After digging around, I noticed, that I had always setup DNS records for my hosts prior to doing the installations, which caused me the confusion on what was happening. I thought that the looking up my hostname resolves correctly by getting the ip from /etc/hosts, which I was wrong.


So yes, host does not look in /etc/hosts by default.


On Fri, Sep 5, 2014 at 12:10 PM, Brian <ad44@cityscape.co.uk> wrote:
On Fri 05 Sep 2014 at 10:49:15 -0400, Podrigal, Aron wrote:

> I did not have libnss-myhostname installed. I think it was always shipped
> with the debian installation, at least on wheezy 7.4 through 7.5, I now had
> wheezy 7.6 installed, Was this changed in 7.6 or I'm just wrong?

libnss-myhostname is "Priority: extra" and has no reverse depends, so it
would not be expected to come with any Wheezy release.

> However I installed libnss-myhostname, amd I am now able to start proxmox
> pve-cluster, which I wasn't able before due to failing local dns lookup.

There is no failing local DNS lookup. It has pointed been out your
/etc/hosts has a line missing. It would look like this

  127.0.1.1  hostname

or this

  127.0.1.1  hostname.domain  hostname

and is put there by the installer.

libnss-myhostname works without that line being present.

What does "getent hosts $(hostname)" give?

> But still when I do host localhost, I still get not found.  Is that the
> intended behavior? I just checked on different environments and I see tjat
> on mac os im also getting not found for localhost. So looks like Reco is
> right that thos is intended behavior. But on my other debian boxes < 7.6 it
> does work, so my question is why does it work there? So in short, was there
> any change in the last release?

It isn't possible for the host command to come up with an IP for
localhost using the DNS. You have a possible misconfiguration.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: [🔎] 20140905161017.GM4985@copernicus.demon.co.uk" target="_blank">https://lists.debian.org/[🔎] 20140905161017.GM4985@copernicus.demon.co.uk



Reply to: