⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ppp.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Using Kernel PPP</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="PPP and SLIP" href="ppp-and-slip.html" /><link rel="PREVIOUS" title="Using User PPP" href="userppp.html" /><link rel="NEXT" title="Troubleshooting PPP Connections" href="ppp-troubleshoot.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="userppp.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 21 PPP and SLIP</td><td width="10%" align="right" valign="bottom"><a href="ppp-troubleshoot.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="PPP" name="PPP">21.3 Using Kernel PPP</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Parts originally contributed by</span>Gennady B. Sorokopud and Robert Huff.</i> <div class="SECT2"><h2 class="SECT2"><a id="AEN30717" name="AEN30717">21.3.1 Setting Up Kernel PPP</a></h2><p>Before you start setting up PPP on your machine, make sure that <ttclass="COMMAND">pppd</tt> is located in <tt class="FILENAME">/usr/sbin</tt> and thedirectory <tt class="FILENAME">/etc/ppp</tt> exists.</p><p><tt class="COMMAND">pppd</tt> can work in two modes:</p><ol type="1"><li><p>As a ``client'' -- you want to connect your machine to the outside world via a PPPserial connection or modem line.</p></li><li><p>As a ``server'' -- your machine is located on the network, and is used to connectother computers using PPP.</p></li></ol><p>In both cases you will need to set up an options file (<ttclass="FILENAME">/etc/ppp/options</tt> or <tt class="FILENAME">~/.ppprc</tt> if you havemore than one user on your machine that uses PPP).</p><p>You will also need some modem/serial software (preferably <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/comms/kermit/pkg-descr"><ttclass="FILENAME">comms/kermit</tt></a>), so you can dial and establish a connection withthe remote host.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN30743" name="AEN30743">21.3.2 Using <ttclass="COMMAND">pppd</tt> as a Client</a></h2><i class="AUTHORGROUP"><span class="CONTRIB">Based on information provided by</span> TrevRoydhouse.</i> <p>The following <tt class="FILENAME">/etc/ppp/options</tt> might be used to connect to aCisco terminal server PPP line.</p><pre class="PROGRAMLISTING">crtscts         # enable hardware flow controlmodem           # modem control linenoipdefault     # remote PPP server must supply your IP address                # if the remote host does not send your IP during IPCP                # negotiation, remove this optionpassive         # wait for LCP packetsdomain ppp.foo.com      # put your domain name here:&lt;remote_ip&gt;    # put the IP of remote PPP host here                # it will be used to route packets via PPP link                # if you didn't specified the noipdefault option                # change this line to &lt;local_ip&gt;:&lt;remote_ip&gt;defaultroute    # put this if you want that PPP server will be your                # default router</pre><p>To connect:</p><div class="PROCEDURE"><ol type="1"><li><p>Dial to the remote host using <b class="APPLICATION">kermit</b> (or some other modemprogram), and enter your user name and password (or whatever is needed to enable PPP onthe remote host).</p></li><li><p>Exit <b class="APPLICATION">kermit</b> (without hanging up the line).</p></li><li><p>Enter the following:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">/usr/src/usr.sbin/pppd.new/pppd <varclass="REPLACEABLE">/dev/tty01</var> <var class="REPLACEABLE">19200</var></kbd></pre><p>Be sure to use the appropriate speed and device name.</p></li></ol></div><p>Now your computer is connected with PPP. If the connection fails, you can add the <varclass="OPTION">debug</var> option to the <tt class="FILENAME">/etc/ppp/options</tt> file,and check console messages to track the problem.</p><p>Following <tt class="FILENAME">/etc/ppp/pppup</tt> script will make all 3 stagesautomatic:</p><pre class="PROGRAMLISTING">#!/bin/shps ax |grep pppd |grep -v greppid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`if [ "X${pid}" != "X" ] ; then        echo 'killing pppd, PID=' ${pid}        kill ${pid}fips ax |grep kermit |grep -v greppid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`if [ "X${pid}" != "X" ] ; then        echo 'killing kermit, PID=' ${pid}        kill -9 ${pid}fiifconfig ppp0 downifconfig ppp0 deletekermit -y /etc/ppp/kermit.dialpppd /dev/tty01 19200</pre><p><tt class="FILENAME">/etc/ppp/kermit.dial</tt> is a <b class="APPLICATION">kermit</b>script that dials and makes all necessary authorization on the remote host (an example ofsuch a script is attached to the end of this document).</p><p>Use the following <tt class="FILENAME">/etc/ppp/pppdown</tt> script to disconnect thePPP line:</p><pre class="PROGRAMLISTING">#!/bin/shpid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`if [ X${pid} != "X" ] ; then        echo 'killing pppd, PID=' ${pid}        kill -TERM ${pid}fips ax |grep kermit |grep -v greppid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`if [ "X${pid}" != "X" ] ; then        echo 'killing kermit, PID=' ${pid}        kill -9 ${pid}fi/sbin/ifconfig ppp0 down/sbin/ifconfig ppp0 deletekermit -y /etc/ppp/kermit.hup/etc/ppp/ppptest</pre><p>Check to see if <tt class="COMMAND">pppd</tt> is still running by executing <ttclass="FILENAME">/usr/etc/ppp/ppptest</tt>, which should look like this:</p><pre class="PROGRAMLISTING">#!/bin/shpid=`ps ax| grep pppd |grep -v grep|awk '{print $1;}'`if [ X${pid} != "X" ] ; then        echo 'pppd running: PID=' ${pid-NONE}else        echo 'No pppd running.'fiset -xnetstat -n -I ppp0ifconfig ppp0</pre><p>To hang up the modem, execute <tt class="FILENAME">/etc/ppp/kermit.hup</tt>, whichshould contain:</p><pre class="PROGRAMLISTING">set line /dev/tty01    ; put your modem device hereset speed 19200set file type binaryset file names literalset win 8set rec pack 1024set send pack 1024set block 3set term bytesize 8set command bytesize 8set flow nonepau 1out +++inp 5 OKout ATH0\13echo \13exit</pre><p>Here is an alternate method using <tt class="COMMAND">chat</tt> instead of <ttclass="COMMAND">kermit</tt>:</p><p>The following two files are sufficient to accomplish a <tt class="COMMAND">pppd</tt>connection.</p><p><tt class="FILENAME">/etc/ppp/options</tt>:</p><pre class="PROGRAMLISTING">/dev/cuaa1 115200crtscts     # enable hardware flow controlmodem       # modem control lineconnect "/usr/bin/chat -f /etc/ppp/login.chat.script"noipdefault # remote PPP serve must supply your IP address            # if the remote host doesn't send your IP during                # IPCP negotiation, remove this optionpassive         # wait for LCP packetsdomain &lt;your.domain&gt;  # put your domain name here:       # put the IP of remote PPP host here            # it will be used to route packets via PPP link                # if you didn't specified the noipdefault option                # change this line to &lt;local_ip&gt;:&lt;remote_ip&gt;defaultroute    # put this if you want that PPP server will be            # your default router</pre><p><tt class="FILENAME">/etc/ppp/login.chat.script</tt>:</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> The following should go on a single line.</p></blockquote></div><pre class="PROGRAMLISTING">ABORT BUSY ABORT 'NO CARRIER' "" AT OK ATDT&lt;phone.number&gt;  CONNECT "" TIMEOUT 10 ogin:-\\r-ogin: &lt;login-id&gt;  TIMEOUT 5 sword: &lt;password&gt;</pre><p>Once these are installed and modified correctly, all you need to do is run <ttclass="COMMAND">pppd</tt>, like so:</p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -