\begin{exe} {Static Configuration of a  Network Interface}

   \begin{info}
      You may have to use a different network interface name
      than \texttt{eth0}.  You can most easily do this exercise
      with \textbf{nmtui} or your system's graphical
      interface. We will present a command line solution, but
      beware details may not exactly fit your distribution
      flavor or fashion.
   \end{info}

   \begin{enumerate}
      \item
      Show your current IP address, default route and
      \textbf{DNS} settings for \verb?eth0?.  Keep a copy of
      them for resetting later.
      \item
      Bring down \texttt{eth0} and reconfigure to use a
      static address instead of \textbf{DCHP}, using the
      information you just recorded.
      \item
      Bring the interface back up, and configure the
      nameserver resolver with the information that you
      noted before.

      Verify your hostname and then \textbf{ping} it.
      \item
      Make sure your configuration works after a reboot.
   \end{enumerate}
   You will probably want to restore your configuration
   when you are done.

   \begin{sol}

      \begin{enumerate}
         \item
         \begin{cmd}
$ ip addr show eth0
$ ip route
$ cp /etc/resolv.conf resolv.conf.keep
         \end{cmd}
         or
         \begin{cmd}
$ ifconfig eth0
$ route -n
$ cp /etc/resolv.conf resolv.conf.keep
         \end{cmd}
         \item
         \begin{cmd}
$ sudo ip link set eth0 down
         \end{cmd}
         or
         \begin{cmd}
$ sudo ifconfig eth0 down
         \end{cmd}
         \begin{redhatbox}[ / CentOS]
            Make sure the following is in
            \filelink{/etc/sysconfig/network-scripts/ifcfg-eth0}
            on \textbf{Red Hat}-based systems:
            \begin{configlst}[in \texttt{/etc/sysconfig/network-scripts/ifcfg-eth0}]
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=noted from step 1
NETMASK=noted from step 1
GATEWAY=noted from step 1
            \end{configlst}

         \end{redhatbox}
         \begin{opensusebox}[, SLES, OpenSUSE, and Debian-based systems]
            On \textbf{SUSE}-based systems edit the file in
            \filelink{/etc/sysconfig/network} in the same way,
            and on \textbf{Debian}-based systems edit
            \filelink{/etc/networking/interfaces} to include:
            \begin{configlst}[ in \texttt{/etc/sysconfig/network} or
               \texttt{/etc/networking/interfaces}]
iface eth0 inet static
address noted from step 1
netmask noted from step 1
gateway noted from step 1
            \end{configlst}
         \end{opensusebox}
         \item
         \begin{cmd}
$ sudo ip link set eth0 up
         \end{cmd}
         or
         \begin{cmd}
$ sudo ifconfig eth0 up
         \end{cmd}
         \begin{cmd}
$ sudo cp resolv.conf.keep /etc/resolv.conf
$ cat /etc/sysconfig/network
$ cat /etc/hosts
$ ping yourhostname
         \end{cmd}
         \item
         \begin{cmd}
$ sudo reboot
$ ping hostname
         \end{cmd}
      \end{enumerate}
   \end{sol}
\end{exe}

