|
|||||||||||
|
Re: Should /etc/hostname contain the whole FQDN?
From: Douglas A. Tutty <dtutty(at)porchlight.ca>
Date: Fri Aug 31 2007 - 20:26:08 EDT
Of course. Debian changes. UNIX changes. No to *NIX's are alike. The key to knowing the answer comes in understanding the fundamentals. A host is a host. One box, one name. A network is a network. One network, one name. Most hosts are only on one network, however, some hosts are on more than one network and would then possibly have more than one FQDN. > The resolver is the code within libc that maps hostnames to IP addresses. That's all. > That used to be it, however, with libc6 (or was it 5), that changed to /etc/nsswitch.conf. That's Name Service Switch, and has many options. > So that's still not where it's set. Manpage for hosts.conf says multi: Ok. So you've named the computer. You put this hostname (the name up to but not including the network name(s) to which the box is attached), in /etc/hostname. So now /bin/hostname will give you your hostname. How does hostname -f give the FQDN? It asks the resover what the dommain name is. The resolver consults the /etc/nsswitch.conf file so see where to look. On debian, it tells it that for hosts it should consult files and if it doesn't get an answer, to consult the DNS via a DNS query to the nameserver that is configured with files, in this case /etc/resolv.conf. So, the first place it will look is in /etc/hosts. It will see, e.g. 192.168.1.5 rocky.hooton rocky It will see a FQDN and return rocky.hooton to my hostname -f request. Now, what if you didn't have this host in /etc/hosts? What if the only line was: 127.0.0.1 localhost ? It would then look in /etc/resolve.conf and see: nameserver 192.168.1.1 It will then issue a DNS request to 192.168.1.1 asking what the FQDN is for rocky. It will be told rocky.hooton. --- So to finally answer your question, you configure your FQDN wherever you want names resovled. If you want it in files on the box itself, then it goes in /etc/hosts. If you run your own name server like I do (I run dnsmasq for simplicity) then you only have to record the information in one place. I hope this long-winded answer is of some help. For more clarity, I'd suggest __UNIX_System_Administration_Handbook__ by Evi Nemeth, et. al. Doug. -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.orgReceived on Fri Aug 31 20:27:14 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 03:28:35 EDT |
||||||||||
|
|||||||||||