On Thu, Dec 30, 2004 at 07:59:57PM +0100, Frank Lenaerts wrote: > Hi, > > Can someone tell me why the hostname of a machine is added as an alias > for 127.0.0.1 to /etc/hosts during the installation i.e. why do we > have something like this in /etc/hosts? > > --- begin --- > 127.0.0.1 localhost.localdomain localhost pluto > --- end --- > > With the default (and normal) /etc/nsswitch.conf, first /etc/hosts is > consulted and then DNS. > > Having the hostname as alias for the localhost IP address already got > me in troubles two times: > > (1) When adding a new host to a Kerberos realm. It took me quite some > time to find out why I could not login to a newly added machine > (using the same procedure as on my Woody boxes). Part of the > problem was the fact that /etc/hosts contained the hostname (not > fully qualified) as alias for 127.0.0.1. > > (2) When creating a sudoers file with Host_Alias definition. Using the > (short) hostname makes that sudo keeps asking for a password while > it should not. Using the IP address or deleting the hostname alias > in /etc/hosts resolves this issue. > > BTW, note that the output of hostname --fqdn shows > localhost.localdomain. Deleting the alias shows the correct fully > qualified hostname. > > Thus, why is the hostname added as an alias for 127.0.0.1? > > P.S.: All Sarge machines are installed using the network (PXE) so they > get their IP via DHCP. After installation however, I statically assign > their IP (BIOS first tries to boot from the network (only used to > install), then from the harddisk).
Here you provide the answer. "DHCP installed computers" get hostname as alias for localhost. You also mentioned the workaround: assign static IP address during installation. > > cu, Cheers Geert Stappers
signature.asc
Description: Digital signature