You are not logged in.

#1 2012-08-20 19:59:32

tinloaf
Member
Registered: 2012-08-20
Posts: 2

[SOLVED] /etc/hosts being ignored?

Hi everyone,

I'm really at a loss here: Somehow my system seems to ignore the /etc/hosts file completely.  Here is a little excerpt from my console that should make the problem clear:

[root@deanna etc]# host gerrit.hadiko.de
gerrit.hadiko.de is an alias for vm34.hadiko.de.
vm34.hadiko.de has IPv6 address 2001:7c0:409:8001::32:134
[root@deanna etc]# host doesnotexist.hadiko.de
Host doesnotexist.hadiko.de not found: 3(NXDOMAIN)
[root@deanna etc]# cat hosts
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1		localhost.localdomain	localhost deanna
			
172.20.32.134		gerrit.hadiko.de
172.20.32.135		doesnotexist.hadiko.de
[root@deanna etc]# cat nsswitch.conf 
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

publickey: files

hosts: files dns
networks: files

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

netgroup: files

# End /etc/nsswitch.conf

The data for gerrit.hadiko.de is retrieved from the hadiko.de nameserver (which doesn't deliver the IPv4 address to the public internet, but I need it anyways..)

What am I doing wrong? Why is the resolver not looking at the hosts file? I have no nscd running. I'd be really glad if anyone could give me a hint here...

Thanks,

tinloaf

Solution: 'host' is a DNS lookup tool. *facepalm* .. Thanks folks.

Last edited by tinloaf (2012-08-20 20:40:04)

Offline

#2 2012-08-20 20:13:01

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [SOLVED] /etc/hosts being ignored?

If you know about nscd, then you probably read about dns caching. Did you restart the network daemon, or - maybe - even reboot?

Offline

#3 2012-08-20 20:13:21

ghen
Member
From: Belgium
Registered: 2010-08-31
Posts: 124

Re: [SOLVED] /etc/hosts being ignored?

"host" is a DNS lookup utility.  It performs DNS lookups directly, not using system resolver(3) libraries, and thus ignoring the /etc/hosts file.

Try another utility like ping, ...

Offline

#4 2012-08-20 20:35:32

progandy
Member
Registered: 2012-05-17
Posts: 5,320

Re: [SOLVED] /etc/hosts being ignored?

If you don't like ping, use "getent ahosts some.domain"


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#5 2012-08-20 20:39:26

tinloaf
Member
Registered: 2012-08-20
Posts: 2

Re: [SOLVED] /etc/hosts being ignored?

Now I feel like a complete newbie. Thanks folks, I really didn't know that, don't ask me why git and ssh had problems - caching probably.

Offline

Board footer

Powered by FluxBB