[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hosts, resolv setup?



I've struggled with this myself some time ago. My solution was:

/etc/hostname:
---------
mymachine
---------

/etc/hosts:
---------
127.0.0.1        localhost
192.168.0.1      mymachine.defaultnet mymachine
192.168.1.1      mymachine.secondnet
---------

/etc/resolv.conf:
---------
domain defaultnet
nameserver 123.45.67.89
---------

The explanation I found for myself:
1. The machine looks up the hostname in /etc/hostname
2. The IP-address for that name is looked up in /etc/hosts (with no domain 
   added.)
3. The first entry for that IP-address is then taken as the FQDN returned with
   the 'dnsdomainname'-command
   
The tricky part of the whole thing is, that a machine does not necessarily have 
a default FQDN. As in my example above, the machine might be part of two 
networks none of which has to be defined default. There simply is no 1:1 
mapping between machines and hostnames of FQDNs.

For that reason, the 'dnsdomainname'-command really should not be used at all. 
It might give useful information on some machines, but it actually it returns 
garbage on many machines - and as soon as you have more than one 
network-interface, it might not even be possible to define what that command 
should return.

In the same way, the name in /etc/hostname should not be used for 
identification either. On a plain unix machine without additional software for 
authentification etc., there simply is no way to identify a "machine". You can 
only speak of IP-Adresses, DNS-Names and the like.

Unfortunately, there are many programs that depend on that kind of 
"identification" to function properly. Best way is to give up the idea of a 
"correct" configuration and simply try to make those programs happy. The above 
solution has worked for me so far...

Ciao,
Nobbi

-- 
-- ______________________________________________________
-- JESUS CHRIST IS LORD!
--          To Him, even that machine here has to obey...
--
-- _________________________________Norbert "Nobbi" Nemec
-- Hindenburgstr. 44  ...  D-91054 Erlangen  ...  Germany
-- eMail: <nobbi@cheerful.com>   Tel: +49-(0)-9131-204180



Reply to: