Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/hosts is ignored
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
di1337
n00b
n00b


Joined: 17 Nov 2005
Posts: 16

PostPosted: Sun Jul 30, 2006 9:36 am    Post subject: /etc/hosts is ignored Reply with quote

Hi fellow gentoo'ers,

I am using gentoo to run a file-server on my home network. It works very well, but one thing keeps bugging me: My /etc/hosts file appears to be ignored. The only relevant line is:

Code:

127.0.0.1  server server.home localhost


This line should be correct, but still, I cannot adress my server as server, server.home or locahost while I'm working on it. Does anyone have any clues for me?

Thanks in advance!
Back to top
View user's profile Send private message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Sun Jul 30, 2006 9:47 am    Post subject: Reply with quote

The manpage hosts(5) has
Quote:
This file is a simple text file that associates IP addresses with hostnames, one line per IP address. For each host a single line should be present with the following information:
IP_address canonical_hostname [aliases...]
and here the line starts with
Code:
127.0.0.1       localhost
Perhaps as localhost==127.0.0.1 it has to come first and server and server.home are aliases.
_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.
Back to top
View user's profile Send private message
di1337
n00b
n00b


Joined: 17 Nov 2005
Posts: 16

PostPosted: Sun Jul 30, 2006 10:06 am    Post subject: Not working :-( Reply with quote

I followed your advice and put localhost in front of the other names, but it didn't help, even after a reboot. So I tried removing all the other names. The /etc/hosts file now looks like this:
Code:
# /etc/hosts:  This file describes a number of hostname-to-address
#              mappings for the TCP/IP subsystem.  It is mostly
#              used at boot time, when no name servers are running.
#              On small systems, this file can be used instead of a
#              "named" name server.  Just add the names, addresses
#              and any aliases to this file...
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/hosts,v 1.8 2003/08/04 20:12:25 azarah Exp $
#
127.0.0.1       localhost

Still, I can't address the server as localhost. Is something supposed to load /etc/hosts on boot time that might not run here?
Back to top
View user's profile Send private message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Sun Jul 30, 2006 1:35 pm    Post subject: Reply with quote

So, logged in to your server, you can't get
Code:
$ ping -c1 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.019 ms

--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.019/0.019/0.019/0.000 ms
What does it return?
Quote:
Is something supposed to load /etc/hosts on boot time that might not run here?
Not as far as I know, if you have the line
Code:
hosts:       files dns
in /etc/nsswitch.conf, then anything needing get an IP address from a name will look at the local files first before going off to DNS.

Do you get similar output as this for "ifconfig lo"?
Code:
# ifconfig lo
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:191 errors:0 dropped:0 overruns:0 frame:0
          TX packets:191 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:34996 (34.1 Kb)  TX bytes:34996 (34.1 Kb)

_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.
Back to top
View user's profile Send private message
di1337
n00b
n00b


Joined: 17 Nov 2005
Posts: 16

PostPosted: Sun Jul 30, 2006 1:49 pm    Post subject: Reply with quote

When I instruct the server to ping itself, i get:
Code:
ping: unknown host localhost

Other than resolving names in /etc/hosts, everything works. My interfaces are all up, even the loopback interface, and I can use 127.0.0.1. I just can't get localhost to be resolved to it. The nsswitch.conf file also appears to be correct.
Back to top
View user's profile Send private message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Sun Jul 30, 2006 2:03 pm    Post subject: Reply with quote

Here, logging in to another machine on the local network
Code:
lightfoot ~ # ssh greyarea
Last login: Sun Jul 30 14:57:25 2006 from lightfoot.etowers.net
greyarea ~ # ping -c1 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.022 ms

--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.022/0.022/0.022/0.000 ms

Quote:
When I instruct the server to ping itself, i get:
Without giving away any secrets :) is there some special way you log in to your server? I suppose it's in a colo a thousand miles away and you can't login at its console (not that that should make any difference).
_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.
Back to top
View user's profile Send private message
di1337
n00b
n00b


Joined: 17 Nov 2005
Posts: 16

PostPosted: Sun Jul 30, 2006 2:16 pm    Post subject: Reply with quote

Actually, it's located right here in my living room :D

But:good news
After resetting all network information for the fourth time today, everything just automagically works. Actually, I'm quite curious about what caused the problem, but I guess we'll probably never know.. anyhow, thanks for all the help :-).
Back to top
View user's profile Send private message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Sun Jul 30, 2006 3:39 pm    Post subject: Reply with quote

I'm glad you've got it working, I'd run out of ideas :D
_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum