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

📄 how to hook up ppp in linux.htm

📁 How to Hook up PPP in Linux
💻 HTM
📖 第 1 页 / 共 5 页
字号:
</PRE>and then restart the syslog-ng daemon. (killall -1 syslog-ng) <BR>I do not 
have such a syslog-ng system, so am unable to test this. Perhaps someone who 
does could drop me a note letting me know if it works or to correct my mistakes. 
<A name=Resolver></A>
<H3>Resolver Information</H3>The computers on the internet are referenced by 
numbers called IP numbers. However, people, being bad at remembering numbers, 
use names instead (eg, www.theory.physics.ubc.ca instead of 142.103.234.29). The 
name resolver is a program that asks another computer, the nameserver, to 
translate internet names to IP numbers which your computer can actually use. In 
order that, once you are connected, you are able to actually resolve host names, 
<BR>edit /etc/resolv.conf and add a line (or lines) like <BR><I>nameserver 
111.222.333.444</I> <BR>Instead of 111.222.333.444 use the Domain Name Server IP 
address (DNS-IPaddress) which your ISP gave you. If they gave you two numbers 
enter another nameserver line with the second address. <BR>It can also be useful 
to include a line like <BR><I>domain ISP.domain.name</I> <BR>where 
ISP.domain.name is the domain name of your ISP. For example, my /etc/resolv.conf 
file looks like <PRE>domain  physics.ubc.ca
nameserver 137.82.43.9
nameserver 137.82.1.1
</PRE>[Note: Do NOT put leading zeros on any of those numbers. They will not 
work. 137.082.43.9 is a different number from 137.82.43.9] 
<P>Edit /etc/host.conf and make sure the line <BR><I>order hosts, bind</I> 
<BR>is in there. <BR>Also check /etc/nsswitch.conf and make sure a line like 
<BR><I>hosts: files dns</I> <BR>is there. (that line may also contain other 
options like nis, which will do no harm) 
<P>Also make sure that all of these files are readable by everyone. <BR><B>chmod 
a+r /etc/resolv.conf /etc/host.conf /etc/nsswitch.conf</B> <A 
name=NoDefault></A>
<H3>No Default Route</H3>Your computer passes messages for addresses it does not 
know to the default route. ppp assumes that there can only be one default route 
on any system. This is almost always the route to ISP's computer. However, if 
pppd finds that a default route already exists, it will not set up one to your 
ISP, causing problems (nothing gets through). In order that you not have any 
conflicts between the routing across ppp and onto some network you have, run 
<BR><B>/sbin/route -n</B> <BR>(or you can also run <BR><B>/bin/netstat -nr</B> 
<BR>which does the same thing) <BR>while not connected via ppp, and look for a 
default entry. (First entry in line is 0.0.0.0). This almost certainly should 
not be there. (Unless you already have a hookup to the internet via an Ethernet 
connection, you do not want such a default route.) Unless you know that your 
computer has an Ethernet connection to other computers already, the only thing 
there should be a route to 127.0.0.1 or 127.0.0.0 If there is such a default 
route (line starting with 0.0.0.0), and you want the ppp interface to be your 
default route, (the usual situation), run <BR><B>/sbin/route del default</B> 
<BR>Also find out what was setting that wrong default route, and stop it from 
doing so. (If you cannot figure out what is doing so, put that line 
<BR><I>/sbin/route del default</I> <BR>at the end of whichever of /etc/rc.local 
or /etc/rc.d/rc.local exists on your system.) <A name=PPPDModule></A>
<H3>PPPD module support</H3>Now check to see if the module support for ppp is 
set up properly. Run <BR><B>/usr/sbin/pppd </B><BR>You should get a line of 
garbage which repeats about 10 times and then the command exits. This is good. 
Skip to the PPPD Options section. <BR>If you get nothing and the command return 
to the prompt after about 10 seconds, this is probably OK as well, but try 
<BR><B>/usr/sbin/pppd notty</B><BR>This should give you the lines of garbage. If 
you do get this line of garbage, skip the next section. If you do not get that 
line of garbage, it is probable that the module support is not set up properly. 
<H4>Setting up module support</H4>If you did not get that line of garbage, but 
instead get "permission denied", you are not running as root. Log on as root and 
try again. <BR>If you get a message saying that your kernel does not support 
ppp, do <B>not</B> recompile the kernel. This error message is a grab bag error 
message which the pppd program produces almost anytime something goes wrong. The 
response depends on the kernel version you are running. 
<UL>
  <LI><A name=2.0></A>
  <H4>2.0.x</H4>What this error saying your kernel does not support ppp almost 
  certainly means in the 2.0.x series of kernels is that you are not running 
  kerneld. <BR>To test if kerneld is running, run the command <BR><B>ps aux|grep 
  kerneld|grep -v grep</B> <BR>It will produce output if kerneld is running. If 
  kerneld is running and you get this error message, try doing <BR><B>insmod 
  slhc <BR>insmod ppp</B> <BR>and try again. ( these load the modules 
  permanently and you may have to put those lines into the file rc.local 
  (/etc/rc.d/rc.local on RedHat and in various places under /etc on other 
  distributions) <BR>(If none of this works, then there are more severe problems 
  that this note cannot solve.) <BR>Assuming that you find that kerneld is not 
  running, then on a Redhat system, run <BR><B>/etc/rc.d/init.d/kerneld 
  start</B> <BR>or even just <BR><B>/sbin/kerneld</B> <BR>(which should work on 
  any Linux system). 
  <P>[ If kerneld was not running, you will need to make sure that it is set to 
  run each time you switch on your system. Unfortunately every distribution has 
  a slightly different way of starting up daemons at bootup. In Redhat, also 
  make sure that there are lines like S01kerneld as links to 
  /etc/rc.d/init.d/kerneld in each of the directories /etc/rc.d/rc1.d to 
  /etc/rc.d/rc5.d in RedHat. On other systems, you may need to put a line like 
  <BR><B>/sbin/kerneld</B> <BR>into /etc/rc.local, or /etc/rc.d/rc.local, or 
  ....] </P>
  <LI><A name=2.2></A>
  <H4>2.2.x kernels</H4>These kernels use a kernel procedure kmod to load the 
  modules, rather than kerneld. Everything should work automatically. If you 
  have trouble, make sure that the modules <I>ppp.o</I> and <I>slhc.o</I> exit 
  in /lib/modules/2.2*/net <BR>Also make sure that you have the following 
  entries in your /etc/conf.modules (on earlier versions of the 2.2.x series) or 
  /etc/modules.conf (on later versions). <PRE>alias tty-ldisc-3   ppp
alias ppp-compress-21   bsd_comp
alias ppp-compress-24   ppp_deflate
alias ppp-compress-26   ppp_deflate
</PRE>
  <LI><A name=2.4></A>
  <H4>2.4.x kernels</H4>The kernel ppp handling was completely rewritten for the 
  2.4.x series of kernels. In this case you MUST make sure that you are running 
  the 2.4.y versions of pppd. Use at least pppd 2.4.1 as 2.4.0 had a number of 
  bugs. Furthermore, you must ensure that your system is set up properly for 
  pppd. Check to see if the device, <I>/dev/ppp</I> exists. If it does 
  everything should be OK. If it does not, first check that the new modules 
  <I>ppp_generic.o</I> and <I>ppp_async.o</I> exist in /lib/modules/2.4.*/net. 
  Then try loading the ppp_generic module <BR><B>modprobe ppp_generic</B> 
  <BR>and then see if it now exists. If it still does not exist, make sure that 
  the file /etc/devfsd.conf contains the line <PRE> LOOKUP      ppp       MODLOAD
</PRE>Otherwise you can create the device with <BR><B>mknod /dev/ppp c 108 0 
  <BR>chmod 600 /dev/ppp </B><BR>Also make sure that you have the following 
  entries in /etc/modules.conf (note the change in name from /etc/conf.modules 
  in earlier kernel versions) <PRE>alias /dev/ppp      ppp_generic
alias char-major-108    ppp_generic
alias tty-ldisc-3   ppp_async
alias tty-ldisc-14  ppp_synctty
alias ppp-compress-21   bsd_comp
alias ppp-compress-24   ppp_deflate
alias ppp-compress-26   ppp_deflate
</PRE></LI></UL>
<P><A name=pppoe></A>
<H4>PPPoE</H4>Many cable companies are offering ppp connections via the TV cable 
connection. This connection is an Ethernet connection. Unfortunately many of the 
cable companies have bought onto a bastardisation called PPP over Ethernet 
(PPPoE). Why one should want to layer a ppp connection over something which 
already provides a layer which can handle any of the higher layers (Ethernet) is 
mysterious, but as consumers with monopoly cable suppliers we often have no say 
in the matter. Thus, if this is the bind you are caught in, go to <A 
href="http://www.roaringpenguin.com/penguin/open_source_rp-pppoe.php">Roaring 
Penguin</A> to get their implementation. All reports I have read state that it 
is vastly superiour to anything your cable company may try to supply you with. 
<BR>In the 2.4.x kernels, there is also experimental support for kernel mode 
pppoe, which should in theory be faster. It seems that some distributions supply 
it already compiled in as a module (Mandrake 8.0 and later), but otherwise you 
will have to recompile your kernel. Then got to <A 
href="http://www.soshin.waterloo.ca/~mostrows">Mike Mostrows'</A> page to get a 
patched version of ppp 2.4.1. Also go to the Roaring Penguin page to get the 
other programs needed to run pppoe. Then be prepared to solve any problems on 
your own since neither I nor Roaring Penguin will or can help you. 
<P><A name=Hostname></A>
<H4>Hostname</H4>One final item, especially for Redhat systems, make sure that 
your give your machine a name (any single word name you want). You can set it 
with <BR><B>hostname &lt;yourhostname&gt;</B> <BR>But you also want to change it 
permanently. In Redhat/Mandrake, put the line 
<BR><I>HOSTNAME=&lt;yourhostname&gt;</I> <BR>into /etc/sysconfig/network. On 
other systems I am not sure, but you could always put the hostname command at 
the end of your rc.local file. This is not essential to running ppp, but if you 
do not do it, you will find yourself unable to run any X application while 
running ppp. <A name=PPPOptions></A>
<H3>PPP Options</H3>
<P>You have now set up the critical files on your system and you know that you 
have an operational pppd. You now need to set up the ppp options so that you can 
get debugging information when you try to connect, and so that it is minimally 
usable. <BR>Edit /etc/ppp/options so it contains <BR><I>lock</I> 
<BR><I>crtscts</I> <BR><I>defaultroute</I> <BR><I>noauth</I> <BR>[note that if 
you are in the unlikely situation that you already have a working default route 
to an Ethernet, omit the <I>defaultroute</I> option. If you are not sure, put 
that option in.] <BR>[Also other options can be used. In general do not do so 
unless advised to do so. More harm is done by putting in too many obscure 
options than by putting in too few. If you have a local Ethernet, and if your 
ISP demands that they assign your IP address for the ppp connection, then also 
use <BR><I>noipdefault</I><BR>You could also put in a line containing 
<I>debug</I> here but we will use it explicitly on the command line.] 
<HR>
<A name=ISPWant></A>
<CENTER>
<H2>Figuring out how your ISP wants to log you on</H2></CENTER>Unfortunately 
there is no one procedure for logging on to an ISP. Each one uses some slightly 
different procedure. The following steps through the various possibilities to 
see what the ISP wants. Note that your ISP may have been creative and found some 
other way to confuse the users. This technique should still help you figure out 
what your ISP really wants. 
<P>In a separate window set up a running tally of the entries to the log file 
with <BR><B>tail -f /var/log/ppp</B> <BR>This will report in the window what is 
logged to the /var/log/ppp file as it is logged. It sometimes scrolls by too 
fast to see-- then use the window bar to scroll back in the output. We are now 
going to systematically go through the options to find out what your ISP wants. 
During these experiments you may occasionally find that your pppd has not died 
(or you want to kill it). Just do <BR><B>killall pppd </B><BR>to kill it. 
Occasionally pppd will leave a lock file behind if it has been killed. If this 
is the case, do <BR><B>rm /var/lock/LCK..ttyS1</B> <BR>where you replace ttyS1 
by whichever serial port your modem uses. <A name=ImmedPPP></A>
<H3>Immediate PPP:</H3>First run (all on one line) <BR><B>/usr/sbin/pppd 
/dev/ttyS1 57600 debug connect "/usr/sbin/chat -v &nbsp; '' &nbsp; AT&nbsp; 
OK&nbsp; ATD5555555&nbsp; CONNECT&nbsp; '\d\c'"</B> <BR>(Note that that is 
doubled apostrophe ' after the chat -v, not a single double quote mark ".) 
<BR>This command accomplishes two things-- it tests your modem and that you are 
able to call and have the modems connect, and it begins the process of figuring 
out how your ISP wants you to connect. This will not produce a ppp connection, 
but it should dial your phone, (where 5555555 is to be replaced by your ISP's 
phone number). (Note that I use 57600 as a conservative option for modem speed. 

⌨️ 快捷键说明

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