Re: Is there any point to full host names in /etc/hosts ?
- From: ibuprofin@xxxxxxxxxxxxxxxxxxxxxx (Moe Trin)
- Date: Fri, 02 Nov 2007 14:58:41 -0500
On Fri, 2 Nov 2007, in the Usenet newsgroup comp.os.linux.networking, in article
<b5frv4-0qn.ln1@xxxxxxxxxxxxxxxxxxx>, Rikishi 42 wrote:
He's added 2 of my PC's in the /etc/hosts of his laptop, for use when he
visits and connects it to my LAN.
This would be a sample from that file:
# Home net
192.168.108.101 desktop.myDomain desktop
192.168.108.124 laptop.myDomain laptop
192.168.108.101 server.myDomain server
Minor quibble - a given hostname OR IP address should appear on one
line only.
#Rikishi's net
192.168.8.142 gramps.rikishi42.net gramps
192.168.8.181 pigmy.rikishi42.net pigmy
We've allways used this, works just fine.
When connectiong to my machines, he's allways used the short (host only)
name. Last time, he accidentally tried with the full name. It failed.
Might be interesting to know what is in /etc/resolv.conf - domain or
search lines?
My guess is that, upon finding that rikishi42.net exists, there is an
attempt to get the address from the DNS, skipping hosts all together.
No - how would it know that a domainname exists in DNS without asking
the DNS?
But do I presume correctly, or is there more to it?
There are two files that control the order in which the hosts file or
DNS is consulted. Older applications used /etc/host.conf, and this
has a simple line that reads
order hosts,bind
which translates to 'check the hosts file, and if the hostname is not
found, check DNS'. The second (more modern file) is /etc/nsswitch.conf
which has it's own man page
[compton ~]$ whatis nsswitch.conf
nsswitch.conf [nsswitch] (5) - System Databases and Name Service Switch
configuration file
[compton ~]$
and a common configuration might be
hosts: files nisplus nis dns
which translates to 'check the hosts file, and if the hostname is not
found, check NIS+ and if the hostname is not found check NIS, and if the
hostname is not found check DNS". This line might be shortened by
eliminating the NIS terms if you don't have NIS or NIS+ servers on your
LAN (most don't).
The other possible problem is the '/etc/resolv.conf' file, and the
brain-dead use of 'domain' and/or 'search' lines. These lines allow
use of short names in DNS - which may or may not be a massive security
hole. There are a number of man pages you can look at - start with
'gethostbyname', 'resolver (5)' and 'hostname'.
Perhaps the best way to troubleshoot DNS problems is to simply use a
packet sniffer and LOOK at the questions (and answers) you are tossing
at the name server.
/usr/sbin/tcpdump -ni eth0 port 53
might give the clues needed. The DNS-HOWTO offers some assistance if
you don't know what this dialog should look like.
Old guy
.
- Follow-Ups:
- Re: Is there any point to full host names in /etc/hosts ?
- From: David Brown
- Re: Is there any point to full host names in /etc/hosts ?
- From: Rikishi 42
- Re: Is there any point to full host names in /etc/hosts ?
- From: Send
- Re: Is there any point to full host names in /etc/hosts ?
- References:
- Is there any point to full host names in /etc/hosts ?
- From: Rikishi 42
- Is there any point to full host names in /etc/hosts ?
- Prev by Date: Re: Troubleshooting connection loss (novice question)
- Next by Date: Re: Only one Ethernet connector for everything
- Previous by thread: Re: Is there any point to full host names in /etc/hosts ?
- Next by thread: Re: Is there any point to full host names in /etc/hosts ?
- Index(es):
Relevant Pages
|