📄 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 Handbook" href="index.html" /><link rel="UP" title="PPP and SLIP" href="ppp-and-slip.html" /><link rel="PREVIOUS" title="Using Kernel PPP" href="ppp.html" /><link rel="NEXT" title="Using PPP over Ethernet (PPPoE)" href="pppoe.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="ppp.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="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">21.4 Troubleshooting<acronym class="ACRONYM">PPP</acronym> Connections</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Contributed by</span> Tom Rhodes.</i> <p>This section covers a few issues which may arise when using PPP over a modemconnection. For instance, perhaps you need to know exactly what prompts the system youare dialing into will present. Some <acronym class="ACRONYM">ISP</acronym>s present the<var class="LITERAL">ssword</var> prompt, and others will present <varclass="LITERAL">password</var>; if the <tt class="COMMAND">ppp</tt> script is not writtenaccordingly, the login attempt will fail. The most common way to debug <ttclass="COMMAND">ppp</tt> connections is by connecting manually. The following informationwill walk you through a manual connection step by step.</p><div class="SECT2"><h2 class="SECT2"><a id="AEN30857" name="AEN30857">21.4.1 Check the Device Nodes</a></h2><p>If you reconfigured your kernel then you recall the <tt class="DEVICENAME">sio</tt>device. If you did not configure your kernel, there is no reason to worry. Just check the<tt class="COMMAND">dmesg</tt> output for the modem device with:</p><pre class="SCREEN"><samp class="PROMPT">#</samp><kbd class="USERINPUT">dmesg | grep sio</kbd></pre><p>You should get some pertinent output about the <tt class="DEVICENAME">sio</tt>devices. These are the COM ports we need. If your modem acts like a standard serial portthen you should see it listed on <tt class="DEVICENAME">sio1</tt>, or <ttclass="DEVICENAME">COM2</tt>. If so, you are not required to rebuild the kernel, you justneed to make the serial device. You can do this by changing your directory to <ttclass="FILENAME">/dev</tt> and running the <tt class="FILENAME">MAKEDEV</tt> script likeabove. Now make the serial devices with:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3</kbd></pre><p>which will create the serial devices for your system. When matching up sio modem is on<tt class="DEVICENAME">sio1</tt> or <tt class="DEVICENAME">COM2</tt> if you are in DOS,then your modem device would be <tt class="FILENAME">/dev/cuaa1</tt>.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN30878" name="AEN30878">21.4.2 Connecting Manually</a></h2><p>Connecting to the Internet by manually controlling <tt class="COMMAND">ppp</tt> isquick, easy, and a great way to debug a connection or just get information on how your<acronym class="ACRONYM">ISP</acronym> treats <tt class="COMMAND">ppp</tt> clientconnections. Lets start <b class="APPLICATION">PPP</b> from the command line. Note thatin all of our examples we will use <span class="emphasis"><iclass="EMPHASIS">example</i></span> as the hostname of the machine running <bclass="APPLICATION">PPP</b>. You start <tt class="COMMAND">ppp</tt> by just typing <ttclass="COMMAND">ppp</tt>:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ppp</kbd></pre><p>We have now started <tt class="COMMAND">ppp</tt>.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">set device <ttclass="FILENAME">/dev/cuaa1</tt></kbd></pre><p>We set our modem device, in this case it is <tt class="DEVICENAME">cuaa1</tt>.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">set speed 115200</kbd></pre><p>Set the connection speed, in this case we are using 115,200 <acronymclass="ACRONYM">kbps</acronym>.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">enable dns</kbd></pre><p>Tell <tt class="COMMAND">ppp</tt> to configure our resolver and add the nameserverlines to <tt class="FILENAME">/etc/resolv.conf</tt>. If <tt class="COMMAND">ppp</tt>cannot determine our hostname, we can set one manually later.</p><pre class="SCREEN">ppp ON example> <kbd class="USERINPUT">term</kbd></pre><p>Switch to ``terminal'' mode so that we can manually control the modem.</p><pre class="PROGRAMLISTING">deflink: Entering terminal mode on <tt class="FILENAME">/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>Use <tt class="COMMAND">at</tt> to initialize the modem, then use <ttclass="COMMAND">atdt</tt> and the number for your <acronym class="ACRONYM">ISP</acronym>to begin the dial in process.</p><pre class="SCREEN">CONNECT</pre><p>Confirmation of the connection, if we are going to have any connection problems,unrelated to hardware, here is where we will attempt to resolve them.</p><pre class="SCREEN">ISP Login:<kbd class="USERINPUT">myusername</kbd></pre><p>Here you are prompted for a username, return the prompt with the username that wasprovided by the <acronym class="ACRONYM">ISP</acronym>.</p><pre class="SCREEN">ISP Pass:<kbd class="USERINPUT">mypassword</kbd></pre><p>This time we are prompted for a password, just reply with the password that wasprovided by the <acronym class="ACRONYM">ISP</acronym>. Just like logging into FreeBSD,the password will not echo.</p><pre class="SCREEN">Shell or PPP:<kbd class="USERINPUT">ppp</kbd></pre><p>Depending on your <acronym class="ACRONYM">ISP</acronym> this prompt may never appear.Here we are being asked if we wish to use a shell on the provider, or to start <ttclass="COMMAND">ppp</tt>. In this example, we have chosen to use <ttclass="COMMAND">ppp</tt> as we want an Internet connection.</p><pre class="SCREEN">Ppp ON example></pre><p>Notice that in this example the first <var class="OPTION">p</var> has beencapitalized. This shows that we have successfully connected to the <acronymclass="ACRONYM">ISP</acronym>.</p><pre class="SCREEN">PPp ON example></pre><p>We have successfully authenticated with our <acronym class="ACRONYM">ISP</acronym> andare waiting for the assigned <acronym class="ACRONYM">IP</acronym> address.</p><pre class="SCREEN">PPP ON example></pre><p>We have made an agreement on an <acronym class="ACRONYM">IP</acronym> address andsuccessfully completed our connection.</p><pre class="SCREEN">PPP ON example><kbd class="USERINPUT">add default HISADDR</kbd></pre><p>Here we add our default route, we need to do this before we can talk to the outsideworld as currently the only established connection is with the peer. If this fails due toexisting routes you can put a bang character <var class="LITERAL">!</var> in front of the<var class="OPTION">add</var>. Alternatively, you can set this before making the actualconnection and it will negotiate a new route accordingly.</p><p>If everything went good we should now have an active connection to the Internet, whichcould be thrown into the background using <b class="KEYCAP">CTRL</b>+<bclass="KEYCAP">z</b> If you notice the <tt class="COMMAND">PPP</tt> return to <ttclass="COMMAND">ppp</tt> then we have lost our connection. This is good to know becauseit shows our connection status. Capital P's show that we have a connection to the<acronym class="ACRONYM">ISP</acronym> and lowercase p's show that the connection hasbeen lost for whatever reason. <tt class="COMMAND">ppp</tt> only has these 2 states.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN30963" name="AEN30963">21.4.2.1 Debugging</a></h3><p>If you have a direct line and cannot seem to make a connection, then turn hardwareflow <acronym class="ACRONYM">CTS/RTS</acronym> to off with the <var class="OPTION">setctsrts off</var>. This is mainly the case if you are connected to some <bclass="APPLICATION">PPP</b> capable terminal servers, where <bclass="APPLICATION">PPP</b> hangs when it tries to write data to your communication link,so it would be waiting for a <acronym class="ACRONYM">CTS</acronym>, or Clear To Sendsignal which may never come. If you use this option however, you should also use the <varclass="OPTION">set accmap</var> option, which may be required to defeat hardwaredependent on passing certain characters from end to end, most of the time XON/XOFF. Seethe <a href="http://www.FreeBSD.org/cgi/man.cgi?query=ppp&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ppp</span>(8)</span></a> manual page formore information on this option, and how it is used.</p><p>If you have an older modem, you may need to use the <var class="OPTION">set parityeven</var>. Parity is set at none be default, but is used for error checking (with alarge increase in traffic) on older modems and some <acronymclass="ACRONYM">ISP</acronym>s. You may need this option for the Compuserve <acronymclass="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 <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ping&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ping</span>(8)</span></a> with an<acronym class="ACRONYM">IP</acronym> address and see if you can get any returninformation. If you experience 100 percent (100%) packet loss, then it is most likelythat you were not assigned a default route. Double check that the option <varclass="OPTION">add default HISADDR</var> was set during the connection. If you canconnect to a remote <acronym class="ACRONYM">IP</acronym> address then it is possiblethat a resolver address has not been added to the <ttclass="FILENAME">/etc/resolv.conf</tt>. This file should look like:</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 <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=syslog&sektion=3"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">syslog</span>(3)</span></a> provide alogging function for your <b class="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">Using Kernel 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">Using PPP over Ethernet (PPPoE)</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting <<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>>.<br />For questions about this documentation, e-mail <<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>>.</small></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -