View previous topic :: View next topic |
Author |
Message |
Moriah Advocate
Joined: 27 Mar 2004 Posts: 2367 Location: Kentucky
|
Posted: Thu Jul 28, 2005 12:37 am Post subject: /etc/hosts broken |
|
|
I have installed this system twice this week, and each time, the resolver behaves in a broken way. It can resolve domain names via lookup thru an external name server, but it gets all confused looking up names in /etc/hosts
First, some background: Code: | ezekiel ~ # uname -a
Linux ezekiel.elilabs.com 2.6.12-gentoo-r6 #1 Wed Jul 27 15:51:38 CDT 2005 i686 AMD Athlon(tm) AuthenticAMD GNU/Linux
ezekiel ~ # |
Code: | ezekiel ~ # cat /etc/resolv.conf
domain elilabs.com
nameserver 198.147.221.34
nameserver 192.107.41.34
nameserver 216.68.4.10
ezekiel ~ # |
Code: | ezekiel ~ # cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
# static ip addresses on lan -- 192.168.1.0/24
#
192.168.1.1 aaron aaron.elilabs.com
192.168.1.2 elisha elisha.elilabs.com
192.168.1.3 ezra ezra.elilabs.com
192.168.1.4 gabriel gabriel.elilabs.com
192.168.1.5 lp lp.elilabs.com
192.168.1.6 abraham abraham.elilabs.com
192.168.1.7 ruth ruth.elilabs.com
192.168.1.8 shaphan shaphan.elilabs.com
192.168.1.9 samuel samuel.elilabs.com
192.168.1.11 daniel daniel.elilabs.com
192.168.1.13 ezekiel ezekiel.elilabs.com
### temporary addresses
#
192.168.1.50 neweli neweli.elilabs.com
# static ip addresses on dmz -- 192.168.2.0/24
#
192.168.2.1 nehemiah nehemiah.elilabs.com
#192.168.2.10 urim urim.elilabs.com
192.168.1.102 urim urim.elilabs.com
#192.168.2.11 thummim thummim.elilabs.com
192.168.1.101 thummim thummim.elilabs.com
192.168.2.13 eli eli.elilabs.com www.elilabs.com elilabs.com
#192.168.1.101 eli eli.elilabs.com www.elilabs.com elilabs.com
# static ip addresses allocated by xnet
#
# our cidr block: 205.243.154.192/28 & 204.248.49.62
#
# xnet servers
#
198.147.221.34 ns1.xnet.com # nameserver
198.147.221.35 ns2.xnet.com # nameserver
198.147.221.66 typhoon.xnet.com # shell
198.147.221.37 flood.xnet.com # news
# static ip addresses allocated by zoomtown
#
# zoomtown servers
#
216.68.4.10 ns1.zoomtown.com
216.68.5.10 ns2.zoomtown.com
#
# our gateway
#
10.251.36.120 dsl dsl.elilabs.com
10.251.36.1 dslam dslam.elilabs.zoomtown.com
216.68.54.75 dhcp dhcp.elilabs.zoomtown.com
# static ip addresses allocated by iglou
#
64.253.104.156 eli01.cindsl01.iglou.com # tunnel ppp0 on nehemiah
204.255.233.225 lanadvantage-01.iglou.com # lac (tunnel server)
64.253.104.1 cindsl01-2.iglou.com # our gateway to the internet via iglou
#
192.107.41.34 dns1.iglou.com
192.107.41.21 dns2.iglou.com
192.107.41.38 shellaccess.com
#
# our cidr block: 64.253.103.8/29
#
# 64.253.103.8 network
# 64.253.103.9 spare1.elilabs.com
# 64.253.103.10 urim.elilabs.com ns1.elilabs.com
# 64.253.103.11 thummim.elilabs.com ns2.elilabs.com
# 64.253.103.12 spare2.elilabs.com
# 64.253.103.13 www.elilabs.com eli.elilabs.com elilabs.com
# 64.253.103.14 spare3.elilabs.com
# 64.253.103.15 broadcast
# disable annoying delays on drudge site
127.0.0.2 code.fastclick.net
127.0.0.3 a.tribalfusion.com
127.0.0.4 servedby.advertising.com
127.0.0.5 cserver.mii.instacontent.com
127.0.0.6 media.fastclick.net
ezekiel ~ # | Now some examples of good behavior: Code: | ezekiel ~ # ping 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.061 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.023 ms
--- localhost ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.023/0.042/0.061/0.019 ms
ezekiel ~ # ping ftp.uu.net
PING ftp.uu.net (192.48.96.9) 56(84) bytes of data.
64 bytes from ftp.UU.NET (192.48.96.9): icmp_seq=1 ttl=244 time=102 ms
64 bytes from ftp.UU.NET (192.48.96.9): icmp_seq=2 ttl=244 time=121 ms
64 bytes from ftp.UU.NET (192.48.96.9): icmp_seq=3 ttl=244 time=113 ms
--- ftp.uu.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 102.145/112.576/121.962/8.123 ms
ezekiel ~ # ping forums.gentoo.org
PING forums.gentoo.org (140.211.166.170) 56(84) bytes of data.
64 bytes from dove.gentoo.osuosl.org (140.211.166.170): icmp_seq=1 ttl=49 time=155 ms
64 bytes from dove.gentoo.osuosl.org (140.211.166.170): icmp_seq=2 ttl=49 time=152 ms
--- forums.gentoo.org ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 152.407/154.113/155.819/1.706 ms
ezekiel ~ # |
Now some examples of bad behavior: Code: | ezekiel ~ # ping ezekiel
ping: unknown host ezekiel
ezekiel ~ # ping elisha
ping: unknown host elisha
ezekiel ~ # ping ezra
PING elilabs.com (64.253.103.13) 56(84) bytes of data.
64 bytes from elijah-5.iglou.com (64.253.103.13): icmp_seq=1 ttl=63 time=2.06 ms
--- elilabs.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.066/2.066/2.066/0.000 ms
ezekiel ~ # ping eli
PING elilabs.com (64.253.103.13) 56(84) bytes of data.
64 bytes from elijah-5.iglou.com (64.253.103.13): icmp_seq=1 ttl=63 time=1.72 ms
--- elilabs.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.720/1.720/1.720/0.000 ms
ezekiel ~ # | Notice that ezekiel cannot even resolve its own name. It resolves ezra to the wrong ip address -- the same one it correctly resolves eli to.
I have fiddled with this until my patience is exhausted. I have posted for help before, but it took a while to really characterize the total symptom set. At one time, it would not resolve localhost.
After I noticed this weird behaviour on the part of the resolver, I decided that maybe an ebuild was temporarily screwed up, so I reinstalled the system last night and this morning. The new installation produces the same symptoms.
BTW The /etc/hosts and /etc/resolv.conf files were copied from a system that works.
HELP |
|
Back to top |
|
|
cyrillic Watchman
Joined: 19 Feb 2003 Posts: 7313 Location: Groton, Massachusetts USA
|
Posted: Thu Jul 28, 2005 12:52 am Post subject: Re: /etc/hosts broken |
|
|
Have you tried putting the FQDN before the hostname ?
Like this
Code: | 127.0.0.1 localhost.localdomain localhost |
Instead of this
Code: | 192.168.1.13 ezekiel ezekiel.elilabs.com |
|
|
Back to top |
|
|
ONEEYEMAN Advocate
Joined: 01 Mar 2005 Posts: 3612
|
Posted: Thu Jul 28, 2005 12:57 am Post subject: |
|
|
Hi, Moriah,
What is you subnet mask? Is it 255.255.255.0? Or 255.255.0.0?
Also what is the output of the "ifconfig eth0"?
Thank you. |
|
Back to top |
|
|
Moriah Advocate
Joined: 27 Mar 2004 Posts: 2367 Location: Kentucky
|
Posted: Thu Jul 28, 2005 1:01 am Post subject: |
|
|
Regarding the subnetmask: Code: | ezekiel ~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:0D:61:51:E5:87
inet addr:192.168.1.13 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1400 Metric:1
RX packets:29488 errors:0 dropped:0 overruns:0 frame:0
TX packets:13183 errors:0 dropped:0 overruns:0 carrier:0
collisions:2 txqueuelen:1000
RX bytes:5731304 (5.4 Mb) TX bytes:2759344 (2.6 Mb)
Interrupt:11 Base address:0xb800
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:14 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1176 (1.1 Kb) TX bytes:1176 (1.1 Kb)
ezekiel ~ # | Regarding reversing the order of the FDQN names and the bare ones, all I can say is that the same /etc/hosts file works on several -- albiet older -- systems. Did they change something recently that reverses the ordering? |
|
Back to top |
|
|
ONEEYEMAN Advocate
Joined: 01 Mar 2005 Posts: 3612
|
Posted: Thu Jul 28, 2005 1:06 am Post subject: |
|
|
I think that cyrillic is correct.
That's the correct order of the things.
Thank you. |
|
Back to top |
|
|
Moriah Advocate
Joined: 27 Mar 2004 Posts: 2367 Location: Kentucky
|
Posted: Thu Jul 28, 2005 1:10 am Post subject: |
|
|
Well, I just reversed the order, and it made no difference in the symptoms. |
|
Back to top |
|
|
cyrillic Watchman
Joined: 19 Feb 2003 Posts: 7313 Location: Groton, Massachusetts USA
|
Posted: Thu Jul 28, 2005 1:13 am Post subject: |
|
|
Moriah wrote: | Regarding reversing the order of the FDQN names and the bare ones, all I can say is that the same /etc/hosts file works on several -- albiet older -- systems. Did they change something recently that reverses the ordering? |
I don't mess with domains on my own lan, but I read somewhere that the order was significant, and the bare hostname should go last.
ps. I use net-dns/dnsmasq for local DNS and DHCP. I would think with a setup as complicated as yours, something like this would make life easier than having a huge /etc/hosts file. |
|
Back to top |
|
|
Moriah Advocate
Joined: 27 Mar 2004 Posts: 2367 Location: Kentucky
|
Posted: Thu Jul 28, 2005 1:16 am Post subject: |
|
|
Well, I have been doing it this way for the last 10 years or so, and it worked fine until very recently. In fact, it still does work on most of the systems; its just the new ones (Ihave several with the same problem that were supposed to be "upgrades") that are messed up. Something has definately changed in the domain name resolver, and it sure looks broken to me. |
|
Back to top |
|
|
ONEEYEMAN Advocate
Joined: 01 Mar 2005 Posts: 3612
|
Posted: Thu Jul 28, 2005 3:15 am Post subject: |
|
|
How do you connecting to the network? Are you using the router, hub or...?
You mentioned that you have other Gentoo boxes thatworks fine. Are they connected to the same network. Can you "ping" from the working PC the ezekiel? Can you ping it by IP address?
Thank you. |
|
Back to top |
|
|
gentoo_dude l33t
Joined: 08 May 2004 Posts: 645 Location: Washington, DC
|
Posted: Thu Jul 28, 2005 3:28 am Post subject: |
|
|
I would also check that the kernel routes correctly the network
post your output |
|
Back to top |
|
|
Moriah Advocate
Joined: 27 Mar 2004 Posts: 2367 Location: Kentucky
|
Posted: Thu Jul 28, 2005 3:55 am Post subject: |
|
|
Here it is: Code: | ezekiel ~ # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
127.0.0.0 localhost 255.0.0.0 UG 0 0 0 lo
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
ezekiel ~ # | I seem to have determined that the poor system doesn't know its own dnsdomainname, as seen here: Code: | ezekiel ~ # dnsdomainname
dnsdomainname: Unknown host
ezekiel ~ # | So I am beginning to think that this may be at the root of the problem.
Recently, the use of /etc/hostname and /etc/dnsdomainname has been depricated in preference for /etc/conf.d/hostname and /etc/conf.d/domainname and as far as I can tell, that was the beginning of sorrows.
Just for the record, here is what is enabled with rc-update: Code: | ezekiel ~ # rc-update show
bootmisc | boot
checkfs | boot
checkroot | boot
clock | boot
consolefont | boot
domainname | default
gpm |
hdparm |
hostname | boot
keymaps | boot
local | default nonetwork
localmount | boot
modules | boot
net.eth0 | default
net.lo | boot
netmount | default
nscd |
numlock |
rmnologin | boot
rsyncd |
sshd | default
syslog-ng | default
urandom | boot
vixie-cron | default
ezekiel ~ # | I just can't believe that I am the only person who has seen this. Surely there must be others... |
|
Back to top |
|
|
Moriah Advocate
Joined: 27 Mar 2004 Posts: 2367 Location: Kentucky
|
Posted: Thu Jul 28, 2005 4:11 am Post subject: |
|
|
In reply to ONEEYEMAN, who said: Quote: | How do you connecting to the network? Are you using the router, hub or...?
You mentioned that you have other Gentoo boxes thatworks fine. Are they connected to the same network. Can you "ping" from the working PC the ezekiel? Can you ping it by IP address? | You may see how I connect to the network from the diagram at http://www.elilabs.com/elilabs_network.html but to make it short, it is a classic dual firewall with a dmz setup.
I get my connecttion from a cable modem which is in bridge mode and the gateway firewall (running iptables and l2tpd) gets a dynamic ip address from the cable provider's dhcp server. It then uses this address to connect to an L2TP LAC and builds an L2TP tunnel to an ISP that provides me with my CIDR block of static ip addresses for the servers on the dmz. The dmz is static natted by the firewall so that only the firewall's iptables configuration file needs to change if any of the server addresses change.
Also on the dmz is the choke firewall, which is masqueraded behind the gateway firewall to be invisible from the internet. The choke firewall performs a second level of masquerading for the workstations etc. on the lan.
This whole setup works beautifully, except for these 4 new machines, which are all experiencing the same goofy problem; therefore, I know it is not the connection to the internet.
All the machines acting badly are behind the choke firewall. All the other machines working properly are either on the lan, the dmz, or they are one of the two firewalls.
I can ping any of the sick systems from any machine using a numerical ip address, and I can ping from any of the sick boxes to anywhere using a numerical ip address, It is not a network problem; it is a resolver problem. Addresses that are resolved by a true domain name server query work correctly on the sick boxes. It is only addresses in the /etc/hosts file that are messed up.
As I posted above, the sick machines do not know what their domain name is. |
|
Back to top |
|
|
dr_walm n00b
Joined: 27 Jul 2005 Posts: 1
|
Posted: Thu Jul 28, 2005 7:40 am Post subject: |
|
|
I hade the same problem but solved it with creating
and add
_________________ "Satisfaction comes from doing quality work" |
|
Back to top |
|
|
jmbsvicetto Moderator
Joined: 27 Apr 2005 Posts: 4734 Location: Angra do Heroísmo (PT)
|
Posted: Thu Jul 28, 2005 10:58 am Post subject: |
|
|
Hi.
In case you're missing the /etc/nsswitch.conf file, here is mine
Code: | atl64 linux # cat /etc/nsswitch.conf
# /etc/nsswitch.conf:
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/nsswitch.conf,v 1.1 2005/05/17 00:52:41 vapier Exp $
passwd: compat
shadow: compat
group: compat
hosts: files dns
networks: files dns
services: db files
protocols: db files
rpc: db files
ethers: db files
netmasks: files
netgroup: files
bootparams: files
automount: files
aliases: files
atl64 linux # |
By the way, the /etc/nsswitch.conf file belongs to the glibc package.
Code: | atl64 linux # equery belongs /etc/nsswitch.conf
[ Searching for file(s) /etc/nsswitch.conf in *... ]
sys-libs/glibc-2.3.5 (/etc/nsswitch.conf)
atl64 linux # |
_________________ Jorge.
Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
|
|
Back to top |
|
|
MickKi Veteran
Joined: 08 Feb 2004 Posts: 1173
|
Posted: Thu Jul 28, 2005 12:52 pm Post subject: |
|
|
Hi Moriah,
Not sure if this helps, but since you are referring to recent changes . . . the /etc/hostname and /etc/dnsdomainname files have been replaced by /etc/conf.d/hostname and /etc/conf.d/domainname, after baselayout-1.11.12-r4. You'll need to rename/move/delete the old files after you have made the appropriate entries in the new ../conf.d/ equivalents. _________________ Regards,
Mick |
|
Back to top |
|
|
vthokiestm n00b
Joined: 21 Jan 2004 Posts: 7
|
Posted: Thu Jul 28, 2005 5:41 pm Post subject: |
|
|
I'm having the same problem. I just upgraded my system and I can no longer resolve any name in /etc/hosts.
It's like /etc/hosts is being completely ignored.
Updating /etc/nsswitch didn't help either. |
|
Back to top |
|
|
TreeFree n00b
Joined: 28 Jul 2005 Posts: 5
|
Posted: Thu Jul 28, 2005 9:29 pm Post subject: Thanks jorge & dr_walm |
|
|
I just did a fresh install and found out I was infact missing /etc/nsswitch.conf file too which was not allowing localhost to be resolved. I created the file and copied in the contents that jorge posted and I'm back in business. Thanks!! |
|
Back to top |
|
|
jmbsvicetto Moderator
Joined: 27 Apr 2005 Posts: 4734 Location: Angra do Heroísmo (PT)
|
Posted: Thu Jul 28, 2005 10:52 pm Post subject: |
|
|
Glad to help. _________________ Jorge.
Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
|
|
Back to top |
|
|
tosk n00b
Joined: 06 Jun 2005 Posts: 18
|
Posted: Sun Jul 31, 2005 3:27 am Post subject: |
|
|
I also was having this problem and the nsswitch.conf solution solved the problem. _________________ Tosk |
|
Back to top |
|
|
gmtl3 Tux's lil' helper
Joined: 03 Jan 2004 Posts: 135
|
Posted: Mon Aug 01, 2005 10:35 pm Post subject: |
|
|
For what it's worth. I was having a similar problem, with "search" and "domain" statement conflicts in /etc/resolv.conf preventing non-FQND entries for local domain to not get resolved for things like ping/ssh/etc. Simply making sure the "domain" statement was above the "search" statement fixed it.
Hope this helps someone else. |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Tue Aug 02, 2005 7:33 am Post subject: |
|
|
Moved from Installing Gentoo to Networking & Security. _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
Larde Guru
Joined: 07 Jun 2002 Posts: 313 Location: Duesseldorf, Germany
|
Posted: Tue Aug 02, 2005 11:46 am Post subject: |
|
|
gmtl3 wrote: | [...] I was having a similar problem, with "search" and "domain" statement conflicts in /etc/resolv.conf[...] Simply making sure the "domain" statement was above the "search" statement fixed it.
Hope this helps someone else. |
Well, what you wanted to say is: Use either the "search" or the "domain" statement. There can only be one...
Or as the manpage calls it:
Code: |
The domain and search keywords are mutually exclusive. If more than one instance of these keywords
is present, the last instance wins.
|
Or, as a better, non-gentoo manpage calls it:
Code: |
A search entry defines the list of domains to search when resolving a name. Only one domain
entry or search entry can be used. If the domain entry is used, the default search list is
the default domain. A search entry should be used when a search list other than the default
is required. The entry is of the form:
search DomainName ...
The search entry can have up to a maximum of 1024 characater strings for the DomainName variable.
The first DomainName variable is interpreted as the default domain name.
The domain entry and search entry are mutually exclusive. If both entries are used, the one that
appears last will override the other.
|
Just to be nitpicking...
Yours,
Larde _________________ Someday this will be my home... http://moonage.net/
I'll make you a deal
I'll say I came from Earth and my tongue is taped
|
|
Back to top |
|
|
mfairchi n00b
Joined: 23 Apr 2002 Posts: 57 Location: Ventura, California
|
Posted: Thu Aug 04, 2005 6:50 am Post subject: worked for me |
|
|
I was having basicly the same probelm.
somehow /etc/nsswitch.conf had
hosts: files wins
I changed it to
hosts: files dns
now everything works fine
thanks,
Michael |
|
Back to top |
|
|
vthokiestm n00b
Joined: 21 Jan 2004 Posts: 7
|
Posted: Mon Aug 08, 2005 5:24 pm Post subject: /etc/nsswitch.conf must be user readable |
|
|
Finally figured this out. Users couldn't read /etc/nsswitch.conf.
I fixed my machine with...
Code: | chmod 644 /etc/nsswitch.conf |
...and everything is working now!!! |
|
Back to top |
|
|
|