\section{Hostnames}
\begin{frame}
   {Getting and Setting the Hostname}

   \begin{itemize}
      \item
      Label to distinguish a networked device from other nodes
      \item Historically also called \textbf{nodename}
      \item Set at install, but can always be changed later
      \item Any user can get the hostname with:
      \begin{cmd}
$ hostname
      \end{cmd}
      \begin{response}
wally
      \end{response}
      \item Changing hostname requires root privilege:
      \begin{cmd}
$ sudo hostname lumpy
      \end{cmd}
      \begin{response}
lumpy
      \end{response}
      \item
      The current value is always stored in
      \filelink{/etc/hostname} on most \textbf{Linux}
      distributions.
      \item
      To do this \textbf{persistently} so changes survive a
      reboot use \textbf{hostnamectl}, part of the
      \textbf{systemd} infrastructure
      \begin{cmd}
$ sudo hostnamectl set-hostname lumpy
      \end{cmd}

   \end{itemize}

\end{frame}

\cprotect\note{

   For \textbf{DNS} purposes, hostnames are appended with a
   period (\texttt{dot}) and a domain name, so that a
   machine with a hostname of \texttt{antje} could have a
   \textbf{fully qualified domain name} (\textbf{FQDN}) of
   \texttt{antje.linuxfoundation.org}.

   Historically, making persistent changes involved changing
   configuration files in the \filelink{etc} directory tree.
   On \textbf{Red Hat}-based systems this was
   \filelink{/etc/sysconfig/network}, on
   \textbf{Debian}-based systems this was
   \filelink{/etc/hostname} and on \textbf{SUSE}-based
   systems it was \filelink{/etc/HOSTNAME}.
   However one should use \textbf{hostnamectl} on modern systems:
   \begin{multicols}{2}
      \begin{responsevar}{\footnotesize}
$ hostnamectl
   Static hostname: c8
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: ce0c82382a8a4c80bbd6931a917a2f1c
           Boot ID: 94207b3fbd9b4891b9a94e21762a47cb
  Operating System: Red Hat Enterprise Linux 8.2 (Ootpa) \
           dracut-049-70.git20200228.el8 (Initramfs)
            Kernel: Linux 5.11.6
      Architecture: x86-64
      \end{responsevar}
      and to see a usage message:
      \\
      \begin{responsevar}{\footnotesize}  
$ hostnamectl --help

hostnamectl [OPTIONS...] COMMAND ...

Query or change system hostname.

  -h --help              Show this help
     --version           Show package version
     --no-ask-password   Do not prompt for password
  -H --host=[USER@]HOST  Operate on remote host
  -M --machine=CONTAINER Operate on local container
     --transient         Only set transient hostname
     --static            Only set static hostname
     --pretty            Only set pretty hostname

Commands:
  status                 Show current hostname settings
  set-hostname NAME      Set system hostname
  set-icon-name NAME     Set icon name for host
  set-chassis NAME       Set chassis type for host
  set-deployment NAME    Set deployment environment for host
  set-location NAME      Set location for host
  set-location NAME      Set location for host
      \end{responsevar}
   \end{multicols}
}



