what to do after an IP change

Jeff Vian jvian10 at charter.net
Wed Aug 4 12:48:07 UTC 2004


On Wed, 2004-08-04 at 05:52, Lars E. Pettersson wrote:
> On Wed, 2004-08-04 at 08:03, Roger Grosswiler wrote:
> > so, strangerwise, i choosed my hosts-file and changed the 127.0.0.1-entry. to the following
> > 
> > 127.0.0.1     my_hostname my_hostname.my_domain.tld localhost
> 
> No, do not do that, that is not correct. It may work, but it is not the
> correct way to do it.
> 
> The /etc/hosts file is a manual coupling between static IP-numbers and
> hostnames (in fqdn and short form), remaining from the god old days of
> flat files for hostnames, and without DNS servers etc.
> 
> The IP-number 127.0.0.1 has the hostname localhost.localdomain, or, in
> short form, localhost. This is *the* name corresponding to the IP number
> 127.0.0.1. The 127.0.0.1 IP-number has no other hostname, so no other
> hostname should be placed at that line in the /etc/hosts file.
> 
> If you have other static IP-numbers, whose name you know, you may *add*
> these to /etc/hosts, but do *not* alter the 127.0.0.1 line (as it is
> correct as written in the pristine file.)
> 

For this, you are slightly wrong.  Each IP address line lists all names
that are applicable.  If you use multiple hostnames with the same IP
they should all be listed on that line in /etc/hosts.

Also, when doing an install with FC2, FC1, and earlier RedHat versions,
the hostname given during the install is (in my experience) usually also
placed on the 127.0.0.1 line of this file.  I consider it a bug (but
only a minor annoyance) that the assigned hostname is not placed on its
own line with the assigned IP address, but in cases where there are
multiple NICs it is harder to get it right so the present method may be
best.  

Thus, multiple FQDNs on a line with a single IP address are not wrong. 
They may be "not in good form" in your view but that is the way the
/etc/hosts file is usually used. 

> If you use dyndns, or whatever, the coupling between IP-number and
> hostname is taken care of via the DNS system, so make sure that your
> /etc/resolve.conf file contains valid information about the DNS servers
> you use.
> 
> I.e. static information about IP-numbers/hostnames goes into /etc/hosts
> (with an un-altered 127.0.0.1 line), and dynamic IP-numbers/hostnames is
> taken care of by the DNS system set up via /etc/resolv.conf
> 
> /Lars
> -- 
> Lars E. Pettersson <lars at homer.se>
> http://www.sm6rpz.se/
> 





More information about the fedora-list mailing list