what to do after an IP change

Nifty Hat Mitch mitch48 at sbcglobal.net
Fri Aug 6 00:08:00 UTC 2004


On Wed, Aug 04, 2004 at 12:52:31PM +0200, 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 127.0.0.1 lines should look like this:

  127.0.0.1       localhost.localdomain   localhost 

It can be expanded to the right.

  127.0.0.1 localhost.localdomain   localhost  cupboardA.under.stairs

> 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.

/etc/hosts (and /etc/sysconfig/networking/profiles/default/hosts )
have a critical roll in the bootstrap process.   DNS and NIS have to 
connect to important hosts and establish their own identity.  In many cases
having  your host, and a couple "famous" hosts enumerated will 
be all the bootstrap process needs.

> 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.

See:   /etc/resolv.conf          resolver configuration file
       /etc/host.conf            resolver configuration file
 
It is possible to specify one or more of  host, bind (DNS),  nis (yp).

> 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.)

You may add them but you also must maintain them.
Keep the list short.  I do have many hosts commented out
should I need them.

> 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.

We need to compare and contrast dynamic DNS with DHCP.

> 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

DHCP introduces a tangle.  When a system boots in a DHCP environment
it is given a lease for a host name and associated IP address, gateway
host, subnet mask etc. It is also given other info, things like r DNS
servers, perhaps NTP servers and more.

When the lease expires any number of these DHCP provided data values
items can change.   When they change any application that is using them
needs to be notified.

For example sendmail.cf/mc will have a line 

   # my official domain name
   # ... define this only if sendmail cannot automatically 
   # determine your domain
   #Dj$w.Foo.COM

Normally, the $j macro is automatically defined to be your fully
qualified domain name (FQDN).   Sendmail sets the value once when
it starts.  

If DHCP changes the host name then sendmail needs to restart.
   (service sendmail restart).

Some fedora folks need a localhost for their mail agent.  It is easy
to start sendmail and have it pickup the first DHCP lease.  It can
then use the ISP as a smart host.  But, It goes a little bit wonkey when
the lease expires.

dhclient-script sets the stage but does not restart sendmail.

One could.... write a hook for this case.  It does not really hurt to
do a "service sendmail restart" any time DHCP renews the lease and the
IP address changes.



-- 
	T o m  M i t c h e l l 
	/dev/dull where insight begins.





More information about the fedora-list mailing list