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

Re: hostname doesn't stick



Tim wrote:
> On Sun, 2006-09-17 at 10:32 +0100, Anne Wilson wrote:
>> Adding the local hostname seems to be a Fedora thing, and I see no
>> good reason for it.
> 
> Do you mean having a localhost name entry?  I have to wonder about that,
> localhost = 127.0.0.1 on just about everything.  It could be presumed to
> be present, whether or not it actually is.
> 
> Do you mean adding the local host's name to the localhost line?  I think
> this a bad idea, even if the machine is not connected to any other
> networkable device.  It might be the case now, but two weeks later when
> someone tries to SMB between two boxes, and wonders why Windows cannot
> browse "\\localhost\myfiles"...
> 
SMB does not use the /etc/hosts file. The SMB name for a machine
does not have to match the host name. The name you give in the Samba
configuration file is the one that you use when browsing shares.
Now, if you want to do tie SMB names to addresses, that is what the
lmhosts file is for. (/etc/samba/lmhosts and c:\windows\lmhosts are
the normal files used.)

> Do you mean adding a line for the local host addresses to the hosts
> file?  If you have any service, including the X server, sendmail, etc.,
> that tries to start up using the machine's hostname, it has to be able
> to know what IP and name are associated with each other.
> 
This is especially true if you are not connected to a network. And
it has to be an IP address that the machine responds to. So you can
not give it an IP address like 127.0.0.2 unless you create a second
interface like lo:1 that responds to that IP address.

One of problems is home networks connected to a firewall/router
using DHCP. A lot of them handle DHCP, and act as a caching name
server for the local network, but they do not DHCP lease to hostname
mapping. So you can not ask the name server for the IP address for
your hostname. Now, if you can configure the DHCP server so that you
always get the same hostname, you can put that entry in your
/etc/hosts file and be all set.

A better solution might be to add an option to the DHCP client so
that it can add/remove a /etc/hosts entry for your hostname that
matches the IP address assigned to the interface. You would need to
be able to control it on an individual interface option. (I have not
looked into this - do any of the DHCP clients support this?)

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!


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