\input{gl2.slide-header-beamer}% \errorcontextlines=99 %% Subtopic Number = '1.112.4' %% Title: 'Configure Linux as a PPP client' %% Weight: 3 %% Description: %% Candidates should understand the basics of the PPP protocol %% and be able to configure and use PPP for outbound connections. This %% objective includes the definition of the chat sequence to connect (given %% a login example) and the setup commands to be run automatically when a %% PPP connection is made. It also includes initialisation and termination %% of a PPP connection, with a modem, ISDN or ADSL and setting PPP to %% automatically reconnect if disconnected. %% Key files, terms, and utilities include: %% /etc/ppp/options.* %% /etc/ppp/peers/* %% /etc/wvdial.conf %% /etc/ppp/ip-up %% /etc/ppp/ip-down %% wvdial %% pppd \title{1.112.4\\Configure Linux as a PPP client\\Weight 3} \date{2005 October}% \author[Nick Urbanik]{Nick Urbanik \texttt{}\\ {\scriptsize This document Licensed under GPL---see section~\ref{sec:license}}} \subtitle{Linux Professional Institute Certification --- 102}% \mode
{\chead{1.112.4}}% \begin{document} \maketitle \mode
{\thispagestyle{empty}} \begin{frame} \frametitle{Outline} \mode {% %\footnotesize \begin{multicols}{2} \tableofcontents \end{multicols} % You might wish to add the option [pausesections] }% \mode
{% \tableofcontents }% \end{frame} \section{Context} \label{sec:context} \begin{frame} \frametitle{Topic 112 Networking Fundamentals [14]}% \framesubtitle{Where we are up to}% \begin{description} \item[1.112.1] Fundamentals of TCP/IP [4] \item[1.112.3] TCP/IP configuration and troubleshooting [7] % \uline depends on \usepackage[normalem]{ulem}: \item[1.112.4] \textbf{\uline{Configure Linux as a PPP client [3]}} \end{description} \end{frame} \section{Objectives} \label{sec:objectives} \begin{frame} \frametitle{Description of Objective}% \framesubtitle{1.112.4\ \ Configure Linux as a PPP client [3]}% \mode{\Large}% Candidates should understand the basics of the PPP protocol and be able to configure and use PPP for outbound connections. This objective includes the definition of the chat sequence to connect (given a login example) and the setup commands to be run automatically when a PPP connection is made. It also includes initialisation and termination of a PPP connection, with a modem, ISDN or ADSL and setting PPP to automatically reconnect if disconnected. \end{frame} \begin{frame} \frametitle{Key files, terms, and utilities include:}% \framesubtitle{1.112.4\ \ Configure Linux as a PPP client [3]}% \mode{\large}% \begin{description} \item[\texttt{/etc/ppp/options.*}] --- main configuration file for \texttt{pppd} \item[\texttt{/etc/ppp/peers/*}] --- allow users to use priveleged options configured by the administrator \item[\texttt{/etc/wvdial.conf}] --- configuration for the \texttt{wvdial} dialer \item[\texttt{/etc/ppp/ip-up}] --- script executed when PPP connection made \item[\texttt{/etc/ppp/ip-down}] --- script executed when PPP connection terminates \item[\texttt{wvdial}] --- a PPP dialer \item[\texttt{pppd}] --- The daemon that implements the PPP protocol \end{description} \end{frame} \section{What is PPP?} \label{sec:what-is-ppp} \begin{frame} \frametitle{What is PPP?} \begin{itemize} \item The Point-to-Point Protocol (PPP) provides a connection between two systems using a serial interface. \item Usually used with ADSL, a dial-up modem, or ISDN modem \item Can also use over a direct connection called a \emph{null modem} \item I have often used PPP over a secure shell connection to create a tunnel over SSH \item Creates a new network interface: first is called \texttt{ppp0}, next one is \texttt{ppp1},\,\ldots \item Kernel needs to support PPP, but I have found no recent desktop distributions that do not provide compiled-in support for PPP. \end{itemize} \end{frame} \section{PPP Clients and Servers} \label{sec:ppp-clients-and-servers} \begin{frame} \frametitle{PPP Clients and Servers} \begin{itemize} \item The same software --- \texttt{pppd} --- is used both for PPP dialup clients and PPP servers. \item A server simply uses software like \texttt{mgetty} to answer a modem, and an \texttt{/etc/initab} entry like: \par% \texttt{S1:2345:respawn:/sbin/mgetty~ttyS1} \par \ldots\,with some setup in \path{/etc/mgetty+sendfax/mgetty.config} \item However, the LPI objectives only include use of Linux as a client. \end{itemize} \end{frame} \section{Overview of PPP connection} \label{sec:overview-of-connection} \begin{frame} \frametitle{Overview of PPP connection} \begin{enumerate} \item Client connects to server through a serial connection \item Client authenticates to the server. \item PPP starts on the client \item PPP server usually provides address to client; client and server agree on various other parameters \item client configures its network interface using information provided by the server, often including a default route. \end{enumerate} \end{frame} \section{Establishing the serial connection: \texttt{chat} scripts} \label{sec:chat-scripts} \begin{frame} \frametitle{Establishing the serial connection: \texttt{chat} scripts} \begin{itemize} \item Much of the work in establishing the PPP connection is getting the modem to dial and talk with the other end. \item We use a program called \texttt{chat}, configured by a \item \alert{\texttt{chat} script} for this, and also possibly for logging in, and sometimes starting PPP. \item Questions about chat scripts seem to appear in LPIC exams. \end{itemize} \end{frame} \subsection{An example \texttt{chat }script} \label{sec:example-chat-script} \begin{frame} \frametitle{An example \texttt{chat} script} \begin{itemize} \item Consists of pairs of \emph{expected response} then \emph{string sent} \end{itemize} \ttfamily% ABORT BUSY\linebreak ABORT ERROR\linebreak ABORT 'NO CARRIER'\linebreak ABORT 'Invalid Login'\linebreak ABORT 'Login Incorrect'\linebreak '{}' ATZ\linebreak OK ATDT95672314\linebreak CONNECT '{}'\linebreak ogin: nicku\linebreak ssword: \meta{password}\linebreak TIMEOUT 5\linebreak > ppp \end{frame} \begin{frame}[fragile] \frametitle{What \texttt{chat} sees} \begin{itemize} \item The \texttt{chat} script above was written for a session that looked like this: \begin{semiverbatim} \textbf{ATZ} OK \textbf{ATDT95672314} CONNECT 31200/ARQ/LAPM/V42BIS User Access Verification login:\textbf{nicku} Password:\meta{password} msusw2>\textbf{ppp} Entering PPP mode. \ldots \end{semiverbatim} \end{itemize} \end{frame} \subsection{Using \texttt{wvdial} to dial} \label{sec:wvdial} \begin{frame} \frametitle{Using \texttt{wvdial} to dial} \begin{itemize} \item The \texttt{wvdial} program helps simplify the connection \item The program \texttt{wvdialconf} helps write a configuration file \texttt{$\sim$/.wvdialrc} or \texttt{/etc/wvdial.conf} which may need minor tweaking to use with \texttt{pppd} \item You can then use \texttt{wvdial} to dial the server, call \texttt{pppd} and handle the authentication \item In Ubuntu Hoary, I found this the simplest way to set up the use of PPP. \end{itemize} \end{frame} \section{Flow Control} \label{sec:flow-control} \begin{frame} \frametitle{Flow Control} \begin{itemize} \item A serial interface has a buffer which, when full, cannot accept more information \item Any more information received is lost \item Flow control is a way to stop this happening before the buffer is full \item There are two methods of flow control: \begin{description} \item[hardware flow control] uses two standard serial control lines: \texttt{ready-to-send} (RTS) and \emph{clear-to-send} (CTS) \begin{itemize} \item enabled with \texttt{pppd} using the option \alert{\texttt{crtscts}} \end{itemize} \item[software flow control] uses two characters: \texttt{XON} and \texttt{XOFF} to send flow control information mixed with the data \begin{itemize} \item less efficient than hardware flow control \end{itemize} \end{description} \end{itemize} \end{frame} \section{Names of serial ports in Linux systems} \label{sec:ttySx} \begin{frame} \frametitle{Names of serial ports in Linux systems} \begin{itemize} \item The first serial port is \texttt{/dev/ttyS0}, the second is \texttt{/dev/ttyS1},\,\ldots \item Ancient text books, or ignorant authors of new books using obsolete sources \texttt{:-)} may refer to serial ports as \texttt{/dev/cua0}, \texttt{/dev/cua1},\,\ldots \end{itemize} \end{frame} \section{Speed of data} \label{sec:speed} \begin{frame} \frametitle{Speed of data} \begin{itemize} \item Compression allows the flow of data in and out of a modem to exceed the maximum speed of transmission over the phone line by a factor of four \begin{itemize} \item so set the serial speed higher than the modem is capable of transmitting \end{itemize} \item The speed of data transfer over a serial link is measured in bits per second (bps) \item The term ``\emph{baud}\,'' is not the same as ``bits per second'' \begin{itemize} \item baud is a measure of symbols per second. If there is only one bit per symbol, then baud = bit rate, but usually they are different \item All the same, much confusion exists, and in \texttt{wvdial.conf}, the speed in bits per second is set using an option ``Baud''. \end{itemize} \end{itemize} \end{frame} \section{\texttt{pppd} options} \label{sec:pppd-options} \subsection{Where are the options put?} \label{sec:where-are-options-put} \begin{frame} \frametitle{\texttt{pppd} options} \begin{itemize} \item \texttt{pppd} options are set: \begin{itemize} \item in \texttt{/etc/ppp/options} \item in \texttt{/etc/ppp/peers/*} \begin{itemize} \item Enables ordinary users to use options otherwise disallowed by non-\texttt{root} users % are priveleged options rejected in /etc/ppp/options? % on the command line \end{itemize} \item on the command line of \texttt{pppd} \end{itemize} \end{itemize} \end{frame} \subsection{The options} \label{sec:options} \begin{frame} \frametitle{Frequently used options} \begin{description} \item[\texttt{asyncmap} \meta{map}] --- specifies which control characters (ASCII characters lower than space) will be sent as a two-byte escape sequence; usually, need this to be set to zero \item[\texttt{connect} \meta{script}] --- the script called before PPP protocol starts, usually \texttt{chat~\meta{chat-script}} to dial the number \item[\texttt{crtscts}] --- Use hardware flow control \item[\texttt{debug}] --- debugging info to syslog for troubleshooting \item[\texttt{defaultroute}] --- set up a default route via remote PPP peer \item[\texttt{lock}] --- create a lock file to get exclusive access to the serial device \item[\texttt{nodetach}] --- keep \texttt{pppd} in the foreground for debugging \item[\texttt{call} \meta{name}] --- read options from \path{/etc/ppp/peers/name}, including privileged options \item[\texttt{\textbf{\red{persist}}}] --- restart the PPP conection if it fails for any reason. \alert{Mentioned in objectives} \end{description} \end{frame} \section{Other methods of authentication} \label{sec:other-methods-of-authentication} \begin{frame} \frametitle{Other methods of authentication}% The chap example above showed a client logging in responding to username/password prompts (uses \texttt{pppd} option \texttt{noauth}) \begin{description} \item[PAP] --- Password Authentication Protocol: started by client sending a username, password. This information is stored in a simple text file, \path{/etc/ppp/pap-secrets}. I have used PAP with most ISPs. \item[CHAP] --- Challenge Handshake Authentication Protocol: started by server, which sends its name and a challenge. Client responds with its name and a value derived from the challenge and its authentication information, which is stored in \path{/etc/ppp/chap-secrets} \item[MSCHAP] --- It will be a surprise to most that Microsoft, normally a vigorous supporter of IETF and other Internet standards, has gone out on a limb with this one, but it is a Microsoft specific version of CHAP used on MS RAS servers. \end{description} \end{frame} \section{ISDN} \label{sec:isdn} \begin{frame} \frametitle{ISDN} \begin{itemize} \item Most ISDN modems are configured the same way as other dial-up modems. \item I configured a chat script for my parents' ISDN modem using \texttt{wvdial} on Ubuntu Hoary Hedgehog \item Main difference: the device is \texttt{/dev/ttyACM0} \end{itemize} \end{frame} \section{ADSL} \label{sec:adsl} \begin{frame} \frametitle{ADSL} \begin{itemize} \item I use the package \texttt{rp-pppoe} from \url{http://www.roaringpenguin.com/pppoe/} to connect via ADSL to my Internet Service Provider (ISP) \item See the documentation with the package \end{itemize} \end{frame} \section{\texttt{ip-up}, \texttt{ip-down}} \label{sec:ip-up-ip-down} \begin{frame} \frametitle{\texttt{ip-up}, \texttt{ip-down}} \begin{itemize} \item The script \texttt{/etc/ppp/ip-up} is executed when the PPP connection is established \item The script \texttt{/etc/ppp/ip-down} is executed when the PPP connection is disconnected \item I have used \texttt{/etc/ppp/ip-up.local} (executed from \texttt{/etc/ppp/ip-up}) to add static routes when making other PPP connections besides to my ISP \begin{itemize} \item Also useful for telling a dynamic DNS provider that your IP address has changed \end{itemize} \item Both are called with six parameters to let you know what IP addresses you have,\,\ldots \end{itemize} \end{frame} \section{Troubleshooting Connections} \label{sec:troubleshooting-serial} \begin{frame} \frametitle{Troubleshooting Connections} \begin{itemize} \item A \alert{terminal program} is your best tool for troubleshooting a serial connection; examples: \begin{description} \item[\texttt{\textbf{minicom}}] --- the program most likely to be asked about in the exam \item[\texttt{\textbf{kermit}}] --- a more powerful terminal program that has finally been included in most modern distributions since the license was made explicitly free for Linux distributors \end{description} \item Add the option \texttt{debug} to PPP options \item Add the option \texttt{-v} to \texttt{chat} \item use the option \texttt{nodetach} to keep \texttt{pppd} in the foreground \item Increase the level of detail to \texttt{debug} logged by facility daemon in \texttt{/etc/syslog.conf} \item Monitor the \path{/var/log/messages} log file \end{itemize} \end{frame} \mode {% \begin{frame} \frametitle{Topics Covered} %\footnotesize %\begin{multicols}{2} \tableofcontents[pausesections,pausesubsections] %\end{multicols} % You might wish to add the option [pausesections] \end{frame} } \section{License Of This Document} \label{sec:license} \begin{frame} \frametitle{License Of This Document} \raggedright% Copyright \copyright\ 2005 Nick Urbanik \par You can redistribute modified or unmodified copies 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. \end{frame} \end{document}