📄 ppp-troubleshoot.html
字号:
<!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>Troubleshooting PPP Connections</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD 使用手册" href="index.html" /><link rel="UP" title="PPP 和 SLIP" href="ppp-and-slip.html" /><link rel="PREVIOUS" title="使用内核级PPP" href="ppp.html" /><link rel="NEXT" title="使用基于以太网的PPP(PPPoE)" href="pppoe.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /></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 使用手册</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="ppp.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 18. PPP 和 SLIP</td><td width="10%" align="right" valign="bottom"><a href="pppoe.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="PPP-TROUBLESHOOT" name="PPP-TROUBLESHOOT">18.4. Troubleshooting<acronym class="ACRONYM">PPP</acronym> Connections</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Contributed by</span> Tom Rhodes.</i> <p>本节将讲述通过modem连接使用PPP时可能出现的问题 .例如,你可能需要确切地知道你拨入的系统会出现一个怎样的命令行提示符.有些<acronymclass="ACRONYM">ISP</acronym>会提供 <varclass="LITERAL">ssword</var>提示符,而其它的可能会出现 <varclass="LITERAL">password</var>; 如果没有根据情况的不同相应地编写<ttclass="COMMAND">ppp</tt> 脚本,登录就会失败.诊断<ttclass="COMMAND">ppp</tt>最常用的方法是手动进行连接 .以下的信息会一步一步地带你完成手动连接.</p><div class="SECT2"><h2 class="SECT2"><a id="AEN24301" name="AEN24301">18.4.1. 检查设备节点</a></h2><p>如果你的内核是经过重新配置的,那么就需要检查<tt class="DEVICENAME">sio</tt>设备.如果没有配置过内核, 就没什么可担心的了.只要查看 <ttclass="COMMAND">dmesg</tt>的输出以找到modem设备:</p><pre class="SCREEN"><samp class="PROMPT">#</samp><kbd class="USERINPUT">dmesg | grep sio</kbd></pre><p>你应该找到与<tt class="DEVICENAME">sio</tt>设备有关的输出. 这些就是我们需要的COM端口.如果你的modem按照标准串行端口工作,你能在<tt class="DEVICENAME">sio1</tt>或COM2找到它.如果是这样, 你只需创建serial设备,而不必重建内核. cd到<ttclass="FILENAME">/dev</tt>目录,然后运行 <tt class="FILENAME">MAKEDEV</tt>脚本 :</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3</kbd></pre><p>它会为你的系统创建串行(serial)设备. 如果modem设备连接在<ttclass="DEVICENAME">sio1</tt>接口(在DOS中称为COM2),那么你的modem将会是 <ttclass="DEVICENAME">/dev/cuaa1</tt>.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN24320" name="AEN24320">18.4.2. 手动连接</a></h2><p>通过手动控制<tt class="COMMAND">ppp</tt>来连接Internet 是诊断连接及获知<acronymclass="ACRONYM">ISP</acronym>处理<bclass="APPLICATION">PPP</b>客户端方式的一个快速,简单的方法. .让我们从<bclass="APPLICATION">PPP</b> 命令行开始.在所有的例子中我们使用 <span class="emphasis"><iclass="EMPHASIS">example</i></span>作为运行<bclass="APPLICATION">PPP</b>主机的主机名.键入<tt class="COMMAND">ppp</tt> 命令打开<ttclass="COMMAND">ppp</tt> :</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ppp</kbd></pre><p>现在我们已经打开了<tt class="COMMAND">ppp</tt>.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">set device <ttclass="DEVICENAME">/dev/cuaa1</tt></kbd></pre><p>设置modem设备,在本例子中是 <tt class="DEVICENAME">cuaa1</tt>.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">set speed 115200</kbd></pre><p>设置连接速度,在本例中我们使用15,200 <acronym class="ACRONYM">kbps</acronym>.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">enable dns</kbd></pre><p>使<tt class="COMMAND">ppp</tt>配置域名服务, 在文件<ttclass="FILENAME">/etc/resolv.conf</tt>中添加域名服务器行. .如果 <ttclass="COMMAND">ppp</tt>不能确定我们的主机名,可以在稍后设置.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">term</kbd></pre><p>切换到 ``终端''样我们就能手动地控制模式,这modem.</p><pre class="PROGRAMLISTING">deflink: Entering terminal mode on <tt class="DEVICENAME">/dev/cuaa1</tt>type '~h' for help</pre><pre class="SCREEN"><kbd class="USERINPUT">at</kbd> OK <kbd class="USERINPUT">atdt<var class="REPLACEABLE">123456789</var></kbd></pre><p>使用命令<tt class="COMMAND">at</tt>初始化modem, 然后使用<ttclass="COMMAND">atdt</tt>和<acronym class="ACRONYM">ISP</acronym>给你的号码进行拨号.</p><pre class="SCREEN">CONNECT</pre><p>连接配置,如果我们遇到了与硬件无关的连接问题,可以在这里尝试解决.</p><pre class="SCREEN">ISP Login:<kbd class="USERINPUT">myusername</kbd></pre><p>这里提示你输入用户名,输入<acronymclass="ACRONYM">ISP</acronym>提供的用户名然后按回车.</p><pre class="SCREEN">ISP Pass:<kbd class="USERINPUT">mypassword</kbd></pre><p>这时提示我们输入密码,输入 <acronym class="ACRONYM">ISP</acronym>提供的密码.如同登录入FreeBSD,密码不会显示.</p><pre class="SCREEN">Shell or PPP:<kbd class="USERINPUT">ppp</kbd></pre><p>由于<acronymclass="ACRONYM">ISP</acronym>的不同,这个提示符可能不会出现.这里我们被问及:是使用一个运行于提供商端的Shell还是启动<tt class="COMMAND">ppp</tt>. 这本例中,我们选择使用<ttclass="COMMAND">ppp</tt>因为我 们想得到Internet连接.</p><pre class="SCREEN">Ppp ON example></pre><p>注意在这个例子中,第一个 <var class="OPTION">p</var>已经大写.这显示我们已经成功地连接上了<acronym class="ACRONYM">ISP</acronym>.</p><pre class="SCREEN">PPp ON example></pre><p>我们已经成功通过了 <acronym class="ACRONYM">ISP</acronym>的验证,正在等待分配<acronymclass="ACRONYM">IP</acronym>地址.</p><pre class="SCREEN">PPP ON example></pre><p>我们得到了一个 <acronym class="ACRONYM">IP</acronym> 地址,成功地完成了连接.</p><pre class="SCREEN">PPP ON example><kbd class="USERINPUT">add default HISADDR</kbd></pre><p>这里,我们添加默认路由.在能与外界通信之前我们需要这样做,因为现在我们只与服务器端建立了连接.如果由于已存在的路由而导致操作失败, 你可以在<varclass="OPTION">add</var>前加<var class="LITERAL">!</var>号.作为另外一种方式,你也可以在真正连接之前设置这些(指add defaultHISADDR),ppp会根据这项设定协商取 得一个新的路由.</p><p>如果一切顺利,现在我们应该能得到一个活动的Internet连接,可以使用<bclass="KEYCAP">CTRL</b>+<b class="KEYCAP">z</b>使其转入后台.如果你发现 <ttclass="COMMAND">PPP</tt>重新变为 <tt class="COMMAND">ppp</tt>,那代表我们失去了连接..大写的P表明我们有到<acronym class="ACRONYM">ISP</acronym>的连接而小写的p表明由于某种原因我们失去了连接.这便于我们了解连接状态. <ttclass="COMMAND">ppp</tt> 只有这两个状态.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN24405" name="AEN24405">18.4.2.1. 诊断排错</a></h3><p>如果你有一根直连线且似乎不能建立连接,要使用<var class="OPTION">set ctsrtsoff</var>以关闭字节流的<acronym class="ACRONYM">CTS/RTS</acronym>.这种情况一般发生在连接兼容<b class="APPLICATION">PPP</b>的终端服务器时. 当它向通信连接写入数据时,<bclass="APPLICATION">PPP</b>就会挂起, 一直等待一个<acronym class="ACRONYM">CTS</acronym>,或者一个不可能出现的Clear to Send信号.如果使用了这个选项,你还应该使用 <varclass="OPTION">set accmap</var>选项 , which may be required to defeat hardware dependenton passing certain characters from end to end, most of the time XON/XOFF. See the <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ppp</span>(8)</span> manual page formore information on this option, and how it is used.</p><p>如果你有一个比较旧的modem, 你要用 <var class="OPTION">set parityeven</var>.Parity被默认地设置为 none , but is used for error checking (with a largeincrease in traffic) on older modems and some <acronym class="ACRONYM">ISP</acronym>s.You may need this option for the Compuserve <acronym class="ACRONYM">ISP</acronym>.</p><p><b class="APPLICATION">PPP</b> may not return to the command mode, which is usually anegotiation error where the <acronym class="ACRONYM">ISP</acronym> is waiting for yourside to start negotiating. At this point, using the <tt class="COMMAND">~p</tt> commandwill force ppp to start sending the configuration information.</p><p>If you never obtain a login prompt, then most likely you need to use <acronymclass="ACRONYM">PAP</acronym> or <acronym class="ACRONYM">CHAP</acronym> authenticationinstead of the <span class="TRADEMARK">UNIX</span>® style in the example above. Touse <acronym class="ACRONYM">PAP</acronym> or <acronym class="ACRONYM">CHAP</acronym>just add the following options to <b class="APPLICATION">PPP</b> before going intoterminal mode:</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">set authname <varclass="REPLACEABLE">myusername</var></kbd></pre><p>Where <var class="REPLACEABLE">myusername</var> should be replaced with the usernamethat was assigned by the <acronym class="ACRONYM">ISP</acronym>.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">set authkey <varclass="REPLACEABLE">mypassword</var></kbd></pre><p>Where <var class="REPLACEABLE">mypassword</var> should be replaced with the passwordthat was assigned by the <acronym class="ACRONYM">ISP</acronym>.</p><p>If you connect fine, but cannot seem to find any domain name, try to use <spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ping</span>(8)</span> with an <acronymclass="ACRONYM">IP</acronym> address and see if you can get any return information. Ifyou experience 100 percent (100%) packet loss, then it is most likely that you were notassigned a default route. Double check that the option <var class="OPTION">add defaultHISADDR</var> was set during the connection. If you can connect to a remote <acronymclass="ACRONYM">IP</acronym> address then it is possible that a resolver address has notbeen added to the <tt class="FILENAME">/etc/resolv.conf</tt>. This file should looklike:</p><pre class="PROGRAMLISTING">domain <var class="REPLACEABLE">example.com</var>nameserver <var class="REPLACEABLE">x.x.x.x</var>nameserver <var class="REPLACEABLE">y.y.y.y</var></pre><p>Where <var class="REPLACEABLE">x.x.x.x</var> and <varclass="REPLACEABLE">y.y.y.y</var> should be replaced with the <acronymclass="ACRONYM">IP</acronym> address of your <acronym class="ACRONYM">ISP</acronym>'s DNSservers. This information may or may not have been provided when you signed up, but aquick call to your <acronym class="ACRONYM">ISP</acronym> should remedy that.</p><p>You could also have <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">syslog</span>(3)</span> provide a logging function for your <bclass="APPLICATION">PPP</b> connection. Just add:</p><pre class="PROGRAMLISTING">!ppp*.* /var/log/ppp.log</pre><p>to <tt class="FILENAME">/etc/syslog.conf</tt>. In most cases, this functionalityalready exists.</p></div></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="ppp.html" accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="pppoe.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">使用内核级PPP</td><td width="34%" align="center" valign="top"><a href="ppp-and-slip.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">使用基于以太网的PPP(PPPoE)</td></tr></table></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -