top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Fedora: Host command is not using /etc/hosts file

+1 vote
990 views

I put an IPv4 entry for a server in my /etc/hosts file. I can 'ping alice', but 'host alice' comes back with:

Host alice not found: 3(NXDOMAIN)

I have this vague memory from years back about a file that set precedence of hosts file and dns for fqdn lookup. Can't remember it of find it.

Of course the problem might simply be the host command is incapable of processing the /etc/hosts file?

Any suggestions?

posted May 1, 2014 by Dewang Chaudhary

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
AFAIK The host command does only DNS lookups.
Is there an equiv command that follows system priorities for both dns and hosts file?
getent hosts www.google.com

That will follow the IPv6-before-IPv4 rules (so by default, if the host has an IPv6 entry, only that will be shown).

To see all the matches, IPv6 and IPv4, you can use "ahosts" instead (which also has "ahostsv4" and "ahostsv6" to get only a specific address family). That will return all socket types (so usually STREAM, DGRAM, and RAW). This is done via a calls to getaddrinfo() and so should match the behavior of modern (akak IPv6-ready) programs.

1 Answer

+1 vote

Check your /etc/host.conf for line
order hosts,bind
and /etc/nsswitch.conf for correct order
hosts: files dns

However results may differ

answer May 1, 2014 by Majula Joshi
Similar Questions
+1 vote

I've been trying to setup Host-only networking between my eCS guest and Mac OSx Host. I already have a bridged network for internet access, but wanted to access the host file system from the guest. In reading the docs I thought this might work, but I don't seem to get any connection. I'm thinking that I don't understand what I'm doing enough to set it up correctly. I setup a second adapter in the guest and assigned a fixed IP address. I assigned the Host-Only adapter in VBox and it assigned it an IP address. Is that the IP that I need to connect to from the guest? The docs say that the host should show a new adapter in it's networking setup, but I don't see any new adapter in the list. Has anyone gotten this to work?

+1 vote

I am using Fedora 20, subversion 1.8.5-2. In ~/.subversion/config I have

[miscellany]
enable-auto-props = yes

[auto-props]
*.xml = svn:eol-style=native; svn:keywords=Author Date Id Revision

When I do

svn add my.xml
svn: E200009: Can't set 'svn:eol-style': file '/data/mysvn/trunk/my.xml' has binary mime type property

But with Ubuntu 12.10/subversion 1.7.5-1 svn add my.xml works just fine.

Any idea why the behavior is different?

0 votes

Where does dnf keep its repo configuration, or does it use /etc/yum.repo.d? Which I see is still there. As I want to change it to
use my local repos.

0 votes

I just installed Fedora 19 anew from the live cd and I'm having a few issues. One is that I'm trying to install a java application that requires the jar command, but jar can't be found:

jar xf myApp.jar 
bash: jar: command not found...

I have this:

rpm -qa | grep -i java
java-1.7.0-openjdk-1.7.0.25-2.3.10.3.fc19.x86_64
javapackages-tools-0.14.1-2.fc19.noarch
tzdata-java-2013c-1.fc19.noarch

Shouldn't jar be in one of these? If not, could someone please tell me what package provides that?

...