Re: How to get the hostname in stage2 ?

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

 



On Wed, 2009-01-21 at 08:38 -1000, David Cantrell wrote:
>  This gets in to a policy issue as well.  How important or how much do we
> care about the hostname?  What do we want hostname(1) to return to
> users?  What they want to name the system or what DNS knows as the
> system name?  We can do the former with writing out /etc/hosts, which is
> sort of the classic way of solving the problem.
> 
> I don't want to call my system cpe-64-91-83-151.hawaii.res.rr.com, I
> want to call it 'loki' and I don't want to care about the IP address.
> 
> There is disconnect, but I'd like some hostname policy to appear before
> making too many changes.  For the case of supplying anaconda with a
> hostname and then picking up an address over DHCP, which hostname takes
> precedence (assuming you've got working DNS lookups on your network)?  I
> would think the supplied hostname from the user should work always,
> regardless of the IP address or network connection.  But maybe we don't
> want that.

I hate choice, but this likely is a user choice.  Perhaps the hostname
box in the anaconda gui will have an option, which if checked, grays out
the hostname box, and that option is "obtain hostname from the
network" (wordsmith that better).

Policy:
  If a hostname is provided via the installer, honor it completely, by
setting an entry in /etc/sysconfig/network, and by immediately setting
the hostname of the running system, regardless of what DHCP offers and
what DNS returns (see below about /etc/hosts).

  If a hostname is not provided, use the hostname provided by the DHCP
server.  If none is provided or DHCP is not in use, use the hostname
returned by a lookup of the IP address.  If no hostname is found via
this method or network wasn't brought up at all, fall back to
'localhost.localdomain'.  Again, set everywhere and make immediately
active.

How does that sound for policy?  We'll want hostname to return the
correct thing based on policy, particularly because anaconda takes
queues from the hostname for things such as LVM volume group names.

I suppose this begs the question of how exactly to construct /etc/hosts.
If using a static IP, it's no brainer, the IP gets a line with the
hostname (either provided or looked up).  But when using DHCP that gets
tricky.  Should a line be added with the current IP lease, or should the
hostname be added to the 127.0.0.1 line, or should that depend on
whether an explicit hostname was provided or if the option was checked
to obtain from the network?

My opinion on policy would be this:

  If a hostname was explicitly provided, but DHCP was used to obtain an
IP address or the network was not made active, add the hostname to the
127.0.0.1 line in /etc/hosts.

  If static networking was used, and either a hostname was provided, or
we successfully looked up a hostname, add a new line to /etc/hosts with
the IP and the hostname.

  If a hostname was not provided and a hostname was found via a
successful lookup, append the hostname to the 127.0.0.1 line
in /etc/hosts

  If a hostname was not provided and none could be looked up (either
unsuccessful lookup or no network brought up) leave /etc/hosts with just
the localhost.localdomain content.

Some better ordering or grouping of the above policy sets could probably
be done to make things clearer to users, but other than that, does the
above seem like sane policy?

-- 
Jesse Keating
Fedora -- Freedom² is a feature!
identi.ca: http://identi.ca/jkeating

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux