%% $Header: /cvsroot/lcdp/lpic/general-linux-2/slides/gl2.112.3.slides.tex,v 1.1 2003/10/25 04:33:06 anguslees Exp $

\input{gl2.slide-header.tex}

\begin{document}

\begin{slide}
\begin{center} \LARGE \textsf{-- General Linux 2 -- \\
TCP/IP Configuration and Troubleshooting}\\[2mm]
\large \textsf{(Linux Professional Institute Certification)}\\[1mm]

\normalsize\end{center}

\vfill

\tiny
Copyright \copyright\ 2003 Angus Lees. Permission is granted to make
and distribute verbatim copies or modified versions of this document
provided that this copyright notice and this permission notice are
preserved on all copies under the terms of the GNU General Public
License as published by the Free Software Foundation---either version
2 of the License or (at your option) any later version.

\begin{verbatim}
$Id: gl2.112.3.slides.tex,v 1.1 2003/10/25 04:33:06 anguslees Exp $ 
\end{verbatim} 
\end{slide}


\begin{slide}
\slideheading{TCP/IP Configuration and Troubleshooting}
\slidesubheading{Objective}

Candidates should be able to view, change and verify configuration
settings and operational status for various network interfaces. This
objective includes manual and automatic configuration of interfaces
and routing tables. This especially means to add, start, stop,
restart, delete or reconfigure network interfaces. It also means to
change, view or configure the routing table and to correct an
improperly set default route manually. Candidates should be able to
configure Linux as a DHCP client and a TCP/IP host and to debug
problems associated with the network configuration.

\vspace{2em}
\begin{center}
\bfseries Weight: 7
\end{center}
\end{slide}
 

\begin{slide}
\slideheading{TCP/IP Configuration and Troubleshooting}
\slidesubheading{Key files, terms, and utilities}
\begin{alltt}
/etc/HOSTNAME or /etc/hostname    ifconfig
/etc/hosts                        route
/etc/networks                     netstat
/etc/host.conf                    host
/etc/resolv.conf                  ping
/etc/nsswitch.conf                tcpdump
traceroute
dhcpcd, dhcpclient, pump
hostname (domainname, dnsdomainname)
\textrm{the network scripts run during system initialisation}
\end{alltt}
\end{slide}


\begin{slide}
\slideheading{TCP/IP Configuration and Troubleshooting}
\slidesubheading{Resources of Interest}
\begin{description}
\item[Linux Networking HOWTO by Joshua Drake]:

\url{http://www.linuxdoc.org/HOWTO/Net-HOWTO/index.html}

\item[Linux Ethernet-Howto by Paul Gortmaker]:

\url{http://www.linuxdoc.org/HOWTO/Ethernet-HOWTO.html}
\end{description}
\end{slide}


\begin{slide}
\slidesubheading{\textbf{ifconfig} -- Low level network config}

Network interface configuration

\begin{alltt}
ifconfig eth0 192.168.7.26
    netmask 255.255.255.0
    broadcast 192.168.7.255

ifconfig eth0 down
\end{alltt}
\end{slide}


\begin{slide}
\slidesubheading{\textbf{route} -- Low level network config}

\begin{alltt}
route add -net 192.168.7.0
    netmask 255.255.255.0
    dev eth0

route add default gw 192.168.7.1
\end{alltt}

\vspace{2em}

View routing table:
\begin{alltt}
route -n
\end{alltt}
\end{slide}


\begin{slide}
\slidesubheading{\textbf{netstat} -- See network stuff}

\begin{tabular}{ll}
Ports in use & netstat -a -u -t \\
Routing table & netstat -r \\
Interfaces & netstat -i \\
Multicast groups & netstat -g \\
Masqueraded connections & netstat -M \\
Statistics & netstat -s \\
\end{tabular}
\end{slide}


\begin{slide}
\slidesubheading{Network debugging}

\begin{description}
\item[ping]
Try to bounce an \textsc{ICMP} packet off a host

Good for reachability, round trip delay, packet loss

\item[traceroute]
Show the network path to a particular host

Good for testing routing problems, ``which ISP screwed up''

\item[tcpdump]
Dump raw network traffic

Exceptional for diagnosing network problems involving a particular
host
\end{description}
\end{slide}


\begin{slide}
\slidesubheading{\textbf{tcpdump} again}

\textbf{tcpdump} is your friend, learn to use it

\begin{alltt}\scriptsize
\textit{#} tcpdump -i ppp0 not port ssh
tcpdump: listening on ppp0
21:54:32.913475 10.0.128.107.1024 > 10.0.128.97.domain:  20147+ A? fatso.urnet.com.au. (36) (DF)
21:54:33.102745 10.0.128.97.domain > 10.0.128.107.1024:  20147* 1/3/3 (178) (DF)
21:54:33.103766 10.0.128.107 > 203.26.250.2: icmp: echo request (DF)
21:54:33.352745 203.26.250.2 > 10.0.128.107: icmp: echo reply
21:54:34.102912 10.0.128.107 > 203.26.250.2: icmp: echo request (DF)
21:54:34.302745 203.26.250.2 > 10.0.128.107: icmp: echo reply
21:56:09.908636 10.0.128.107.1068 > 203.26.250.2.www: S 1245080954:1245080954(0) win 5840 <mss 1460,sackOK,timestamp 5047727 0,nop,wscale 0> (DF) [tos 0x10] 
21:56:10.052743 203.26.250.2.www > 10.0.128.107.1068: S 3633684004:3633684004(0) ack 1245080955 win 5792 <mss 1460,sackOK,timestamp 409734147 5047727,nop,wscale 0> (DF)
21:56:10.052869 10.0.128.107.1068 > 203.26.250.2.www: . ack 1 win 5840 <nop,nop,timestamp 5047742 409734147> (DF) [tos 0x10]
21:56:12.977510 10.0.128.107.1068 > 203.26.250.2.www: P 1:2(1) ack 1 win 5840 <nop,nop,timestamp 5048034 409734147> (DF) [tos 0x10]
\end{alltt}
\end{slide}


\begin{slide}
\slidesubheading{\texttt{/etc/HOSTNAME} or \texttt{/etc/hostname}}

System scripts set the hostname from one of these files during boot,
using the \textbf{hostname} command.

\textbf{dnsdomainname}, \textbf{ypdomainname}, \textbf{nisdomainname}
and \textbf{domainname} are variations on \textbf{hostname}

\vspace{2em}

\textbf{domainname} gives the NIS domainname, \textbf{NOT the DNS domain}
\end{slide}


\begin{slide}
\slidesubheading{\texttt{/etc/nsswitch.conf}}

``Name Service Switch'' configuration

\begin{alltt}\small
passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
\end{alltt}
\end{slide}


\begin{slide}
\slidesubheading{\texttt{/etc/networks}}

Labels for network addresses

Only supports class A, B or C addresses (not CIDR)

Rarely used or kept up to date

\begin{alltt}
localnet 192.168.1.0
\end{alltt}
\end{slide}


\begin{slide}
\slidesubheading{\texttt{/etc/hosts}}

Hostname to IP address mapping, mostly superseded by DNS

\begin{alltt}\small
127.0.0.1	localhost
192.168.1.1	cat.pasture.com.au	cat

# The following lines are desirable for IPv6 capable hosts

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
\end{alltt}
\end{slide}


\begin{slide}
\slidesubheading{\texttt{/etc/host.conf} -- Resolver configuration}

Various keywords to tweak non-DNS-specific resolver behaviour

Rarely modified; most options no longer relevant

\begin{alltt}
order hosts,bind
multi on
\end{alltt}
\end{slide}


\begin{slide}
\slidesubheading{\texttt{/etc/resolv.conf} -- DNS configuration}

DNS configuration for resolver

Nameserver defaults to \texttt{127.0.0.1}, search suffix defaults to
DNS domain name

\begin{alltt}
search pasture.com.au
nameserver 10.0.128.97
\end{alltt}
\end{slide}


\begin{slide}
\slidesubheading{Debugging DNS}

\textbf{host} performs various DNS queries

\begin{alltt}
host \textit{[options]} hostname \textit{[server]}
\end{alltt}

Common options:
\begin{description}
\item[-v] verbose
\item[-l] list all hosts in a domain (using AXFR)
\item[-t] query type (``-t any'' is useful)
\end{description}
\end{slide}


\begin{slide}
\slidesubheading{DHCP}

``Dynamic Host Control Protocol'' configures networking details, DNS,
etc automatically by querying a ``\textsc{DHCP} server''

Various \textsc{DHCP} clients:
\begin{description}
\item[dhcpclient]  Comes with \textsc{ISC} \textsc{DHCP} server,
highly configurable

\item[dhcpcd]

\item[pump]  Simple \textsc{DHCP} client written by RedHat

\item[udhcpc] Very small \textsc{DHCP} client
\end{description}
\end{slide}


\end{document}
