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

📄 linux-ppp.html

📁 Linus guide, Linus guide, Linus guide,
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><TITLE>Josh's Linux Guide - Setting Up a Dialup PPP Connection</TITLE>   <META NAME="Description" CONTENT="A small guide on how to set up an Internet dialup PPP connection under Linux.">   <META NAME="keywords" CONTENT="beginners, Linux, how, to, set, up, help, internet, connection, chatscript, dial, modem, PPP"></HEAD><LINK REL="stylesheet" STYLE="text/css" HREF="default.css"><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#7F007F"><H2><A NAME="0">Setting Up a Dialup PPP Connection</A></H2><FONT SIZE="-1"><B>Last updated: October 20, 1999</B></FONT><BR><FONT SIZE="-1"><B>Development stage: Beta</B></FONT><P>Setting up an Internet connection can get tricky, even frustrating,especially if you're a new Linux user. If your ISP is like mostothers, it will use Point-to-Point Protocol. I will first describesetting up and using <B>minicom</B> and <B>pppd</B> separately, andthen using a chatscript. One can connect to the Internet with eitherof these methods; if one doesn't work for you, try the other. If bothwork for you, then you can choose whichever one is the mostconvenient.</P><P>If you want to try to get set up quickly, there's a web-basedconfiguration script that will help you. It uses CGI scripts to createfiles for you to paste into your configuration files in<TT>/etc/ppp/</TT>. The URL is <AHREF="http://www.linux.net.nz/pppconfig/"TARGET="_top">http://www.linux.net.nz/pppconfig/</A>.</P><P><A HREF="mailto:pyromage@net56.net">Lord Pyromage</A> mentioned the<B>pppsetup</B> program, which comes with Slackware. According to him,it makes the PPP setup process much easier. So if you've gotSlackware, you might want to give it a try if you don't want to readthis page.</P><P>If I haven't scared you away by now, read on. Please be patientwith this document. It's long, but reading it will, in all likelihood,make things work if you've tried other documents already. Note thatyour ISP must use PPP in order for this document to work for you. </P><OL><LI><A HREF="#minicom">Using Minicom with PPPd</A>	<UL>	<LI><A HREF="#watchout">Stuff to Watch Out For</A>	<LI><A HREF="#dns">DNS and Nameserver Configuration</A>	<LI><A HREF="#pppoptions">PPP Options</A>	<LI><A HREF="#paporchap">Using PAP or CHAP?</A>	<LI><A HREF="#dial">Dialing In</A>	<LI><A HREF="#routing">Possible Routing Problems</A>	<LI><A HREF="#otherhelp">Other Sources of Help</A>	</UL><LI><A HREF="#chatscript">Using a Chatscript</A><LI><A HREF="#disconnect">Disconnecting</A><LI><A HREF="#modemtrouble">Modem Trouble</A>	<UL>	<LI><A HREF="#winmodem">PnP and Winmodem</A>	<LI><A HREF="#irqconflict">IRQ Conflict</A>	<LI><A HREF="#initstrings">Finding Exact Init Strings</A>	</UL><LI><A HREF="#notes">Author's Notes</A>	<UL>	<LI><A HREF="#nopico">No Pico?</A>	</UL></OL><A NAME="minicom"></A><H3><A NAME="1">Using Minicom with PPPd</A></H3><P>First you should start out by configuring minicom (a terminaldialup program). At the Linux prompt, as root, type <B><TT>minicom-s</TT></B>.</P><P>That will load <TT>minicom</TT> in setup mode; after this, just setup the configurations: modem initialization strings (if you have ageneric modem the initialization string you might want to try usingwould be <TT>AT&amp;D2</TT>; consult your modem manual for the fancyoptions), baud rate, and so on. Make sure all this is done, and thenchoose 'Save as dfl' (saving it as the default) from the main minicommenu.</P><P>If minicom complains about not having /dev/modem, get out of theprogram and type <B><TT>ln -sf /dev/ttyS1 /dev/modem</TT></B>. If yourmodem was on COM2 under DOS or Windows, use that. Otherwise if youhave COM1, for example, you'd use ttyS0 instead of ttyS1. The numberafter the letters is one less, since Linux starts at 0 instead of1.</P><A NAME="watchout"></A><H4><A NAME="2">Stuff to Watch Out For</A></H4><P>I would try watching out for what baud rate you use. Don't use toohigh of a baud rate, or you might be disconnected because of anunstable connection. Also, make sure the baud rate is high enough touse your modem at its highest speed. I put the baud rate up just onesetting above my modem's fastest transfer speed. Your initializationstring could possibly also have something to do with unstableconnections. If you don't know what you're doing (like me), I wouldsuggest that you use a simple initialization string likeAT&amp;D2.</P><A NAME="dns"></A><H4><A NAME="3">DNS and Nameserver Configuration</A></H4><P>At the Linux prompt again, type <TT><B>pico/etc/resolv.conf</B></TT> to enter the nameserver addresses.</P><P>Insert something similar to the following lines, replacing them tomatch your own:</P><PRE>search local.netnameserver 205.136.28.2</PRE><P>A nameserver is a machine that most providers set up to translatethe hostnames of Internet hosts into their IP addresses (for example,it would resolve www.local.net to 205.136.38.10). Many ISPs have morethan one nameserver, so don't be confused if you receive two (or more)addresses when requesting information about your ISP's nameserver. Youmight want someone who is already using Linux to do a <B>dnsquery</B>on your ISP's domain. For example, if your ISP is Local Net (mine) andtheir front page is at <B>http://www.local.net</B>, then have whoeveris doing the DNS query type this:</P><PRE>dnsquery local.net</PRE><P>Or:</P><PRE>dnsquery www.local.net</PRE><P>Again, I'm using my own ISP as an example. There will also probablybe a secondary nameserver for your ISP, so you can use either one, oreven better, both. The nameservers are the last lines in the dnsquery;make sure the person doing the <B>dnsquery</B> knows that. Yours willbe different if you don't use Local Net as your provider. I want theIP address of ns2.local.net, not the hostname.  ns2.local.net is205.136.38.2 so I write that down somewhere.</P><P>Just add that &quot;nameserver&quot; line in<TT>/etc/resolv.conf</TT> followed by the IP address of the actualnameserver (205.136.38.2) and complete the rest of the process. Youcan also call up your ISP through the phone and ask them the IPaddress of the nameserver, if you don't know anyone who is already onLinux or who can find out. If you already know what your ISP'snameserver is, then you didn't really need to read the previous fewparagraphs on the nameserver.</P><P>As far as I know, you can use anybody's nameserver as long as youhave the IP address (numerical, e.g. 205.226.156.2) for it. That meansyou can have your /etc/resolv.conf file look exactly like mine and itwould still work.</P><A NAME="pppoptions"></A><H4><A NAME="4">PPP Options</A></H4><P>Now you also should edit <TT>/etc/ppp/options</TT> by typing<B><TT>pico /etc/ppp/options</TT></B>. This is really important instarting point-to-point protocol (PPP). If you don't fill it in you'llhave to specify the options every time you type <B><TT>pppd</TT></B>,and that's would be a big hassle. Insert the following lines into thefile:</P><PRE>0.0.0.0:/dev/ttyS1lockcrtsctsdefaultrouteasyncmap 0mtu 576mru 576</PRE><P>The only thing you might need to change is the device entry thattells which device to use for PPP. On my computer, with my externalmodem using COM2, it's <TT>/dev/ttyS1</TT>. You should know what COMport your modem is using, either from your experience as a DOS/Windowsuser or as a frequent Linux user (which you're probably not... fornow).</P><P>Once you find that, you can refer to that device using<TT>/dev/modem</TT> by making a symbolic link from <TT>/dev/ttySX</TT>('X' representing whatever that number is) to <TT>/dev/modem</TT>. Do thisby typing the following:</P><PRE>ln -s /dev/ttyS1 /dev/modem</PRE><P>Replace <TT>ttyS1</TT> with whatever the device that you're using is,if necessary. The basic way to remember is that ttyS0 is actually COM1under DOS, ttyS1 is COM2, ttyS2 is COM3, and so on; the number following&quot;ttyS&quot; is just one number less than the number following&quot;COM&quot; in DOS or Windows.</P><P>The <TT>0.0.0.0:</TT> should be put in the PPP options file if youhave a dynamic IP address (your IP address/hostname is randomlyassigned to you by your ISP and usually changes everytime youestablish an Internet connection). If you have a static IP address(one which remains the same each time you connect), put in the IPaddress that you have been given. If you don't know, you probably have a dynamic IP, so use <TT>0.0.0.0</TT>.</P><P>The mru and mtu lines are your receiving and transmitting packet sizes,I think. I heard someone on IRC ask how to lower the packet size so that alarge download wouldn't get in the way of other accesses to the Internetgoing on at the same time. The speed you can transfer is still the same;it's just smaller packet sizes. A packet size of 576 is smaller than apacket size of 1024.</P><P>After all this is done, all you'll have to do is type<B><TT>minicom</TT></B> as root and then <B><TT>pppd</TT></B> as root.Minicom can be executed by all users, but the Point-to-Point ProtocolDaemon (pppd) can only be executed by the superuser (root). I triedchanging permissions on the file <TT>/usr/sbin/pppd</TT>. If you everaccidentally change the permissions on the <B><TT>pppd</TT></B>file/executable, just type <B><TT>chmod 755 pppd</TT></B> from the/usr/sbin/ directory, as root. If you didn't mess with the permissions,you won't need to do the <B><TT>chmod</TT></B> stuff.</P><A NAME="paporchap"></A><H4><A NAME="5">Using PAP or CHAP?</A></H4><P>More and more ISPs are switching to PAP or CHAP authentication, whichrequires a little extra work on your part. Fortunately, this wasn't ashard as I thought it would be. If you're sure your ISP doesn't use PAP orCHAP, you can skip on to the next section. If you use PAP or CHAP, youwon't be presented with a login prompt when you dial in with<B>minicom</B>, so that's how you know.</P><P>You need to fill in <TT>/etc/ppp/pap-secrets</TT> if your ISP uses PAP,or <TT>/etc/ppp/chap-secrets</TT> if your ISP uses CHAP. Those filesshould already be in there, but if they're not, create whichever one youneed. All that you really need to do is fill in the chap-secrets (orpap-secrets) file like this:</P><PRE># Secrets for authentication using CHAP# client        server  secret                  IP addressesdork		*	unpopular</PRE><P>That's where 'dork' is the username, and 'unpopular' is the password. The asterisk (*) can be left like that. The pap-secrets file also uses thesame syntax, just a different filename.</P><P>In the PPP options file (/etc/ppp/options) it should look like what itwas, except with one extra line.</P><PRE>0.0.0.0:/dev/ttyS1lockcrtsctsdefaultrouteasyncmap 0mtu 552mru 552name dork</PRE><P>That extra line is <TT>name dork</TT>, which tells pppd to use thatusername along with the chap-secrets (or pap-secrets) information whenasked for authentication.</P><P>I use CHAP authentication for my new ISP but instead of just theusername, they want the username@domain.net (pretty weird, huh?), soinstead of just &quot;name dork&quot; in /etc/ppp/options I would haveto put in &quot;name dork@ynn.com&quot;. That also goes for/etc/ppp/chap-secrets. Instead of &quot;dork&quot; under&quot;client&quot; I had to put in&quot;dork@ynn.com&quot;. Mindspring, a well-known ISP, does thisalso; it helps distinguish between people who have one service from asmaller acquired ISP from another acquired ISP, both still using theirold names. They might have the same username, and this kind ofprevents conflict. Thanks to <AHREF="mailto:xmonki@mindspring.net">Mark Peters</A> of Mindspring forthis information.</P><P>In many other cases, you may only have to fill in the username.</P><A NAME="dial"></A><H4><A NAME="6">Dialing In</A></H4><P>Now, to establish the dialup connection, run <TT>minicom</TT>. When itloads, it should show the initialization string with the cursor at the endof the text string. Press enter and it should say &quot;OK&quot;. Type<TT>ATDT #phone#</TT>, where &quot;#phone#&quot; is the phone number todial. When the other end picks up, it should prompt you for a login nameand password, which you should type in. If you are using PAP or CHAP, just use the Alt-q combination (or Ctrl-a, q if that doesn't work) and answer &quot;Yes&quot; right there without entering the username/password sequence. For some ISPs it will ask whether to use PPP or not. Obviously, you want to answer yes. When it shows the PPP data (the stuff that looks like junk andgarbage: *&*&*!^%#!^$!%%@#&^$%&*!$%), press Alt-Q and answer 'yes' to&quot;Exit without reset?&quot;. That should take you back to the prompt,

⌨️ 快捷键说明

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