Fedora Linux Support Community & Resources Center
Old 7th August 2012, 11:21 PM
nvargas123 Offline
Registered User
Join Date: Aug 2012
Location: Managua
Posts: 1
Not resolving /etc/hosts

Hello everybody,

I've been trying to make a Fedora Core 11 box to resolve using its hosts file but it just wont.

The /etc/hosts file reads:

Code: localhost.localdomain localhost server.domain.com server
I've checked the /etc/host.conf file and it reads:

multi on
order hosts,bind
And the nsswitch.conf file reads:

hosts:      files dns
When I run the host `hostname -f` it still shows the DNS IP number and not the address listed on the hosts file:

server.domain.com has address aaa.bbb.ccc.ddd
Tried rebooting and still no change, but when I ping the hostname, it uses the hosts address.

[root@server etc]# ping `hostname -f`
PING server.domain.com ( 56(84) bytes of data.
64 bytes from server.domain.com ( icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from server.domain.com ( icmp_seq=2 ttl=64 time=0.025 ms
64 bytes from server.domain.com ( icmp_seq=3 ttl=64 time=0.023 ms
Any ideas?
Reply With Quote
Old 8th August 2012, 04:32 AM
nsnbm Offline
Registered User
Join Date: Dec 2007
Location: Australia
Posts: 1,569
Re: Not resolving /etc/hosts

Guess: is it resolving using your /etc/resolv.conf file? But that doesn't make much sense either. Sorry.

Last edited by nsnbm; 8th August 2012 at 10:04 AM.
Reply With Quote
Old 8th August 2012, 02:06 PM
distributer Offline
Registered User
Join Date: Aug 2009
Location: UK
Posts: 109
Re: Not resolving /etc/hosts

You use comma in your /etc/host.conf, but it states on the man page:
Fields can be separated by white space, consisting of either one or more spaces or tabs.
Did try a white-space?
Reply With Quote
Old 8th August 2012, 03:46 PM
Posts: n/a
Re: Not resolving /etc/hosts

'hostname' w/o arguments just returns the value of the (man 2 uname) uname syscall, and this has no necessary connection to any network hostname. BY CONVENTION uname 'nodename' string should be a FQDN, but many systems violate this recommendation. So 'hostname w/o argument doesn't consult /etc/hosts ,nor dns or anything else - it makes a local syscall.

Since the uname.nodename may be an unqualified hostname, one suggested way to get a fqdn is to first lookup the IP address for the unqualified nodename, then second do a reverse lookup of the IP address to get the fqdn. Perhaps this is what ancient (F11) 'hostname -f' does.

The current hostname calls 'getaddrinfo' with the uname value, and this works as expected (stops at /etc/hostname, even despite the typo) .
Reply With Quote
Old 8th August 2012, 04:35 PM
Dan's Avatar
Dan Offline
Join Date: Jun 2006
Location: Paris, TX
Posts: 24,099
Re: Not resolving /etc/hosts

Move to EOL.
Reply With Quote

host.conf, hosts, nsswitch, or etc or hosts, resolve, resolving

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Entries in /etc/hosts not resolving BillGradwohl Using Fedora 7 17th November 2011 05:08 PM
how to configure hosts.allow and hosts.deny nkjha Security and Privacy 4 19th January 2009 04:10 PM
Slow resolving hosts in anything HELP??? garymayor Servers & Networking 5 2nd February 2005 10:36 PM
Web browsers slow at resolving hosts in FC2 jdc EOL (End Of Life) Versions 5 20th May 2004 02:56 AM

Current GMT-time: 00:06 (Tuesday, 26-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat