








			       PPP HOWTO 

		   : Robert Hart hartr@interweft.com.au

			 : Asd L. Chen & C.W.Huang

	  v3.0, 31 March 1997.	: 25 August - 9 October 1997



				   Abstract

     ļչʾΰ Linux PC ӵһ̨ PPP ŷϣ ʹ
     PPP ·һṩһְ Linux 趨Ϊ PPP
     ŷķ ͬʱṩ޷ PPP ᣮ



Ȩ

ļɢ GPL (GNU Public License)

ɢ

һļµİ汾ͻ comp.os.linux.answer Ⱥ Ҳڴȡ
HTML ʽļ:

    Linux Howto Index1

    PPP-HOWTO2

ʽ(SGML, ASCII, postscript, DVI)ļԴȡ: Howtos - other
formats3 .

Ϊ sunsite.unc.edu  ĸطǳأʹʵӳ(mirror)ڵ㣮

л

ϵṩдļЭ رл Al Longyear  PPP
ָ(κδҵĶ) Greg Hankins(Linux HOWTOs
ά)Լ Debi Tackett (MaximumAccess.com)
ʽ˳߼ȵý飮

ᣬԵʼṩˣл  HOWTO
һõоյı꣬㹻

____________________

1. <URL:http://sunsite.unc.edu/LDP/HOWTO/>

2. <URL:http://www.interweft.com.au/other/ppp-howto/ppp-howto.html>

3. <URL:ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/other-formats>

PPP HOWTO 							      1





PPP HOWTO 							      2



д HOWTO ļҳһСծңԼ Linux
ʹߣ ǷΪ׫дάҵϵͳ˵ģ


1.  

PPP ԵЭڴ IP
·ЭԼ·Эһֻƣ ֱӵĴӣʹ
null-modem ߣʹݻԼ绰· (ȻҲ ISDN
λ·)

ʹ PPP, ԰ Linux PC ӵһ̨ PPP
ŷϲȡŷӵ·Դֱͬڸ·һ㣮

Ҳ԰ Linux PC Ϊһ̨ PPP
ŷһԾͿԲĵԲҴȡ·Դ

Ϊ PPP  һֵԵ (peer-to-peer) ϵͳҲʹ̨ Linux PC
ϵ PPP  ·һ𣨻ǰ·ᵽ·ϣ

ҪĲ쵱Ȼٶ  ׼̫· 10
MbpsÿλԪϵͨڶ ݻⷽ 56
kbpsÿǧλԪٶڶ

ͬʱ PPP	ߵ̬ĳЩӦԼʹϿܻЩƣ

1.1  ͻԼŷ

PPP
һȫȫǵԵЭӵĻԼܲӵĻ֮䣨ڼϣûв죮
ȻΪ׵Եʣŷͻ˵ķʽ˼Ǻõģ

㲦һڵҪ PPP  ʱǿͻˣߵ̨ŷˣ

趨һ̨ Linux ʹղ PPP ʱһ̨ PPP
ŷˣ

κ Linux PC  PPP  ŷԼͻ 
һϵĴвԼݻбҪĻͬʱֽɫ
ͬǰ˵ģ PPP
ԣһ߽ͻŷ֮䲢ʲ죮

Ϊ׵ĹϵļʼУ ""̨ͻˣ
ѻӦ绰˶Բ֮ϣʹߴţԼܵĻƣ̨ŷˣ

ʹ PPP
Ϊͻ˰ĳطһ̨̨ᵽ·ϿǴ󲿷˶Ȥһ
- ǽǵ Linux Ϊһͻˣ

ļĳ򽫻ܹԶ·ߣ

ļҲڰ Linux PC Ϊ PPP ŷԼʹ PPP
·ĵ趨Щָⳣ·ᣩ









PPP HOWTO 							      3



1.2  ͬ Linux ׼Ĳ

಻ͬ Linux ׼ԼΪģʽ

رأLinux (Լ Unix)ֲͬʼʽ趨ȵȣ

ֱַ BSD system initialisation  System V system initialisation
ĳЩ Unix Ⱥᷢ־˫֧ߵս
Ȥͼ˷·Ƶ!

ձʹõ׼

    Slackware

     ʹ BSD ʽϵͳʼ

    Red Hat (and its former associate Caldera)

     ʹ SysV ϵͳʼ(Щ޸)

    Debian

     ʹ SysV ϵͳʼ

BSD ʽϵͳʼͨ /etc/...Щ:

	  /etc/rc
	  /etc/rc.local
	  /etc/rc.serial
	       (Ҳ)

һЩ BSD ϵͳʼģʽʹ /etc/rc.d...
ΪĴĿ¼ǽеĶ /etc £

System V ʼģʽ /etc/...  /etc/rc.d/...
µһĿ¼:

     drwxr-xr-x   2 root     root	  1024 Jul  6 15:12 init.d
     -rwxr-xr-x   1 root     root	  1776 Feb  9 05:01 rc
     -rwxr-xr-x   1 root     root	   820 Jan  2  1996 rc.local
     -rwxr-xr-x   1 root     root	  2567 Jul  5 20:30 rc.sysinit
     drwxr-xr-x   2 root     root	  1024 Jul  6 15:12 rc0.d
     drwxr-xr-x   2 root     root	  1024 Jul  6 15:12 rc1.d
     drwxr-xr-x   2 root     root	  1024 Jul  6 15:12 rc2.d
     drwxr-xr-x   2 root     root	  1024 Jul 18 18:07 rc3.d
     drwxr-xr-x   2 root     root	  1024 May 27  1995 rc4.d
     drwxr-xr-x   2 root     root	  1024 Jul  6 15:12 rc5.d
     drwxr-xr-x   2 root     root	  1024 Jul  6 15:12 rc6.d

㳢Ѱ̫··趨õطҪ׷ٵЩҳָڣ

1.3  ׼ص PPP ù

ĳЩװ׼( Red Hat  Caldera)һ X window 趨 PPP ϵͳ








PPP HOWTO 							      4



 HOWTO
δصĹߣʹ⣬ֱӺ׼ķѯʣ

 Red Hat 4.x ʹߣ Linux Դҵ Red Hat PPP-TIP4 
Ҳ֧Ԯҵ Red Hat Software5 


2.  IP 

ÿһ·豸ӵԼģΨһ IP
룮Щÿҵйصλָģ

Ҫ···ӵееԼ豸ʹôָ·Χ
IP 룮 ʹһ··֮⣩Ҳƾȡ IP 룮
'͵' IP 뿪ʼѾʹ IP
ĵԵĻʱᶯȫԵĴƻ

עļʹõ IP
루һЩ⣩ǴӱûУ··ʹõġδ·롯ϵģ

һЩر··ʹõ IP 룮Щ IP :

    1  A-ȼ λַ

     10.0.0.0 (netmask 255.0.0.0)

    16  B-ȼ λַ

     172.16.0.0 - 172.31.0.0 (netmask 255.255.0.0)

    256  C-ȼ λַ

     192.168.0.0 - 192.168.255.0 (netmask 255.255.255.0)

·ûҵȨλ䵽 IP
룬ĻӦʹǰЩ·еһ

ЩԶʹ·ϣ

ȻԿʹһ·Ļϵڲ̫·ϣ Ϊ IP
Ƿ·棬ǵԱģ Ȼ̫·ʹ 10.0.0.1
() PPP ·ʱ PPP 潫ŷһ(Ϸ)
IP 룮  PC ··ڵĵûУ

ʹ Linux  Լ ipfwadm	 IP αװ(Ҳ NAT - Network address
Translation ·λת) Ϳ԰·ϲߺϷ IP
Ļ·ṩķЩƣ

õѶο Linux IP Masquerade mini HOWTO6 

____________________

4. <URL:http://www.interweft.com.au>

5. <URL:http://www.Red Hat.com>







PPP HOWTO 							      5



춴󲿷ֵʹߣ PPP  ӵһ·ṩ(Internet Service
Providers: ISP) ȡһ IP 루ȷ˵һ·룩ûбҪģ

ϣһС͵··ϣ·ṩ߿Դе
IP λַռṩһ·ضһ IP 룩 ߣʹ IP
αװ

춾 ISP  ӵһ PC ·ϵʹߣ󲿷ֵṩʹö̬ IP
ָ ˵߳һУϵ PPP
񽫻Ļߵڼ PPP Ӧʹʲ IP 룮
ÿ ISP õĺ벻һ

ʹö̬ IP 룬ÿε߲ᶼȡͬ IP 룮  Linux
ϵŷ̬Ӧóʽ sendmail, ftpd, httpd
ԼԻ⣮ Щⲿṩĵͬ
IP ȡã

춶̬ IP
ָƵķԼķܵĻļۣ


3.  ļĿ

3.1   PPP ͻ

ļṩҪʹ Linux Լ PPP ӵĳһ̨ PPP ŷʹ PPP  IP
ߵһЩָ ļм PPP  ѾòҰװ Linux
(̵غã±ĺԱ PPP  ֧ԮĲ)

Ȼ DIP SLIP ߵı׼ʽ PPP  ߣ DIP
ָһ㶼൱ظӣ ΪԵʣļʹ DIP  PPP
ߵĲݣ

ȡ֮ǣļ׼ Linux PPP  (chat/pppd)

3.2  ʹ PPP  ·һ··

ļṩ·һ··ϵģѶ

3.3   PPP ŷ

ļṩ Linux PC Ϊ PPP  ŷָ˲ӵ
Linux PC ҽ PPP  ߣ

Ӧע趨 Linux  Ϊ PPP
ŷķ֣ļĿǰһַʽ  һ̨С
PPP  ŷ 16 ̨ݻ

ʽ֪ãһõķʽ



____________________

6. <URL:http://sunsite.unc.edu/mdw/HOWTO/mini/IP-Masquerade>







PPP HOWTO 							      6



3.4  ʹ PPP ֱ(direct null modem)

ļṩʹ PPP  Linux PCs  null modem ߵļ
Դ˷ҵϵͳ Linux Ҳǿܵģ
ҪοҪҵϵͳļ

3.5  ļĿǰδǵ...

     PPP 

     μ渽ʹõ pppd 汾ļ

    Լݻ Linux (ϸ)

      Serial-HOWTOԼݻصʼ趨 Modem Setup
     Information7  Ѷܶ趨ݻ

    ʹ DIP   PPP  

     ʹ chat ȡ...

    ʹ socks   IP Masquerade

     Ѿк׼ľļ

    ʹ diald ԽԶ

      diald ļѶ

    ʹ EQL ݻϳɵһ PPP ᣮ

    ׼ص PPP ߷( Red Hat 4.x ·趨)

     ĸ׼еļ

    ӵԶ PPP 

     ʵļ


4.  ǵ汾

ʹ˵ʹ Linux 1.2.x   PPP 2.1.2  Linux 1.3.X/2.0.x
Լ PPP 2.2  森

ڱļ׫д֮ʱLinux  PPP ʽ汾 ppp-2.2f
µİ汾(ppp-2.3) beta ׶Σ

ʹ PPP 2.2.0	Ϻ 1.2.13 пܵģȻҪҪ޲
 1.2.13 汾ʹ ppp-2.2 Ϊܼǿ


____________________

7. <URL:http://www.in.net/info/modems/index.html>







PPP HOWTO 							      7



УӦرעⲻܽ PPP 2.1.2  Linux  2.0.X ã

עļʹ Linux	 2.0.x  Ŀģ⣮ 
kerneld mini-HOWTO Լģģ 2.0.x  ļ Linux 2.0.x  ԭʼʽĿ¼
/usr/src/linux/Documentation/... 

ΪļЭֵģǿҽʹ֪ȶعͬ Linux
汾ʵ PPP 汾


5.  õģҪļ

ʹĶ:-

    渽 PPP ׼ļ;

    pppd Լ chat ʹֲ;

     (ʹ man chat Լ man pppd Ķ)

    Linux ·ָ (NAG);

      The Network Administrators' Guide8

    Net-2/3 HOWTO;

      Linux NET-2/3-HOWTO9

     /usr/src/linux/Documentation  Linux ļ;

    ݻ趨Ѷ -  Modem Setup Information10

     O'Reilly and Associates  Unix/Linux 鼮 O'Reilly and
     Associates On-Line Catalogue11  Ŀ¼  Unix/Linux
     ֣ܣҪߵģĵȥͶʼЩϣ

     Al Longyear ά PPP-FAQ Linux PPP-FAQ12  ȡã

     ˴õѶʴʽ֣ͼҳΪ PPP
     ()ʱ൱ã

    ɲͬ߳Ʒ鼮;


____________________

8. <URL:http://sunsite.unc.edu/mdw/LDP-books/nag-1.0/nag.html>

9. <URL:http://sunsite.unc.edu/mdw/HOWTO/NET-2-HOWTO.html>

10.<URL:http://www.in.net/info/modems/index.html>

11.<URL:http://www.ora.com/>

12.<URL:ftp://sunsite.unc.edu/pub/Linux/docs/faqs>







PPP HOWTO 							      8



     ȥЩͨ鼮Linux
     ķչ׼ݽ൱٣鼮ĸİٶ(һ˵)൱!
     һѾڵĺ()ʹʹ߸еʧ

Linux ļ The Linux Documentation Project Home Page13 . HOWTOs
춶ڵظ£

ȻʹĶЩеκһҲʹļ PPP ᣬ
ȥĶЩļľЩʲὫ˽!
㽫ܹȷԼ( comp.os.linux... Ⱥ Linux mail
ing lists ʳȵ)

Щļļص RFCs
ȣṩԼʹ˵ܰĸϸڽͣ

Ҫʹ PPP ··ϣ㽫֪һЩ TCP/IP
·֪ʶ һļǰᵽϣ㽫ᷢ O'Reilly 
"TCP/IP Network Administration"  Լ "Building Internet Firewalls" кô!

5.1  õ Linux ʵб

ڲͬʹߵȼ֮ͨĵʵб(mailing lists)
ѡȤԼרҵ֪ʶ۵бģ

һЩҸ: ЩбǸЩ"רҼ"ʹ߻ģ
Ȼû˻ᱧԹ"Ǳ"(ĵ)棬
ڲʺϵб""ܻյһЩŭ

ⲢΪרҼʹ½ʹߣΪЩбһѶȵģ

ЩԹĵбб森

Linux ʵбһܺõ Linux Mailing List Directory14 


6.   PPP 趨Ϊͻ˵ĹҪ

ļѶ - ÿθİֲ!

ˣڵĿṩһ̵ĸҪ˵Ҫ Linux ϵͳΪͻӵ PPP
ŷĹ

6.1  ȡ/װ

 Linux ׼δ PPP 壬ɴӴȡ: the Linux PPP daemon15 .

Ǳļ׫дʱʽ汾ȻӸվȡµİ汾(ļ׫дʱ

____________________

13.<URL:http://sunsite.unc.edu/mdw/>

14.<URL:http://summer.snu.ac.kr/~djshin/linux/mail-list/index.shtml>

15.<URL:ftp://sunsite.unc.edu/pub/Linux/system/network/serial/ppp/ppp-2.2.0g.tar.gz>







PPP HOWTO 							      9



ppp-2.3  beta ׶ζӦúܿᷢ)

 PPP ׼α뼰װָ˱Ĳ˲!

6.2  ļ PPP ֧Ԯ

Linux  PPP 

    ᵽ PPP daemon

    PPP ĺ֧Ԯ

׼ƺԤİװṩ PPP ֧Ԯ

ʱıѶϢ

     PPP Dynamic channel allocation code copyright 1995 Caldera, Inc.
     PPP line discipline registered.

ĺѱ PPP ֧Ԯڣ

Ǿ˵ʹʲ׼ϣбضӲ֮µõЧϵͳԴã
סĲܱû˾úıСڼ޵Ļ൱ã

ļ  Linux   (section configuration-hn], page configuration-
pn]) һṩ±ĵ˵

ϸڲ The Linux Kernel HOWTO16 

6.3   ISP ȡѶ

趨 PPP ŷķ Ϊ ISP, ȡ PPP
ŷѶ

Ϊõ Linux, һЩ֪ MS Windows ͻ˵ ISP
ѯſܻѣ

Ȼ ISP ʹ Linux ṩ -  Linux
Ҳ빫˾Ҳܻˣ

ȡ PPP ŷѶ (section info-hn], page info-pn])
һڸҪ֪ӵ PPP ŷʲѶ - ԼҳЩѶ

6.4  趨ݻв

Ϊ PPP ŷȡѵϴʣݻ趨ȷ

ͬأݻԵĴвҲȷ趨

趨ݻв (section 9., page 16) һṩⷽѶ


____________________

16.<URL:Kernel-HOWTO.html>







PPP HOWTO 							     10



6.5  Ƶλַ(DNS)

ִ PPP Զǩ PPP ŷĵ֮⣬һЩõ趨
Աĵܽ www.interweft.com.au Ϊ IP
λַԱ̨ߣ Щ:-

    /etc/resolv.conf

    /etc/host.conf

Ƶλַ (section 10., page 20) һṩⷽ趨ϸڣ

رأ㲢Ҫ Linux PC
ִŷӵ·(Ȼ)
ֻ֪һʹõŷ IP λַ( ISP ṩ)

6.6  PPP  root Ȩ

Ϊ Linux һ PPP ŷҪ·(PPP
һ·)ĵ·ɱpppd Ҫʹ root Ȩޣ

ϸڲݣ ʹ PPP  root Ȩ (section 11., page 22) һڣ

6.7   PPP ׼趨 PPP ѡ

кüüŵҪԱ PPP  PPP
׼һЩڸӦеЩʲ:-

     /etc/ppp/options
     /etc/ppp/scripts/ppp-on
     /etc/ppp/scripts/ppp-on-dialer
     /etc/ppp/options.tpl

 PPP ﵽĿʲҪһЩĵ:-

     /etc/ppp/options.ttyXX
     /etc/ppp/ip-up
     /etc/ppp/pap-secrets
     /etc/ppp/chap-secrets

֮⣬PPP daemon дѡȷʹǺҪ;
˱ڴ㿴Щ׼ PPP ѡѡӦʹõѡ

ϸڲݣ 趨 PPP ӵ (section 12., page 23) һڣ

6.8   PPP ŷʹ PAP ֤(Password Authentication Protocol)

 ISP  PPP ŷʹ PAP ֤ŷʹ PAP
(ֶǩ벢յ׼ʹ/ʾδʹ
PAP)˽ڣ

ȡڽŷʱʾʹƼǣʹ PAP  PPP
ŷҪģʽǩ뷽ʽ









PPP HOWTO 							     11



ʹ֤ӿЭ(link control protocol, LCP)һݣڽ PPP
֮ڽѶ

 PPP ŷʹ PAP ֤(Password Authentication Protocol) (section
13., page 30) һṩʹ PAP  PPP 赵Ѷ

6.9  ֶʽ PPP ŷ

Ѿĵ֮ᣬ͸ֶ(ʹ minicom  seyon)ķʽӼ
Linux PC  pppd Ǹ⣮

μ ֶʽ PPP  (section 14., page 33) ˵趨ϸڲݣ

6.10  ʹ PPP Զ

һɹֶʽǩ룬һָԶᣮ

ʹԶ - ָ (section 15., page 36)
һڰ˽ָ壬Լ൱ע chat  PPP
ŷḳ̌

Ҳʹָ PAP/CHAP ֤ŷϣ

6.11  

һܹܹᣮ

  PPP  (section 17., page 44) һ˵

6.12  

޷ PPP عPPP
ŷԼǽߵķзǳ֣ ƵأPPP ѡ -
Щѡǲһõģ

ǩ벢ʼ PPP ֮⣬ݻ绰·Ҳܻ⣮

 (section 18., page 45)
һṩһĻѶԼη벢ķ

ṩĲǻѶAl Longyear ά PPP-FAQ
˸һѶ!

6.13  ֮

һ PPP (رأһ IP )Linux  PPP
Զִ( root )һָκɵĹܣ

֮ (section 23., page 51) һṩ /etc/ppp/ip-up ָѶ
ν PPP ĲԼһЩ ISP ȡĵʼ
ͳдŵʼȵȹ











PPP HOWTO 							     12



6.14  ̬ IP ṩ׼ IP 

ڼһָģ̬ IP Ӱ Linux PC
Ϊ·ŷ

̬ IP ṩ׼ IP  (section 21., page 49)
һṩ(Ҫ)ӰķԼ(еĻ)Ŀ˷취


7.   Linux 

ΪҪܹʹ PPP Linux  ı PPP ֧Ԯ 㻹û
Linux  ԭʼʽȡ   Linux  ĵϵͳ׼Ƿ
/usr/src/linux 森

Ŀ¼ -  Linux ׼ڰװаװԭʼʽ(Ŀ¼)

ʱ Linux ĻӡѶϢ֧Ԯ PPP
ĻһѶϢ ҪۿЩѶϢĻϵͳ¼ dmesg | less
ָЩѶϢʾөĻϣ ֧Ԯ PPP Ļ㽫ῴļ

     PPP Dynamic channel allocation code copyright 1995 Caldera, Inc.
     PPP line discipline registered.

( Linux 2.0.x ϵкĵѶϢ)

Linux ĵԭʼʽԴ sunsite.unc.edu ӳڵȡã

7.1  װ Linux ԭʼʽ

Ǽ̵ȡüװ Linux ԭʼʽָʾϸѶ The Linux
Kernel HOWTO17	ҵ

Ϊ˰װģ root ǩ룮

  1.  л /usr/src Ŀ¼

      cd /usr/src

  2.   /usr/src/linux ǷѾװԭʼʽ룮

  3.  ûеĻ Linux kernel source directory18
      ӳڵȡأ

      Ҹɰ汾ĺ( 1.2.X)ɵ Old Linux kernel source
      directory19  ң


____________________

17.<URL:Kernel-HOWTO.html>

18.<URL:ftp://sunsite.unc.edu/pub/Linux/kernel/v2.0>

19.<URL:ftp://sunsite.unc.edu/pub/Linux/kernel/old>







PPP HOWTO 							     13



  4.  ѡʵĺ - ͨİ汾ȡὫ 'tar' ѹ /usr/src

      ע: һ 'tar' һѹ -
      ѹ൵Ŀ¼ͷ൱ DOS µ zip 

  5.  ѾװԭʼʽҪ°ĺģƳɵĳʽ룮ָ

      rm -rf /usr/src/linux

  6.  ָѹ

      tar xzf linux-2.0.XX.tar.gz

  7.  Ȼᣬcd /usr/src/linux  README
      ͷĽüºģ
      ϸĶ(ӡֱǸ⣬ֱ㹻֪)

7.2  Ӳ

Ҫ±ĺ֪ PC Ľ濨豸!!
ĳЩ豸ЧҲ֪趨ӲжϺ룬λַԼѶ

7.3    Linux 1.2.13 

Ҫʼóڽ˵˵ʵذװԭʼʽ룮Ȼָʼĵó

     make config

ΪҪܹʹ PPP  úİ PPP  ֧Ԯʹ PPP Ҫ pppd
Լĵ PPP ֧Ԯߣ

       PPP (point-to-point) support (CONFIG_PPP) [n] y

 PC ӲԼҪ Linux
ҵϵͳɫش⣮Ȼոý˵벢װºģ

 1.2.13 ֻҪĸ PPP װã춶಺(multi-port serial
cards)˵޸ĺ PPP ԭʼʽԱõ಺֧Ԯ (μ渽
PPP-2.1.2 ׼ README.linux ˵Ҫϸڲ)

ע:  1.2.13 öԻͷ -  make config
Իд⣬ CTRL-C ¿ʼ

7.4    - Linux 1.3.x  2.0.x 

 Linux 2.0.x  ĺģʹ Linux 1.2.13 ĳ
һΣڽ˵˵ʵذװԭʼʽ룮Ȼָʼĵó

     make config

ȻҲѡ

     make menuconfig









PPP HOWTO 							     14



ṩһѡΪϸϵͳó֮

Ҳһ X windows  Ϊý

     make xconfig

ֱӱ PPP  ֧Ԯȥɿģ飮

ֻ Linux  һʱʹ PPP  ĻὨ PPP
֧ԮΪģ飮 ʹ 'kerneld'ĺĽ㿪ʼ PPP
ʱԶṩ PPP  ֧Ԯģ飮
ʡ˱ļռ䣨ΪûκһݿԱû⣬ģδʹʱԶƳ

ҪĻҪ򿪿ģ֧Ԯ:

	  Enable loadable module support (CONFIG_MODULES) [Y/n/?] y

Ҫ PPP  ĺ֧Ԯش:-

	  PPP (point-to-point) support (CONFIG_PPP) [M/n/y/?]

ҪɿģĻش M ɣͱɺĵһݣش Y ǣ

 1.2.13 ĺĲͬǣ2.0.x ĺҪԶ PPP
豸һ㶼Ҫȥоԭʼʽӿõ PPP  豸

7.5  PPP-2.2  /proc/net/dev ע

ʹ PPP-2.2ֽᷢ PPP װõһþ۲ /proc/net
ϵͳ PPP װã ֱʼʹ pppd װòŻᱻ:-

     [hartr@archenland hartr]$ cat /proc/net/dev
     Inter-|   Receive			|  Transmit
      face |packets errs drop fifo frame|packets errs drop fifo colls carrier
	 lo:  92792    0    0	 0    0    92792    0	 0    0     0	 0
       eth0: 621737   13   13	 0   23   501621    0	 0    0  1309	 0

һһ() PPP ᣬῴĿ(һ PPP
ŷȡ):-

     [root@kepler /root]# cat /proc/net/dev
     Inter-|   Receive			|  Transmit
      face |packets errs drop fifo frame|packets errs drop fifo colls carrier
	 lo: 428021    0    0	 0    0   428021    0	 0    0     0	 0
       eth0:4788257  648  648  319  650  1423836    0	 0    0  4623	 5
       ppp0:   2103    3    3	 0    0     2017    0	 0    0     0	 0
       ppp1:  10008    0    0	 0    0     8782    0	 0    0     0	 0
       ppp2:	305    0    0	 0    0      297    0	 0    0     0	 0
       ppp3:   6720    7    7	 0    0     7498    0	 0    0     0	 0
       ppp4: 118231  725  725	 0    0   117791    0	 0    0     0	 0
       ppp5:  38915    5    5	 0    0    28309    0	 0    0     0	 0











PPP HOWTO 							     15



7.6  úĵһ㿼

Ҫ Linux PC Ϊһ̨ PPP  ŷĻ IP forwarding
֧Ԯȥ ʹ Linux
··ӵ·ϵĻѡҲҪģ

Ҫһ··ϣֻ·ӦҪİȫϵ⣮ںм
IP firewalls ֧ԮǱ!

Ҫ IP αװʹǰκһδߡIP
··ҲҪã

Ҫʹ IP αװ IP firewalling make config еĵһϻش
yes:-

     Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL)?

ȻʹЩѣʹ Linux 2.0.X ĵ IP αװ
IP firewalling ܶû⣮

һºĵİװԼ֮ᣬͿԿʼò PPP ᣮ


8.  ȡ PPP ŷѶ

Խĳ̨ŷ PPP	֮ǰҪȡеѶ PPP
ŷϵͳʹ֧ԮԱȡã:-

    ӷĵ绰

     ˽ý(PABX)ϵͳ£㻹Ҫźŵ˽ý 
     ͨ 0  9

    ŷʹö̬̬ IP ?

     ŷʹþ̬ IP 룬Ҫ֪ PPP  Ҫʹĸ
     IP 룮  ISP ṩһϷ IP Ĵ·Ҫ֪ʹõ
     IP 뼰·֣


     󲿷ֵ·ṩ߶ʹö̬ IP
     룮ǰʹõķЩƣ


     Ȼʹʹþ̬ IP 룬󲿷ݵ PPP
     ŷҲ(Ϊ˰ȫ)ͻָ IP 룬Ϊаȫգ
     Ȼ֪ЩѶ

    ISP ŷ IP ʲ?

     ȻֻҪһӦõҪ


     ܻһ⣮΢ Windows 95 PPP 趨 DNS








PPP HOWTO 							     16



     ĵַ߹дͻˣ  ISP
     (˾ѯ)ܻ㲻Ҫ֪ DNS ŷ IP λַ


      Linux ˵֪һ DNS λַ Ŀǰ Linux  PPP
     ʵв֮ʱָ̬ DNS  IP  - ܿܽҲᣮ


     ע: ȻLinux (Ϊ PPP Ŀͻ)ܴŷн DNS
     λַȻΪ PPP ŷʱ  pppd ѡ dns-addr
     ΪͻָѶ

    ŷǷҪʹ PAP/CHAP?

     Ҫ֪ "id" Լ "secret" Ż
     ISP ʹԼ룩

    ŷԶ PPP  һǩ֮Ҫκָŷ˵
     PPP?

     ĳָ PPP  Ļʲ?

    ŷ΢ Windows NT ϵͳǷʹ΢ PAP/CHAP ϵͳ?

     ๫˾·ƺʹ Windows NT ϵͳӰȫԣ
ϸעЩѶ  Ҫʹ!


9.  趨ݻв

Ӧȷݻ趨ȷ֪ӵĸв

:-

    DOS com1: = Linux /dev/cua0 (and /dev/ttyS0)

    DOS com2: = Linux /dev/cua1 (and /dev/ttyS1)

     ȵ

Ҫĸв׼ PC  com1  com3  IRQ4  com2
 com4  IRQ3

װúʹвһ IRQ Ļܻ⣮
ȷݻвӵԼΨһһ
IRQڵĴв(ƷʽϼѵϵĴв)㽫вϵ IRQ
ƿ

 Linux 2.0.X ģ cat /proc/interrupts ʹе
IRQῴ












PPP HOWTO 							     17



      0:    6766283   timer
      1:      91545   keyboard
      2:	  0   cascade
      4:     156944 + serial
      7:     101764   WD8013
     10:     134365 + BusLogic BT-958
     13:	  1   math error
     15:    3671702 + serial

ʾһв IRQ4 (һ)һв IRQ15 (Ҳһв
com2, IRQ3  com4  IRQ14δʹãûʾ)

С - Ҫ IRQ ĻҪȷʵ֪Щʲ!
㲻ֻҪĵǣ濨² jumper㻹Ҫ֪Ǹռʲ
IRQ ҵ˵ȫ SCSI Ϊ PCҽϵͨռ
IRQ14  15  IDE ص

㻹Ҫע PC ҵϵͳ IRQ
λַʹǸҵϵͳ˻!

ĽвƵ˷Ǳ׼ IRQҪ Linux ÿһõ IRQ
λַ  setserial ָɣýŵ rc.local SysV
ϵͳ rc.local е rc.serial Ϊ̵һݣ
еĻ˵ָ

     /bin/setserial -b /dev/ttyS2 IRQ 11
     /bin/setserial -b /dev/ttyS3 IRQ 15

Ȼʹ kerneld
гĶ̬봮ģ飬㲻ÿοʱ趨һ IRQ Ͱˣ
Ϊģ鱻ƳLinux ͻЩ趨

ˣԶ̬ʽ봮ģ飬Ҫÿģʱ趨 IRQ У

9.1  вٶԵע

ʹø(ʽ)ݻ(14,400 baud
)Ĵвٶȱܹݻǵݻѹʱ

ĴвҪһ͵ UART (Universal Asynchronous Receiver Transmit
ter) 16550(A)
ʹһɵĻ(ɵĴп)ܴܿвֻоɵ 8250
UARTʹøݻʱܻᷢ⣮

ʹָ

     setserial -a /dev/ttySx

 Linux رʹõ UART ͣû 16550A ͵
UARTȥһµĴп( $50) һ¿ʱȷܵ IRQ!

ע: 汾 16550 UART
Ƭ覴ãܿͱ˶Ҳ°ľƬ - 16550A UART
ٲ覴õľƬ森Ȼ̫ܸպþ򵽣㻹Ӧÿһ¾Ƭǲ








PPP HOWTO 							     18



16550AرһЩڵĴпϣ

9.2  в

ǰLinux  cuaX ʾĴв ttySx ʾƣ

Ժ 2.0.X ֮ҪѾıˣӦÿ ttySx
ͬʱʾ뼰ƣ ˽ cuaX
װδ汾ĺпܻȡ

9.3  ݻ

Ϊʹ PPP 㽫ȷݻ 
ҪĶݻʹֲ!  󲿷ֵݻ PPP
ĵĳԤѡ :-

    Ӳ (RTS/CTS) (&K3  Hayes ָݻ)

ӦҪо趨ʹñ׼ Hayes ָ:

    E1 ָıػӦ (chat )

    Q0 رִн (chat )

    S0=0 رԶӦ (ݻ绰)

    &C1 ֻ֮ز

    &S0 Data Set Ready (DSR)ԶΪ

    ()	Data Terminal Ready

һվ̨ṩ㲻ӵݻʽ趨ܻ Modem setup
information20 

ĵݻ֮ݻҲֵо˽⣮
󲿷ִݻԹ̶ٶʹôн棬ʹ绰·лߵٶԶݻܹ

Ϊ split speed opera
tionݻ֧ԮܣݻĴнٶȣͨ
115,200 baud  14,400 ݻ˵ 38,400 baud

ʹͨѶ壨 minicomҳݻѶΪ PPP
趨 ݻ AT&V
ָĻӦлرĿǰ趨״Ӧò鿴һݻʹֲᣮ

趨ȫŪˣԽɷ AT&F ָصȶ״̬ͨԣ 
ص趨 Ĵ󲿷ִݻУ趨ʹ PPP
趨  Ӧ飩

һҳ˱Ҫ趨ִͰдȻ:

____________________

20.<URL:http://www.in.net/info/modems/index.html>







PPP HOWTO 							     19



ԽЩ趨ֵݻϵķǻӷԼʵ AT
ָͿɽг һǽЩȷ趨 PPP ĲŹд룮

ֻ Linux ʹݻӵ ISP
ŷ򵥵ǽЩ趨ֵݻϵķǻӷԼ(non-volatile
RAM)

һ棬ҪӦóʽҵϵͳʹݻյÿβʱŽЩѶ룬
˿ȷÿβʱݻȷ״̬(Щ趨ִиôݻʧ˼ʱȷʵܷ)

9.4  ע

ڴͨѶ·ʱ򣬿ܻᷢϵıȵܴĻҪԿæ
 ǵãLinux һʹߣ๤ҵϵͳ
Ϊȷϲ©ʧڻеϲᳬض©ʧҪĳЩķ

ַڴ·ϴĿ:-

    ʹӲź(Clear To Send/Request to Send - CTS/RTS)

    ʹź(control S and control Q, also known as XON/XOFF).

Ȼն˻֣Ͽܺܺã PPP  ϵʹ 8 bits
ռ  еĳط൱ܴڻᱻת control S  Լ control
Q  λԪ飮 ԣݻʹƵĻᴫױ!

ʹ PPP ĸᣨʹ 8 bits
ϱ룩˵ӲǺҪģʹӲƣ

9.5  ݻĲ

˴вݻ趨֮ʱ ISP
Ͽܷȷ趨Ƿ

ʹն˻ͨѶ壨 minicomʹ PPP  ߵ̨ PPP
ŷ

ע: ׶ǲԽ PPP	 
ֻҪ֤ʵӵȷĵ绰ԼΪǩ벢 PPP
ȷʵҳŷ͸ʲѶϢ

УԽȡ¼һǩĹ̻СĵأǳСĵأȷʵдԶŷʾʹԼѶϢԼκν
PPP  Ҫ´ָ

ŷʹ
PAPܲῴǩʾţ(ֱʾ)ͨѶЭ()өĻϣ

һЩ:-

    ĳЩŷ൱: ģʽʹ/뷽ʽʹ PAP ǩ룮
      ISP ˾վ̨ʹ PAP
     ûөĻϿҲʾˣ










PPP HOWTO 							     20



    ĳЩվ̨ҪһЩʼȻ׼ PAP 

    ĳЩ PPP ŷǱ -
     Ǿȴͳκϣֱͻ˲벢ͳϷЭ
     Ҫӵ PPP ŷǱģʽģ㽫ῴκ!

    ĳЩŷ㰴 ENTER ǰ PPP -
     ȷǩ뵫δĻ!

ֵò  ĳЩŷÿǩʱıʾʱı!
 Linux ÿ㲦ʱҪܹϵҪʾ:-

    ҪʹƵʾ;

    Ҫʾ;

뷢ĳָŷ˵
PPPҲҪҳһǩ֮ŷָ PPP ʾ

ŷԶ PPP  Ļһǩɣ㽫ʼөĻϳ 
 PPP  ŷ˴͸Ļ𶯲 PPP ߵѶ

⿴ӦûĶ:-

     ~y}#.!}!}!} }8}!}$}%U}"}&} } } } }%}& ...}'}"}(}"} .~~y}

(һֱ! )

ĳЩϵͳ PPP
ŷȷؼ𶯣ͨΪŷ趨ʹͬʹƣ
PPP  ǩ뼰һʹý(shell) ǩ룮
һǩͷָһΣ㽫 PPP
ŷ𶯵Ѷ  ԹҶˣ

ûʱөĻϿЩ(ҪĻǩ벢 PPP
ŷ)  Enter ܷ PPP ŷ...

ʱͿԹҶݻͨǣٵؼ +++ һݻӦ OK
Ȼ ATHO ָ

㲻ʹݻĻĶݻʹֲᣬͨѶʹֲԼ
Serial HOWTO!  һ⣬ǰ˵ģ


10.  Ƶλַ(DNS)

Ȼϲȡƣϲ֣  TCP/IP
·ϣҲ·ǽضƺĳ̨ÿ̨һض森
ԣҵ Linux վΪ archenland Ǵ interweft.com.au
 Ŀеλַ archenland.hedland.edu.au (Ϊ
FQDN - fully qualified domain name)

ȻΪʹ·ϵҵĵ̨ʵϵ·Ϲͨʱǽ
IP ֪ģ








PPP HOWTO 							     21



ѻԼ򣩵ת루Ϊ·ʵʹõ IP
ṩƷ֮Ĺ

:-

    ĻҪ֪ĳضԵ IP λַҪѶӦóʽ Linux
     PC ϵ'ƽ'ѯʴѶ;

    ƽѯڲƵ( /etc/hosts
     Լ/֪ѶŷƽʵʵΪ
     /etc/host.conf );

    ƵУԴ˴𰸻ش;

    ָŷУ PC ûѯ;

    ⲿŷѾ֪ѯƵ IP
     룬Դ˻ش𣮷͸·ŷѰѶ
     ⲿŷὫѶظԭѯʵƽȻᴫҪѶӦóʽ

㴴 PPP	ʱҪ Linux
ҵƶյ IP
루λַѶͿʹûƶĵԿ԰Щת
IP 룮

һ /etc/hosts
·Ļȫܵ£
һʹ춻Ƶ IP 루Ҫǵȫ IP
λַǲܵĳС·ϣ

õķ趨 Linux  ʹ֪õȡƵѶ  Զأ
ŷϵͳṩҪȫǰ IP 뵽
/etc/resov.conf 

10.1  /etc/resolv.conf 

 PPP  ŷϵͳʹ֧ԮԱӦҪṩ DNS  IP
루ֻҪһ  ڳʱԶЩ

ǰLinux  MS Windows 95 һķʽ趨ŷ IP
룮 (ò) ISP ṩѶ!

 /etc/resolv.conf Ӧû:

     domain your.isp.domain.name
     nameserver 10.25.0.1
     nameserver 10.25.1.2

༭ûеĻͽһµģԳ ISP
ṩѶӵԼȨӦ:-

     -rw-r--r--   1 root     root	    73 Feb 19 01:46 /etc/resolv.conf

Ϊ·Ѿ /etc/resolv.conf








PPP HOWTO 							     22



ĻֻҪ򵥵İ PPP ߵ DNS ŷ IP ӵеĵＴɣ

10.2  /etc/host.conf 

ҲӦü /etc/host.conf Ƿ趨ȷӦ

     order hosts,bind
     multi on

ƽŷѯ֮ǰʹƵеѶ


11.  ʹ PPP  root Ȩ

Ϊ PPP Ҫ趨·豸ĵͱԼĶҪ
root ȨЩ£

 root ʹҪܽ PPP  ߣ pppd ʽӦΪ root
ִ(setuid):-

     -rwsr-xr-x   1 root     root	 95225 Jul 11 00:27 /usr/sbin/pppd

 /usr/sbin/ppd 趨Ϊ root ָ:

     chmod u+s /usr/sbin/pppd

 pppd  root ȨִУʹһʹִеģ
һʹִе pppd бҪȨ޽·漰ĵͱ

 root ִеĳʽڰȫǱڵ©趨Ϊ 'setuid'
ĳʽǳСģ سʽ( pppd)ѾСĵ׫дԽ root
ִеΣսͣӦǰȫ(֤)

ϣϵͳرϣϵͳκʹ߶ʼ
PPP ᣬӦð ppp-on/off
ָ趨Ϊȫ˶ԶȡִУ PC
ֻʹŲ

Ȼ㲻ϣκ˶ʼ PPP  ߣ磬ĺ Linux PC
ʺŶ㲻ϣûļල·㽫ýһ PPP
Ⱥ飨༭ /etc/group :

     pppd 趨Ϊ root ȨִУӵ root Ⱥ
     PPPȨ޶رգӦ

	  -rwsr-x---   1 root	  PPP	     95225 Jul 11 00:27 /usr/sbin/pppd




    ʹ ppp-on/off ָʹ root ԼȺ PPP  ӵ

    ʹ ppp-of/off ָȺ PPP ȡִ









PPP HOWTO 							     23



	    -rwxr-x---	 1 root     PPP 	  587 Mar 14  1995 /usr/sbin/ppp-on
	    -rwxr-x---	 1 root     PPP 	  631 Mar 14  1995 /usr/sbin/ppp-off



    رĴȡȨ

    ܹ PPP  ʹ߼ /etc/group  PPP Ⱥ

ʹˣһʹȻ޷ķʽֹᣮ ִ ppp-off ָҪ root
ȨޣȻΣκʹ߶Թصݻ(򽫵绰ڽʽݻ)

һ(õ)취ʹʹ sudo  ppp ᣮ
ṩѵİȫԲҿ趨κ(ε)ʹʹָ/ᣮ
ʹ sudo һλεʹǬȫ/ PPP ᣮ


12.  趨 PPP ӵ

 root ǩЩĿ¼ұ༭Щ PPP
ĵʹеʹ߶ʹ PPP

PPP ʹü趨 PPP ᣮЩ PPP 2.1.2  2.2
еλöͬ

 PPP 2.1.2 Щ:-

     /usr/sbin/pppd	      # PPP ִе
     /usr/sbin/ppp-on	      # /ָ
     /usr/sbin/ppp-off	      # ָ
     /etc/ppp/options	      # ʹõѡ
     /etc/ppp/options.ttyXX   # ĳһضͨѶʹõѡ

 PPP 2.2 Щ:-

     /usr/sbin/pppd		     # PPP ִе
     /etc/ppp/scripts/ppp-on	     # /ָ
     /etc/ppp/scripts/ppp-on-dialer  # ŵ chat ָ岿
     /etc/ppp/scripts/ppp-off	     # ָ
     /etc/ppp/options		     # ʹõѡ
     /etc/ppp/options.ttyXX	     # ĳһضͨѶʹõѡ

Red Hat Linux ʹӦע׼ Red Hat 4.X װЩָ
/usr/doc/ppp-2.2.0f-2/scripts

 /etc Ŀ¼ӦҪиĿ¼:

     drwxrwxr-x   2 root     root	  1024 Oct  9 11:01 ppp

ڵĻ  Ȩ޽

Ŀ¼ѾڣӦûһΪ options.tpl
ѡ壮森









PPP HOWTO 							     24



Ϊ PPP ѡĽӡ pppd
ʹֲĶǺõģ ȻʹΪ
/etc/ppp/options
ĻǽԼģûаָѡܻ
 ̵öұȽĶά

ж·ݻ͵ PPP ŷὨһһ㻯
/etc/ppp/options
аÿṩ֧ԮĴвʹõĹͬѡΪÿһҪ趨Խ
PPP ߵĴ·ѡ

ЩΪ options.ttyx1, options.ttyx2 ƣ x
㴮вʵ룩

Ȼ춵һ PPP  ߣֱʹ /etc/ppp/options
һְ취԰еѡŽ pppd ָΪ

ʹ /etc/ppp/options.ttySx 趨ʽȽ׼ά ʹ PPP
ߵüͬĽڵȥĻͿ /etc/ppp/options.site
Ϊÿڵ㽨ѡȻʱָѡΪ PPP ָĲ (ʹ
file option-file  pppd ָ)

12.1   options.tpl 

ĳЩ PPP  ķ׼ƺ©ʧ options.tpl
иĵ ҽ㲻Ҫֱӱ༭Լ
/etc/ppp/options
һµĵȻ༭õȽϺãŪ༭ĵԻͷԭʼٶȿʼ


































PPP HOWTO 							     25



     # /etc/ppp/options -*- sh -*- general options for pppd
     # created 13-Jul-1995 jmk
     # autodate: 01-Aug-1995
     # autotime: 19:45

     # Use the executable or shell command specified to set up the serial
     # line.  This script would typically use the "chat" program to dial the
     # modem and start the remote ppp session.
     #connect "echo You need to install a connect command."

     # Run the executable or shell command specified after pppd has
     # terminated the link.  This script could, for example, issue commands
     # to the modem to cause it to hang up if hardware modem control signals
     # were not available.
     #disconnect "chat -- \d+++\d\c OK ath0 OK"

     # async character map -- 32-bit hex; each bit is a character
     # that needs to be escaped for pppd to receive it.  0x00000001
     # represents '\x01', and 0x80000000 represents '\x1f'.
     #asyncmap 0

     # Require the peer to authenticate itself before allowing network
     # packets to be sent or received.
     #auth

     # Use hardware flow control (i.e. RTS/CTS) to control the flow of data
     # on the serial port.
     #crtscts

     # Use software flow control (i.e. XON/XOFF) to control the flow of data
     # on the serial port.
     #xonxoff

     # Add a default route to the system routing tables, using the peer as
     # the gateway, when IPCP negotiation is successfully completed.  This
     # entry is removed when the PPP connection is broken.
     #defaultroute

     # Specifies that certain characters should be escaped on transmission
     # (regardless of whether the peer requests them to be escaped with its
     # async control character map).  The characters to be escaped are
     # specified as a list of hex numbers separated by commas.	Note that
     # almost any character can be specified for the escape option, unlike
     # the asyncmap option which only allows control characters to be
     # specified.  The characters which may not be escaped are those with hex
     # values 0x20 - 0x3f or 0x5e.
     #escape 11,13,ff

     # Don't use the modem control lines.
     #local

     # Specifies that pppd should use a UUCP-style lock on the serial device
     # to ensure exclusive access to the device.
     #lock








PPP HOWTO 							     26



     # Use the modem control lines.  On Ultrix, this option implies hardware
     # flow control, as for the crtscts option.  (This option is not fully
     # implemented.)
     #modem

     # Set the MRU [Maximum Receive Unit] value to <n> for negotiation.  pppd
     # will ask the peer to send packets of no more than <n> bytes. The
     # minimum MRU value is 128.  The default MRU value is 1500.  A value of
     # 296 is recommended for slow links (40 bytes for TCP/IP header + 256
     # bytes of data).
     #mru 542

     # Set the interface netmask to <n>, a 32 bit netmask in "decimal dot"
     # notation (e.g. 255.255.255.0).
     #netmask 255.255.255.0

     # Disables the default behaviour when no local IP address is specified,
     # which is to determine (if possible) the local IP address from the
     # hostname. With this option, the peer will have to supply the local IP
     # address during IPCP negotiation (unless it specified explicitly on the
     # command line or in an options file).
     #noipdefault

     # Enables the "passive" option in the LCP.  With this option, pppd will
     # attempt to initiate a connection; if no reply is received from the
     # peer, pppd will then just wait passively for a valid LCP packet from
     # the peer (instead of exiting, as it does without this option).
     #passive

     # With this option, pppd will not transmit LCP packets to initiate a
     # connection until a valid LCP packet is received from the peer (as for
     # the "passive" option with old versions of pppd).
     #silent

     # Don't request or allow negotiation of any options for LCP and IPCP
     # (use default values).
     #-all

     # Disable Address/Control compression negotiation (use default, i.e.
     # address/control field disabled).
     #-ac

     # Disable asyncmap negotiation (use the default asyncmap, i.e. escape
     # all control characters).
     #-am

     # Don't fork to become a background process (otherwise pppd will do so
     # if a serial device is specified).
     #-detach

     # Disable IP address negotiation (with this option, the remote IP
     # address must be specified with an option on the command line or in an
     # options file).
     #-ip








PPP HOWTO 							     27



     # Disable magic number negotiation.  With this option, pppd cannot
     # detect a looped-back line.
     #-mn

     # Disable MRU [Maximum Receive Unit] negotiation (use default, i.e.
     # 1500).
     #-mru

     # Disable protocol field compression negotiation (use default, i.e.
     # protocol field compression disabled).
     #-pc

     # Require the peer to authenticate itself using PAP.
     # This requires TWO WAY authentication - do NOT use this for a standard
     # PAP authenticated link to an ISP as this will require the ISP machine
     # to authenticate itself to your machine (and it will not be able to).
     #+pap

     # Don't agree to authenticate using PAP.
     #-pap

     # Require the peer to authenticate itself using CHAP [Cryptographic
     # Handshake Authentication Protocol] authentication.
     # This requires TWO WAY authentication - do NOT use this for a standard
     # CHAP authenticated link to an ISP as this will require the ISP machine
     # to authenticate itself to your machine (and it will not be able to).
     #+chap

     # Don't agree to authenticate using CHAP.
     #-chap

     # Disable negotiation of Van Jacobson style IP header compression (use
     # default, i.e. no compression).
     #-vj

     # Increase debugging level (same as -d).  If this option is given, pppd
     # will log the contents of all control packets sent or received in a
     # readable form.  The packets are logged through syslog with facility
     # daemon and level debug. This information can be directed to a file by
     # setting up /etc/syslog.conf appropriately (see syslog.conf(5)).	(If
     # pppd is compiled with extra debugging enabled, it will log messages
     # using facility local2 instead of daemon).
     #debug

     # Append the domain name <d> to the local host name for authentication
     # purposes.  For example, if gethostname() returns the name porsche,
     # but the fully qualified domain name is porsche.Quotron.COM, you would
     # use the domain option to set the domain name to Quotron.COM.
     #domain <d>

     # Enable debugging code in the kernel-level PPP driver.  The argument n
     # is a number which is the sum of the following values: 1 to enable
     # general debug messages, 2 to request that the contents of received
     # packets be printed, and 4 to request that the contents of transmitted








PPP HOWTO 							     28



     # packets be printed.
     #kdebug n

     # Set the MTU [Maximum Transmit Unit] value to <n>. Unless the peer
     # requests a smaller value via MRU negotiation, pppd will request that
     # the kernel networking code send data packets of no more than n bytes
     # through the PPP network interface.
     #mtu <n>

     # Set the name of the local system for authentication purposes to <n>.
     # This will probably have to be set to your ISP user name if you are
     # using PAP/CHAP.
     #name <n>

     # Set the user name to use for authenticating this machine with the peer
     # using PAP to <u>.
     # Do NOT use this if you are using 'name' above!
     #user <u>

     # Enforce the use of the host name as the name of the local system for
     # authentication purposes (overrides the name option).
     #usehostname

     # Set the assumed name of the remote system for authentication purposes
     # to <n>.
     #remotename <n>

     # Add an entry to this system's ARP [Address Resolution Protocol]
     # table with the IP address of the peer and the Ethernet address of this
     # system.
     #proxyarp

     # Use the system password database for authenticating the peer using
     # PAP.
     #login

     # If this option is given, pppd will send an LCP echo-request frame to
     # the peer every n seconds. Under Linux, the echo-request is sent when
     # no packets have been received from the peer for n seconds. Normally
     # the peer should respond to the echo-request by sending an echo-reply.
     # This option can be used with the lcp-echo-failure option to detect
     # that the peer is no longer connected.
     #lcp-echo-interval <n>

     # If this option is given, pppd will presume the peer to be dead if n
     # LCP echo-requests are sent without receiving a valid LCP echo-reply.
     # If this happens, pppd will terminate the connection.  Use of this
     # option requires a non-zero value for the lcp-echo-interval parameter.
     # This option can be used to enable pppd to terminate after the physical
     # connection has been broken (e.g., the modem has hung up) in
     # situations where no hardware modem control lines are available.
     #lcp-echo-failure <n>

     # Set the LCP restart interval (retransmission timeout) to <n> seconds








PPP HOWTO 							     29



     # (default 3).
     #lcp-restart <n>

     # Set the maximum number of LCP terminate-request transmissions to <n>
     # (default 3).
     #lcp-max-terminate <n>

     # Set the maximum number of LCP configure-request transmissions to <n>
     # (default 10).
     # Some PPP servers are slow to start up. You may need to increase this
     # if you keep getting 'serial line looped back' errors and your are SURE
     # that you have logged in correctly and PPP should be starting on the server.
     #lcp-max-configure <n>

     # Set the maximum number of LCP configure-NAKs returned before starting
     # to send configure-Rejects instead to <n> (default 10).
     #lcp-max-failure <n>

     # Set the IPCP restart interval (retransmission timeout) to <n>
     # seconds (default 3).
     #ipcp-restart <n>

     # Set the maximum number of IPCP terminate-request transmissions to <n>
     # (default 3).
     #ipcp-max-terminate <n>

     # Set the maximum number of IPCP configure-request transmissions to <n>
     # (default 10).
     #ipcp-max-configure <n>

     # Set the maximum number of IPCP configure-NAKs returned before starting
     # to send configure-Rejects instead to <n> (default 10).
     #ipcp-max-failure <n>

     # Set the PAP restart interval (retransmission timeout) to <n> seconds
     # (default 3).
     #pap-restart <n>

     # Set the maximum number of PAP authenticate-request transmissions to
     # <n> (default 10).
     #pap-max-authreq <n>

     # Set the CHAP restart interval (retransmission timeout for
     # challenges) to <n> seconds (default 3).
     #chap-restart <n>

     # Set the maximum number of CHAP challenge transmissions to <n>
     # (default 10).
     #chap-max-challenge

     # If this option is given, pppd will re-challenge the peer every <n>
     # seconds.
     #chap-interval <n>









PPP HOWTO 							     30



     # With this option, pppd will accept the peer's idea of our local IP
     # address, even if the local IP address was specified in an option.
     #ipcp-accept-local

     # With this option, pppd will accept the peer's idea of its (remote) IP
     # address, even if the remote IP address was specified in an option.
     #ipcp-accept-remote

12.2  Ӧʹʲѡ? ( PAP/CHAP)

ţȫṩӦ춴󲿷ݵŷ

Ȼ޷ĻĶ嵵(/etc/ppp/options.tpl) Լ pppd
ʹֲᲢҸ֮ŷϵͳʹ֧ԮԱ

㻹ӦעչʾָҲʹһЩ pppd
ѡԱ׵Щ

     # /etc/ppp/options (NO PAP/CHAP)
     #
     #  pppd 뱳ִ
     -detach
     #
     # ʹݻ
     modem
     # ʹ uucp ̬Աȡôװ
     lock
     # ʹӲ
     crtscts
     # ڵͱнὨΪԤװ
     defaultroute
     # ʹκ"ݳ"
     asyncmap 0
     # ͷСΪ 552 bytes
     mtu 552
     # շСΪ 552 bytes
     mru 552
     #
     #-------END OF SAMPLE /etc/ppp/options (no PAP/CHAP)


13.   PPP ŷʹ PAP ֤(Password Authentication Protocol)

ӵŷҪ PAP  CHAP ֤ҪһĹ

ѡУ漸
















PPP HOWTO 							     31



     #
     #  pppd ʹ ISP Ϊ֤е""
     name <your ISP user name>	   # Ҫıһ
     #
     # ִ PPP *ŷ* Ҫʹ PAP  CHAP ֤ʵȥ
     # ע⣮ҪΪͻŷʱʹôѡ(ʹʹ PAP  CHAP)
     # ΪǸŷΪԼĻṩ֤(⼸ǲܵģ
     # ʧ)
     #+chap
     #+pap
     #
     # ʹ /etc/ppp/pap-secrets о룬ȥһеע⣮
     # ע:  Windows NT ϵԶ˴ȡ΢ǲͬģ
     #+papcrypt

13.1  ʹ MSCHAP

΢ Windows NT Զ˴ȡ(RAS)Ա趨Ϊʹһ CHAP(Challenge/Hand
shake Authentication Protocol) ı֣  PPP
ԭʼʽУҵһ README.MSCHAP80 ĵ£

Կ pppd жŷǷҪʹô֤Э ŷʹ MS
CHAP ֤ῴһ

     rcvd [LCP ConfReq id=0x2 <asyncmap 0x0> <auth chap 80> <magic 0x46a3>]

ؼѶϢ auth chap 80

Ϊʹ MS CHAP± pppd ֧ԮЭ μ PPP ԭʼʽе
README.MSCHAP80 ˵αʹô˱Э

㻹Ҫעĳʽֻ Linux PPP Ϊͻ MS Windows NT
ŷõģ ֧Ԯ Linux Ϊÿͻʹ MSCHAP80 ֤ PPP ŷ

13.2  PAP/CHAP 뵵

ʹ PAP  CHAP ֤뽨Щ뵵:

     /etc/ppp/pap-secrets
     /etc/ppp/chap-secrets

Щӵ߱Ϊ rootȺΪ rootͬʱΪ˰ȫȨӦΪ 740

 PAP  CHAP һҪָ֤ϵͳʹߵģ

"? ʲ᲻ͬ?" ʣ

ŶһĵԽŷ PPP ߣϵͳϵκʹ߶ʹô
- ֻѣ ҲΪʹ PPP
·(LAN)һ·(WAN)ԭ

PAP ( CHAP Ҳ)Ҫ˫֤ -
ҲÿһҪһϷһϣ
ȻⲢǴ󲿷ṩʽ PAP ֤ӵ PPP ŷķʽ








PPP HOWTO 							     32



Ҳ˵ ISP
ܻһʹӵǵϵͳӵ·ϣ
 ISP ԵһҲȤܱʹ ISP
ϵʹΪԵƣ

Ҫʹ pppd ѡ name user name ɣ ˣʹ ISP
ʹƣһ

     name your_user name_at_your_ISP

 /etc/ppp/options У

Ӽ˵PAP ʵӦҪʹ user our_user name_at_your_ISP
ѡʹõ PAP Ļ pppd ԰ name Ϊ user ʹ
name ѡĺô CHAP ҲЧģ

Ϊ PAP/CHAP ϵԵģڼҲҪָԶ˵Եƣ
Ȼ󲿷ֵֻһ ISP  뵵ԶʹͨԪ(*)


 ISP жݻӵͬն˻ŷ 
ÿն˻ŷвͬƣӵһģԶתߣ벦ӣ
ĳЩ¿˶ܲԤ֪Զ˵Ե!

13.3  PAP 뵵

/etc/ppp/pap-secrets 

     # Secrets for authentication using PAP
     # client	     server	  secret     acceptable_local_IP_addresses

ĸλԿհ׷ֽһǿհ(ʹö̬ IP  ISP
ṩľ̬ IP)

ٶ ISP ʹ fred  flintstone ĻӦ
/etc/ppp/options[.ttySx] 趨 name fred ѡҰ /etc/ppp/pap-
secrets 

     # Secrets for authentication using PAP
     # client	     server  secret	     acceptable local IP addresses
     fred	     *	     flintstone

˵ fred ػƣѾ߹ pppd
ʹƣʹⲻǱػҲһԼκεŷʹ
flintstone 루룩

ע⵽ǲҪָص IP λַҪҪʹһضģ̶ IP
λַ ʹһ̶ IPҲеͨΪ춴󲿷ݵ PPP
ŷ(Ϊ˰ȫ)Զϵͳָ IP 룮

13.4  CHAP 뵵

Ŀǰ pppd 汾ҪҪлϵķ 
˵ܹôĻԶŷԼԶŷĻ϶ܽУ








PPP HOWTO 							     33



ԣĻ fred Զ barney ĻǸ
/etc/ppp/options.ttySx Ϊ name fred remotename barney Զ˻ӦΪ
name barney remotename fred

fred ̨ /etc/ppp/chap-secrets 

     # Secrets for authentication using CHAP
     # client	     server  secret	       acceptable local IP addresses
     fred	     barney  flintstone
     barney	     fred    wilma

 barney 

     # Secrets for authentication using CHAP
     # client	     server  secret	       acceptable local IP addresses
     barney	     fred    flintstone
     fred	     barney  wilma

رҪע˫˫֤ĿصĻԶ˻֤ԼԶػ򱾵ػ֤Լ

13.5   PAP ֤

һЩʹӵжһʹ PAP ŷߣ
ʹÿӵĻ϶ͬⲢ⣮

Ȼʹϵͳ(ȫ)Ͼͬʹƣ ڴ
/etc/ppp/pap-secrets ȷѡʵһʱ⣮

ϵأPPP ṩһֻԿ˷ѣ PPP ʹ remotename
ѡΪԶŷ趨һ""

ӵ PPP ŷʹ fredԴ˷ʽ /etc/ppp/pap-secrets


     fred pppserver1	 barney
     fred pppserver2	 wilma

ˣ pppserver1 ʱ pppd ѡʹ name fred remotename
pppserver1  pppserver2 ʱʹ name fred remotename pppserver2

Ϊʹ pppd ʹ file filename ָ ppp
ѡԽһָӵÿ PPP
ŷȷȡѡѡȷ remotename ѡ


14.  ֶʽ PPP 

Ѿ /etc/ppp/options Լ /etc/resolv.conf
ԼҪ /etc/ppp/pap|chap-secrets
Խֶ PPP
Щ趨һʹֶǽԶụ̀

Ҫ£ͨѶڲݻ½ Minicom 
 ALT Q ڱȽϾɵ minicom  汾ʹ CTRL A Q








PPP HOWTO 							     34



ȷ root ǩ룮

ͨѶ壨 minicomӵ PPP ŷƽһǩ룮
Ҫĳָŷϵ
PPPɣ㽫ῴǰ

ʹ PAP  CHAP ĻֻߵԶϵͳӦþͻԶϵ PPP
㽫ûǩ¾ͼЩȻĳЩŷϲᷢ -
 Enter ܷ񿴵Щ

ڣڲҪݻ½ͨѶ( minicom ʹ ALT Q  CTL A
Q) Linux ʾ£ root ֣

     pppd -d -detach /dev/ttySx 38400 &

-d ѡ  ppp ʱġ̸¼ϵͳ¼ȥ
 鷳õģ

ݻĵӦҪ˸ΪҪ PPP ߣPPP ߵĽỨʱ䣮

ʱԹ۲ PPP 棬ɷָ

     ifconfig

ӵеκ̫·Լ豸֮⣬ӦûῴѶ:

     ppp0     Link encap:Point-Point Protocol
	      inet addr:10.144.153.104	P-t-P:10.144.153.51 Mask:255.255.255.0
	      UP POINTOPOINT RUNNING  MTU:552  Metric:1
	      RX packets:0 errors:0 dropped:0 overruns:0
	      TX packets:0 errors:0 dropped:0 overruns:0



    inet addr:10.144.153.10 Ǹ˵ IP 룮

    P-t-P:10.144.153.5 ŷ˵ IP 룮

(Ȼ ifconfig ᱨЩ IP 룬 PPP ŷʹõģ)

ע:  ifconfig ҲѾ𶯲ִ!

û ppp װгõѶ:

     ppp0     Link encap:Point-Point Protocol
	      inet addr:0.0.0.0  P-t-P:0.0.0.0	Mask:0.0.0.0
	      POINTOPOINT  MTU:1500  Metric:1
	      RX packets:0 errors:0 dropped:0 overruns:0
	      TX packets:0 errors:0 dropped:0 overruns:0

 PPP ߲ûн... йشų½!

㻹ԿⲿԶ˻()ĵ·Ҫ㣬ָ









PPP HOWTO 							     35



     route -n

Ӧÿ:-

     Kernel routing table
     Destination     Gateway	     Genmask	     Flags MSS	  Window Use Iface
     10.144.153.3    *		     255.255.255.255 UH    1500   0	   1 ppp0
     127.0.0.0	     *		     255.0.0.0	     U	   3584   0	  11 lo
     10.0.0.0	     *		     255.0.0.0	     U	   1500   0	  35 eth0
     default	     10.144.153.3    *		     UG    1500   0	   5 ppp0

رעĿָǵ ppp װã

һ( H űʾ)ǿⲿӵ -
ûˣ

ڶԤ·( pppd  defaultroute ѡ)
ݵ·ǵ Linux PC κβڲ̫·ķ͵ -
ָ· - Ҳǵ PPP ŷ  PPP
ŷΪǽ͵·Ӧķͻظǣ

ڵͱûĿЩ²Ծ رϵͳ¼(sys
log)ʾһѶϢ pppd
޷ȡѴڵԤ·һԤ·ָ̫· -
ָ·ȡ: ֻһԤ·!!!

һϵͳʼҳԤｨ( route add
default... ָָ) ĳ route add net...

ڽ ifconfig ֮ر IP  'ping'
һ¸ŷԲᣬ

     ping 10.144.153.51

Ӧûյ

     PING 10.144.153.51 (10.144.153.51): 56 data bytes
     64 bytes from 10.144.153.51: icmp_seq=0 ttl=255 time=328.3 ms
     64 bytes from 10.144.153.51: icmp_seq=1 ttl=255 time=190.5 ms
     64 bytes from 10.144.153.51: icmp_seq=2 ttl=255 time=187.5 ms
     64 bytes from 10.144.153.51: icmp_seq=3 ttl=255 time=170.7 ms

⽫һֱӡȥ   CTRL C ֹʱ㽫յѶϢ:

     --- 10.144.153.51 ping statistics ---
     4 packets transmitted, 4 packets received, 0% packet loss
     round-trip min/avg/max = 170.7/219.2/328.3 ms

Ŀǰܺã

 ping ĳ̨ PPP
ŷԼƣһطһ̨֪Ѿ𶯶

     ping sunsite.unc.edu








PPP HOWTO 							     36



ʱһͣ٣Ϊ Linux   /etc/resolv.conf ָ DNS ȡҪ
'ping' Ӧ IP λַ 
ԲҪģ㽫ῴݻƺ˸
ڶݵʱ㽫յ

      PING sunsite.unc.edu (152.2.254.81): 56 data bytes
     64 bytes from 152.2.254.81: icmp_seq=0 ttl=254 time=190.1 ms
     64 bytes from 152.2.254.81: icmp_seq=1 ttl=254 time=180.6 ms
     64 bytes from 152.2.254.81: icmp_seq=2 ttl=254 time=169.8 ms
     64 bytes from 152.2.254.81: icmp_seq=3 ttl=254 time=170.6 ms
     64 bytes from 152.2.254.81: icmp_seq=4 ttl=254 time=170.6 ms

һΣɰ CTRL C ֹȡͳ...

     --- sunsite.unc.edu ping statistics ---
     5 packets transmitted, 5 packets received, 0% packet loss
     round-trip min/avg/max = 169.8/176.3/190.1 ms

ûյκλӦ ping һ ISP ṩ DNS  IP λַ
õ϶Ľῴ /etc/resolv.conf 

ûн·ϣ ISP
ڽͻظʱ⣮ ĵͱû⣬ ISP
磮һ ISP ĺ÷һҵϵͳӣ
ͿԶߣ

һɼָֹ

     ppp-off

һζݵ֮ͣᣬݻӦûԼҶϵ绰

ָ޷Ļ᲻ǹصݻͨѶ岢 +++
жݻȻᵱյݻ OK ʾʱ ATH0 Ҷϵ绰

Ҳ pppd 

     rm -f /var/lock/LCK..ttySx


15.  ʹԶ - ָ

һķֶʽǩ룬õǽһЩָԶΪЩ

һ chat ָԶǩԼ PPP  ĳģ root
 ppp ȺԱֻ֣Ƿһָߣ

15.1  ʹƣָ֤

 ISP  Ҫʹ PAP/CHAP ĻЩΪ׼!

 ppp ׼װȷӦû  PPP 2.1.2  /usr/sbin
 PPP 2.2  /etc/ppp/scriptsЩ









PPP HOWTO 							     37



 PPP-2.1.2

     ppp-on
     ppp-off

 PPP-2.2

     ppp-off
     ppp-on
     ppp-on-dialer

ڣʹ PPP 2.1.2ǿҽɾЩ Ǳڵ
- Ҫǹúܺ - Ҳ˺ܳһʱ(һ HOWTO
ĵһƼ)!

Ϊ ppp 2.1.2	ʹߵȨ棬бȽϺõ嵵ЩǴ ppp 2.2
׼ģ ҽ㿽ʹЩָҪþɵ PPP-2.1.2
ָ壮

15.2  ppp-on ָ

ʵߵһָеĵһ

     #!/bin/sh
     #
     # Script to initiate a PPP connection. This is the first part of the
     # pair of scripts. This is not a secure pair of scripts as the codes
     # are visible with the 'ps' command.  However, it is simple.
     #
     # These are the parameters. Change as needed.
     TELEPHONE=555-1212      # The telephone number for the connection
     ACCOUNT=george	     # The account name for logon (as in 'George Burns')
     PASSWORD=gracie	     # The password for this account (and 'Gracie Allen')
     LOCAL_IP=0.0.0.0	     # Local IP address if known. Dynamic = 0.0.0.0
     REMOTE_IP=0.0.0.0	     # Remote IP address if desired. Normally 0.0.0.0
     NETMASK=255.255.255.0   # The proper netmask if needed
     #
     # Export them so that they will be available to 'ppp-on-dialer'
     export TELEPHONE ACCOUNT PASSWORD
     #
     # This is the location of the script which dials the phone and logs
     # in.  Please use the absolute file name as the $PATH variable is not
     # used on the connect option.  (To do so on a 'root' account would be
     # a security hole so don't ask.)
     #
     DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
     #
     # Initiate the connection
     #
     #
     exec /usr/sbin/pppd debug /dev/ttySx 38400 \
	     $LOCAL_IP:$REMOTE_IP \
	     connect $DIALER_SCRIPT









PPP HOWTO 							     38



 ppp-on-dialer ָ:-

     #!/bin/sh
     #
     # This is part 2 of the ppp-on script. It will perform the connection
     # protocol for the desired connection.
     #
     /usr/sbin/chat -v					     \
	     TIMEOUT	     3				     \
	     ABORT	     '\nBUSY\r' 		     \
	     ABORT	     '\nNO ANSWER\r'		     \
	     ABORT	     '\nRINGING\r\n\r\nRINGING\r'    \
	     '' 	     \rAT			     \
	     'OK-+++\c-OK'   ATH0			     \
	     TIMEOUT	     30 			     \
	     OK 	     ATDT$TELEPHONE		     \
	     CONNECT	     '' 			     \
	     ogin:--ogin:    $ACCOUNT			     \
	     assword:	     $PASSWORD

 PPP-2.2 Уppp-off ָ忴:-









































PPP HOWTO 							     39



     #!/bin/sh
     ######################################################################
     #
     # Determine the device to be terminated.
     #
     if [ "$1" = "" ]; then
	     DEVICE=ppp0
     else
	     DEVICE=$1
     fi

     ######################################################################
     #
     # If the ppp0 pid file is present then the program is running. Stop it.
     if [ -r /var/run/$DEVICE.pid ]; then
	     kill -INT `cat /var/run/$DEVICE.pid`
     #
     # If the kill did not work then there is no process running for this
     # pid. It may also mean that the lock file will be left. You may wish
     # to delete the lock file at the same time.
	     if [ ! "$?" = "0" ]; then
		     rm -f /var/run/$DEVICE.pid
		     echo "ERROR: Removed stale pid file"
		     exit 1
	     fi
     #
     # Success. Let pppd clean up its own junk.
	     echo "PPP link to $DEVICE terminated."
	     exit 0
     fi
     #
     # The ppp process is not running for ppp0
     echo "ERROR: PPP link is not active on $DEVICE"
     exit 1

15.3  ༭ṩʼָ

ΪµֳָݣǷֱ༭ǣ

15.3.1	ppp-on ָ

㽫ñ༭ָԷӳ ISP ʹƣ ISP 룬 ISP
ĵ绰룮

ÿһ TELEPHONE= ʵ趨ڵȺұߵѶ
(Ȼעⲿ) ˱༭ÿһʹ ISP ȷģ

ң(Ҫ) /etc/ppp/options 趨 IP 룬ɾ

     $LOCAL_IP:$REMOTE_IP \

Уȷ DIALER_SCRIPT ָ㽫ҪʹõĲָȫ·ƣ
ˣƶıָƣȷȷظı ppp-on
ָһУ








PPP HOWTO 							     40



15.3.2	ppp-on-dialer ָ

ǵڶָʵʽǵ PPP ᣮ

ע: һ chat
ָһȫͬһбһпԿеʵУĶָ屾ɵһݣ

ȻϸؿϸڲԱ˽ʵ()ҪʲǷǳõ!

15.4  һ chat ָеĺ...

һ chat ָһϵ"ڴִ" "ͳִ"ԣ
رǣע⵽ͳĳЩѶϢ֮ǰڴĳЩѶϢ֣

ûȽյκѶϢҪͳĳЩѶϢĻǱʹÿյڴִ
"" ָûͳκѶϢҪڴĳЩѶϢҲ!
ңִü֣ NO CARRIERִס
chat ִǵһĿ

 chat ָ:

     exec /usr/sbin/chat -v

 chat -v  chat е뿽ϵͳ¼ͨ
/var/log/messages һ chat ָȶɿ༭һа -v
ƳԱϵͳ¼Ļӣ

     TIMEOUT	     3


趨ڴʱʱΪ룮ʹǺݻܵҪ趨ʮ!

     ABORT	     '\nBUSY\r'

յ BUSY ִִֹУ

     ABORT	     '\nNO ANSWER\r'

յ NO ANSWER  ִִֹУ

     ABORT	     '\nRINGING\r\n\r\nRINGING\r'

յظģRINGRING ִִֹУΪĳ绰!

     "		    \rAT

ڴݻκѶϢͳ AT ִ

     OK-+++\c-OK   ATH0

һȽϸһ㣬ΪʹĳЩ chat Ĵظܣ

...ڴ OK ûյΪݻָģʽ£ͳ +++
ʹݻָģʽı׼ Hayes ݻִڴ OKͳ ATH0








PPP HOWTO 							     41



ݻҶִ ָӦݻ޷ߵ

     TIMEOUT	     30

趨ָŲִеʱʱΪ 30 룮Ϊʱ chat
ָ屻ֹ⣬Ϊ 45 ã

     OK 	     ATDT$TELEPHONE

ڴ OK ݻ ATH0 ָĻӦҲӵҪеĺ룮

     CONNECT	     "

ڴ CONNECT
ִԶݻлӦʱǵݻͳģҲͳλظѶϢ

     ogin:--ogin:    $ACCOUNT

һΣһЩظ趨ڴǩʾ(...ogin:)ʱǰûнյͳһԪ(return)ȻٴѰǩʾ
յʾʱͳʹƣʹ߽ $ACCOUNT 

     assword:	     $PASSWORD

ڴʾͳ루һΣʹ߽һ

 chat ָкĴظܣ Chat
ҪɫչʾҪ࣮ ϸѶ chat
ʹֲ(man 8 chat)

15.4.1	ŷ PPP

Ȼ ppp-on-dialer ָǩԶ pppd
ŷ˵ǳĺãȻĳЩŷҪ׵ŷ PPP

Ҫŷָ PPPҪ༭ ppp-on-dialer ָ壮


ָβ( password ) ڴ ͳ ִ - Ѱ
shell ʾ (رСĶ Bourne shell Ԫ -  $  [  ]
ҷŵ)

һ chat ҵ shell ʾţchat ָ ISP  PPP ŷ

ҵӶԣҵ PPP ŷʹñ׼ Linux Bash ʾ

     [hartr@kepler hartr]$

ҪҴ

     ppp

ŷϵ PPP

ڴһظǸ⣬ҵ








PPP HOWTO 							     42



	  hartr--hartr	 ppp

˵ʱǰûյʾţͳ return ٴεȴʾţ

һյʾţͳ ppp ִ

ע: ǰһнǰ \ Ա chat Ϊָһ!

ҵǣĳЩŷǳʾ!  ܱʹ minicom
ǩ뼸Ա˽ʲΪȷ"ڴ"ִ

15.5  ʹ PAP/CHAP ߵ chat ָ

 ISP  ʹ PAP/CHAP ϣ chat ָ򵥵ö࣮  chat
ָҪȫֻǲӵ绰ȴߣȻ pppd ȥǩ!

     #!/bin/sh
     #
     # This is part 2 of the ppp-on script. It will perform the connection
     # protocol for the desired connection.
     #
     exec /usr/sbin/chat -v				     \
	     TIMEOUT	     3				     \
	     ABORT	     '\nBUSY\r' 		     \
	     ABORT	     '\nNO ANSWER\r'		     \
	     ABORT	     '\nRINGING\r\n\r\nRINGING\r'    \
	     '' 	     \rAT			     \
	     'OK-+++\c-OK'   ATH0			     \
	     TIMEOUT	     30 			     \
	     OK 	     ATDT$TELEPHONE		     \
	     CONNECT	     '' 			     \

15.6  pppd  debug  file option_file ѡ

ѾģԶ pppd ʹ -d ѡѶϢ¼ 'debug'
ѡһģ

Ϊʹµָ彨µߣȷѡܣ (:
Ĵŵռ䲻󹻣¼ pppd
ѶϢܻϵͳ¼Сʹ鷳 -
ڴضʧܲ)

һ˵ΪһйԳȥѡ

㲻Ǵ /etc/ppp/options  /etc/ppp/options.ttySx нг ppp ѡ
 pppd  file ѡָ - 

     exec /usr/sbin/pppd debug file options.myserver /dev/ttyS0 38400 \


16.  ָ

һµ Xterm X	£һµ̨ root
ǩ룮








PPP HOWTO 							     43



µĽ׶ҵУָ

     tail -f /var/log/messages

ϵͳ¼κƣ

ڵһӴ̨У

     ppp-on &

κ༭ /usr/sbin/ppp-on 汾֮ƣ
ûнָβָ & ʹָ뱳ִеĻ ppp
߽ʱ֮ǰ㶼ܻصն˻ʾ

л׷ϵͳ¼Ӵ

㽫ĳЩеĶٶ chat ָ -v Ҷ pppd ָ -d
ѡ....  ǽ pppd Ѷ֮¼ϵͳ¼ chat
ָ弰Ӧ:

     Oct 21 16:09:58 hwin chat[19868]: abort on (NO CARRIER)
     Oct 21 16:09:59 hwin chat[19868]: abort on (BUSY)
     Oct 21 16:09:59 hwin chat[19868]: send (ATZ^M)
     Oct 21 16:09:59 hwin chat[19868]: expect (OK)
     Oct 21 16:10:00 hwin chat[19868]: ATZ^M^M
     Oct 21 16:10:00 hwin chat[19868]: OK -- got it
     Oct 21 16:10:00 hwin chat[19868]: send (ATDT722298^M)
     Oct 21 16:10:00 hwin chat[19868]: expect (CONNECT)
     Oct 21 16:10:00 hwin chat[19868]: ^M
     Oct 21 16:10:22 hwin chat[19868]: ATDT722298^M^M
     Oct 21 16:10:22 hwin chat[19868]: CONNECT -- got it
     Oct 21 16:10:22 hwin chat[19868]: send (^M)
     Oct 21 16:10:22 hwin chat[19868]: expect (ogin:)
     Oct 21 16:10:23 hwin chat[19868]: kepler login: -- got it
     Oct 21 16:10:23 hwin chat[19868]: send (hartr^M)
     Oct 21 16:10:23 hwin chat[19868]: expect (ssword:)
     Oct 21 16:10:23 hwin chat[19868]:	hartr^M
     Oct 21 16:10:23 hwin chat[19868]: Password: -- got it
     Oct 21 16:10:23 hwin chat[19868]: send (??????^M)
     Oct 21 16:10:23 hwin chat[19868]: expect (hartr)
     Oct 21 16:10:24 hwin chat[19868]: [hartr -- got it
     Oct 21 16:10:24 hwin chat[19868]: send (ppp^M)
     Oct 21 16:10:27 hwin pppd[19872]: pppd 2.1.2 started by root, uid 0
     Oct 21 16:10:27 hwin pppd[19873]: Using interface ppp0
     Oct 21 16:10:27 hwin pppd[19873]: Connect: ppp0 <--> /dev/cua1
     Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(LCP): Sent code 1, id 1.
     Oct 21 16:10:27 hwin pppd[19873]: LCP: sending Configure-Request, id 1
     Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfreq(LCP): Rcvd id 1.
     Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd MRU
     Oct 21 16:10:27 hwin pppd[19873]: (1500)
     Oct 21 16:10:27 hwin pppd[19873]:	(ACK)
     Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd ASYNCMAP
     Oct 21 16:10:27 hwin pppd[19873]: (0)
     Oct 21 16:10:27 hwin pppd[19873]:	(ACK)








PPP HOWTO 							     44



     Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd MAGICNUMBER
     Oct 21 16:10:27 hwin pppd[19873]: (a098b898)
     Oct 21 16:10:27 hwin pppd[19873]:	(ACK)
     Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd PCOMPRESSION
     Oct 21 16:10:27 hwin pppd[19873]:	(ACK)
     Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd ACCOMPRESSION
     Oct 21 16:10:27 hwin pppd[19873]:	(ACK)
     Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: returning CONFACK.
     Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(LCP): Sent code 2, id 1.
     Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfack(LCP): Rcvd id 1.
     Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 1, id 1.
     Oct 21 16:10:27 hwin pppd[19873]: IPCP: sending Configure-Request, id 1
     Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfreq(IPCP): Rcvd id 1.
     Oct 21 16:10:27 hwin pppd[19873]: ipcp: received ADDR
     Oct 21 16:10:27 hwin pppd[19873]: (10.144.153.51)
     Oct 21 16:10:27 hwin pppd[19873]:	(ACK)
     Oct 21 16:10:27 hwin pppd[19873]: ipcp: received COMPRESSTYPE
     Oct 21 16:10:27 hwin pppd[19873]: (45)
     Oct 21 16:10:27 hwin pppd[19873]:	(ACK)
     Oct 21 16:10:27 hwin pppd[19873]: ipcp: returning Configure-ACK
     Oct 21 16:10:28 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 2, id 1.
     Oct 21 16:10:30 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 1, id 1.
     Oct 21 16:10:30 hwin pppd[19873]: IPCP: sending Configure-Request, id 1
     Oct 21 16:10:30 hwin pppd[19873]: fsm_rconfreq(IPCP): Rcvd id 255.
     Oct 21 16:10:31 hwin pppd[19873]: ipcp: received ADDR
     Oct 21 16:10:31 hwin pppd[19873]: (10.144.153.51)
     Oct 21 16:10:31 hwin pppd[19873]:	(ACK)
     Oct 21 16:10:31 hwin pppd[19873]: ipcp: received COMPRESSTYPE
     Oct 21 16:10:31 hwin pppd[19873]: (45)
     Oct 21 16:10:31 hwin pppd[19873]:	(ACK)
     Oct 21 16:10:31 hwin pppd[19873]: ipcp: returning Configure-ACK
     Oct 21 16:10:31 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 2, id 255.
     Oct 21 16:10:31 hwin pppd[19873]: fsm_rconfack(IPCP): Rcvd id 1.
     Oct 21 16:10:31 hwin pppd[19873]: ipcp: up
     Oct 21 16:10:31 hwin pppd[19873]: local  IP address 10.144.153.104
     Oct 21 16:10:31 hwin pppd[19873]: remote IP address 10.144.153.51

ע  ʹþ̬ IP   ҵĻЩ PPP ŷȥ 
ʹö̬ IP 㽫ῴЩ
УŷҪָ PPP

⿴ûʲ  ͬǰĲ԰㣬 ping һЩ IP Լƣ

ȫѶκҿʼ  !


17.   PPP 

 PPP  ֮ᣬʹñ׼ ppp-off ָֹҪǵ  
root  PPP  ȺԱ! 

㽫ϵͳ¼￴һЩĵĶ:










PPP HOWTO 							     45



     Oct 21 16:10:45 hwin pppd[19873]: Interrupt received: terminating link
     Oct 21 16:10:45 hwin pppd[19873]: ipcp: down
     Oct 21 16:10:45 hwin pppd[19873]: default route ioctl(SIOCDELRT): Bad address
     Oct 21 16:10:45 hwin pppd[19873]: fsm_sdata(LCP): Sent code 5, id 2.
     Oct 21 16:10:46 hwin pppd[19873]: fsm_rtermack(LCP).
     Oct 21 16:10:46 hwin pppd[19873]: Connection terminated.
     Oct 21 16:10:46 hwin pppd[19873]: Exit.

Ǹ SIOCDELRT - ⲻ pppd ʾҪ˶ûʲõĵģ


18.  

иֿܵԭ޷   chat
޷ȷɣ·Ѷܴȵȣ ԣϵͳ¼Ѱ

18.1  Ұ PPP ȥ Linux ˵û...

һǳѾ PPP 뵽֮вҳִ
pppdȻԹ˵֧Ԯ PPP!  ԭܵ´·

18.1.1	ȷĺ?

ȻѾ±֧Ԯ PPPȴûµĺģ Ϊûи
/etc/lilo.conf  lilo

ķָ uname -aĽ

     Linux archenland 2.0.28 #2 Thu Feb 13 12:31:37 EST 1997 i586

˺ĵİ汾ı - ֪׷ʲ£

18.1.2	㽫 PPP ֧ԮΪģ?

㽫 PPP ֧ԮΪģ飬ȴûб뼰װģ飬ͻõ
һ Kernel-HOWTO Լ /usr/src/linux µ README !

һģĿҪģԶر룬ȴûִ kerneld
(Զ벢ƳģĹ) һ kerneld mini-HOWTO Ѷ˵趨
kerneld

18.1.3	Ƿȷ PPP 汾ĺ?

ʹ ppp-2.2 Ϻ 2.0.X ں 1.2.X ʹ ppp-2.2
(޲)ʹ ppp-2.1.2

18.1.4	Ƿ root ִ pppd?

㲻 root ִ pppd ( pppd δ趨Ϊ root
ִ)ͻյѶϢ

18.2  ҵݻ˵ PPP δ

ͬҲԭ(οһ comp.os.linux...)








PPP HOWTO 							     46



һĴָٴĳЩ Ψһ㽫 Linux
PC ŷĶԻǵϵͳ¼(/var/log/messages)Ȼһһеؿϸ
ܻҪٴֶŷһ飮

ҪͷβСĵؼ 
ҪǵĶΪǼ 
!

18.3  ϵͳ¼˵ "serial line is not 8 bit clean..."

Ҳ -  serial line looped back
ȵȣµԭеһ(һϵ)

Ҫ֪׷ʲᣬ pppd Щʲе˽⣮

 pppd ᣬͳЭ(link control protocol)Զ˻
յϷĻӦŻߵһ׶(ʹ IPCP - IP
Ʒ)ֻЭ֮ʵʵ IP ŻὨʹ PPP ᣮ

 PC ͳЭ̷ʱԶû PPP
ŷЩԶǩн ΪЩʹ 8
bitsʱὫڰ˸λԪص(ΣASCII λԪ) PPP
˶ԹѶϢ

ԭЭ̷أ

18.3.1	ûȷǩŷ

 chat ָᣬ PC 
pppdȻ㲢δŷǩ(ͳκαҪŷ PPP
ָ)PPP ͲῪʼ

ЭҲյ

Сĵؼ鲢(ҪĻ) chat ָ(μ˵)

18.3.2	㲢δŷϵ PPP

ĳЩ PPP ŷǩҪָ RETURN ŻԶ
PPP

 chat ָ(μ˵)

ֶʽǩʱͳ RETURN ŻԶ PPP򵥵
chat ָβ˼Ͽհ׵ڴ/ͳִ(յͳִʵϻͳ RETURN)

18.3.3	Զ˵ PPP 

е!

Ԥ Linux pppd ͳʮ߿Ҫ
ŷеʮ߷Զ PPP ׼ýǰȫͳˣ

Ļϣpppd ʮ(ڰλԪȥ)








PPP HOWTO 							     47



Խ:-

 PPP ѡм lcp-max-configure 30  pppd
ڷǰͳ߷Ŀһĺŷ˵ܻҪ࣮

ߣԻعһЩɣע⵽ֶǩ PPP ŷ PPP
ʱյĵһ tilde(~) Ԫ

ô˵ǿ chat ָβ˼µڴ/ͳִԣڴ tilde
Ԫͳκζ ⿴:-

     \~   ''

ע: Ϊ tilde Ԫ shell
˵壬ݳ(ǰĵб)

18.4  Ԥ·

 pppd
ܾԤ·Ϊ(Ӧû)ܾƳȡеԤ·

ͨԭΪĳЩ׼̫·ΪԤ·Ϊָ·ͣ

μ Linux NAG  Net2/3 HOWTOs
Ѷȷ趨̫·صĵͣ

һԭ·ʹբ·ĵͱ趨ΪԤ·ָ

ҪҪ·֪ʶѾ˷ HOWTO ġΧˣ
ȡһЩרҵ(ȺΧʵ)

18.5  

ԭ PPP ޷ӻ޷ȷ

ϸ PPP FAQ
һϵеش𣩣һݷǳʵļҴ𰸾!
Լãľ飬𰸲УͲ PPP Ĵ!
Ϊʹ ELF
Ķûʵĺģ飮֮ǰҽ˷˴죨ԼһϵĴ󲿷ʱ䣩ȥǸʵѷǳõ
PPP ŷ


19.  ȫ춽ʱȡð

㲻ʹ PPP  ͷĶļÿһ  ͬʱ
"chat -v..." Լ "pppd -d"  ϵͳ¼ｨΪο

ҲҪο PPP  ļԼ FAQ  ڴἰļ!

Ȼ춽״̬ĻЩܹ PPP
ⷽ˻ġйɵɨ comp.os.linux.misc  comp.os.linux.net
working ȺԼ comp.protocols.ppp









PPP HOWTO 							     48



ԳԼĸ˵ĵʼңԼĹҲ֤ܿػظʹȫΪĿǰĹԼ˽˵״̬!

ر  ҪĴȺҲҪɵʼĸ 
ǰ˷Ѵ·Ƶ߽ת /dev/null (رҪĸ!)


20.  ֮ձ

һ㽫ᷢṩֻ֧ԮǸʺŵװ壮
⣨ͣǸ΢Ӵ :-(  ṩߵ֧Ԯһ㶼˽
Unix (or Linux) Ҫ׼ǵò̫Э!

㵱Ȼ԰һæҽǹ Linux ֪ʶκ ISP
ЭԱ·жӦ "֪" ζڼӦҪ̨ Linux
  Ȼ!

20.1  ޷ߵ PPP ŷ

õ   PPP  ѽִжԽɸ PPP ŷ IP 루
ifconfig ppp0 ָʾĵڶ  "Զ"   IP 룩 ping
ŷ㲻ܴκεط

ȣ ping  /etc/resolv.conf ָΪŷ̨ IP 룮
ԵĻͿԼ PPP	ŷ֮Ķ IP
ߵ "Զ" IP ͬ  ping
ķṩߵ·  

     ping my.provider.net.au

޷ɹиƽϵ⣮Ϊ
/etc/resolv.conf дִ
绰ķṩ߶õѶСĵؼȫû⣬ٴ绰ṩȷдȷ
IP 롵

Ȼ޷ķṩȷŷпִУĵط
 ҽСĵشͷβ㰲װ Linuxرע⵵Ȩޣ

Ȼܽ IP  ping
ṩߵŷ᲻ǹص绰ȷһ£иⷢķṩǱߣ
һΣ绰ǲʿ

и "Զ" һ̨ Linux PPP ŷûָ IP forwarding
ѡ!

һõĲԷʹôṩһף Microsoft Windows
峢Խķṩߣ
ȫͬʺһҵϵͳһ Linux
ϵͳ϶ķṩǱߣ

20.2  ҿԼ͵ʼܽ

ʹö̬ IP 룬Ǻģ " (section 21., page
49)" һڣ









PPP HOWTO 							     49



20.3  ΪʲǲҵĻ finger, WWW, gopher, talk ȵ?

ͬأʹö̬ IP 룬Ƿǳģ  " (sec
tion 21., page 49)"ýڣ


21.  Զ̬ IP ṩ·

ʹö̬ IP 루ṩҲֻṩ̬ IP
Ϊ߸ۣʶƣ

ȣͷ󽫲⣮˵ʹ sendmail
ͳʼԶ˽ڵ㴫(ftp) (fin
ger)ϵʹߣȫѶȵȣ

رǣȻ㲻ϵԻظϵĵʼʼضʵֱ㲦
ISP ͳ

ȻĻһ 24 Сʱ·ϣÿҲӵͬ IP
룮
㲻ܽӵõֱӼĵĵʼҺһ̨ȫѶŷ򵵰ŷ!
Ϊ·ĻһΨһģÿϵĹϵΪĻûΨһ
IP (ס - ĻҲʹЩ IP 룬ǲʱ)

һ̨
WWWκŷ·ϵκ˶ȫ֪֪ĻԼȷʵĿǰ
IP 룮
ܵԵõѶ绰ǣķʼǻṩߵʺʹ
".plan" ṩ shell  finger ȡ

ڣԴ󲿷ֵʹ߶ԣⲻǸ 
󲿷ҪȫֻǼյʼʹṩϵʺţԼߵȫѶ䵵Լ·ϵķ
ӵڵ߷Ӧȡþ̬ IP
룮һַоǰʾķ...

21.1  趨ʼ

ʹǶ̬ IP 룬ȷϵ sendmail
ͳڱضдõκεʼ й sendmail
ÿܻǺܺҺѵ  ļͼ
ȻӦ sendmail Ա·ṩΪ "smart
relay"  sendmail.cf  DS ѡΪϸѶ sendmail
ļ  渽 sendmail  m4
þ޼ȷһһܷҪ

Ҳһǳõڽ Sendmail(O'Reilly and Associates Ϊ
'ʥ')Դ󲿷ݵʹ˵ʵ̫!

һú sendmail ᣬ PPP ߸һ𶯵ʱҪ sendmail
ϿͳκδʼѶϢ ҪĻָ

     sendmail -q &

 /etc/ppp/ip-up ָ(μ˵)








PPP HOWTO 							     50



ڵĵʼԶ̬ IP Ǹ⣮ķ:

    ʹʵݳʽͳȥʼ "reply to"
     ͷи·ṩϵĵʵλַ

     ԵĻҲӦý FROM ַΪ ISP ṩĵʵλַ

    ʹ popclient ʽķṩǱߢȡĵʼߣ
     ISP ʹ IMAPʹ֧Ԯ IMAP ʹʵݳʽ( pine)

Խ /etc/ppp/ip-up
ָзҪָԱڲʱԶ(μ˵)

21.2  趨صŷ

Ȼʹ ISP
ŷҲһ̨صݴרãҪŷ
ip-up ָ
ܱأݴרãŷĺôڼ䳣ϵͬĽڵԽʡʱ䣨ԼƵ

ݴרŷ named.boot ʹһ  'forwarders' ָ ISPs 
DNSŷñȽϼ򵥣 O'Reilly book (DNS and Bind)
Ҫ֪Ķ

Ҳһ DNS-HOWTO ȡã

һС· Linux PC ȡ·(ʹ IP αװ)
ڱضִŷ(ʹ forwarders
)Ǹ⣬Ϊήƽռõ·Ƶӳʱ䣮

·ҵһҪ: Ҫ ISP
￪ʼһ̨Ҫģݴרõŷ֮ǰѯ ISP صȨޣ
ȷ DNS һ㶼 ISP
ţЩʲᣬܻ鷳...


22.  ʹ PPP ·

ᵥһ̨ Linux PC  PPP  ŷԼʹ PPP
·ûʲ𣮼ǵãPPP һֵԵЭ

Ȼȷ˽춵·ν⣮Ķ NET-2 howto Լ Linux Net
work Administrator Guide (NAG) ҲⱾ "TCP/IP Network Administra
tion" (by O'Reilly and Assoc -	ISBN 0-937175-82-X)мѵİ

ĳһʹһ·Ĵ·ָᷢ Linux (draft) sub
networking mini-howto õģ  Linux Sub networking mini-HOWTO21
ҵ

Ϊ·ʹõıǲͬ IP
·(ͬ·ŵĴ·)㽫ʹþ̬ IP   ʹ IP

____________________

21.<URL:http://www.interweft.com.au/other/>







PPP HOWTO 							     51



αװ Ҫʹ IP αװĻ IP masquerade mini-howto
й趨ܣ

22.1  趨 IP 

··Э˵ PPP ʹõ IP 룮 ʹþ̬
IP 룬ҲҪ㲦ضĵ绰룮

ڱ༭ʵ /etc/ppp/options[.ttyXX]  
춴һʹضݻвǸ⣮ ҲҪȥ
/etc/ppp/options   ҲҪΪκ߽ʵ options.ttyXX !

ʵѡָ PPP ˵ IP 룬ǰչʾʹþ̬ IP
벦ӵķʽȫͬ

22.2  趨·

밲·ϵķ PPP
ĽͳȥǸ׶εḶ́

ȣ뽨ִ PPP ĻԶ·ȥĵ·
ͨ·Խ pppd ѡ 'defaultroute'
ԼԤ·㲻κ£

Ȼֻ·һָ·· 
/etc/ppp/ip-up ָʹ 'route' ִָеģ֮...
ýйִеĽܣ

ĵڶǸ·ϵ̨ Linux ʵǸ ppp
ͨԶ·'բ'

ȻЩһ˵·Ҳȫ!
ȻΪ/뽫͵·һָ··ǱҪģԤ·(Զ˵·ȥȡ·)

22.3  ·ȫ

ʹ PPP ··ȥ 
ֻǵһ""·ȥ㶼뿼ǰȫԵ⣮
ǿҹ㿼һ̨ǽ!

㻹ӦԴ˷ʽ··֮ǰȸ·ߣ
ûĻʹص鷳!


23.  ֮ - /etc/ppp/ip-up ָ

һ PPP Ὠᣬ pppd Ѱ /etc/ppp/ip-up ָ壮
ָڲҿִеĻ PPP  ŷʽͻִָ壮
ԶִκοбҪ·ָκÿ PPP
ʱִеĶ

ⲻһͨ shell
ָ壬κָ(Ҳǣκ)









PPP HOWTO 							     52



磬Ҫ sendmail Ͽ촦ʼеȴ͵ѶϢ

Ƶأ ip-up һЩָȡãʹ POP ISP
Ǳߵκεʼ

 /etc/ppp/ip-up ҲЩ:-

    Ծ޵ĻӰȫԣҲ˵ִеȫ·Ƶȣ

    ˵/etc/ppp/ip-up һʽָ壮 ˵Աֱִ -
     Ҳڵһпʼб׼ file magic (#!/bin/bash) ܱ root
     ȡִУ

23.1  ·

·㽫һ '' ·ָ·
Ժ׵ʹ /etc/ppp/ip-up ָɣΨһѷĻж
PPP  ʱ

Ϊ /etc/ppp/ip-up ָÿһ𶯵 ppp
ִеģҪСĵΪÿһ𶯵ִȷĵָ!

23.2  ʼ

·Ὠ֮ᣬҪȷеĵʼ -
͵Ŀĵأ ʵĺ sendmail ɣ

 pppd ݸָضʹ bash  `case' 
磬ǵĹ·ἰͨҼ̫·ģҲͬ PPP
ŷ/etc/ppp/ip-up ָ壮

23.3  һ /etc/ppp/ip-up ָ

ṩͬʹá




























PPP HOWTO 							     53



     #!/bin/bash
     #
     # Script which handles the routing issues as necessary for pppd
     # Only the link to Newman requires this handling.
     #
     # When the ppp link comes up, this script is called with the following
     # parameters
     #	     $1      the interface name used by pppd (e.g. ppp3)
     #	     $2      the tty device name
     #	     $3      the tty device speed
     #	     $4      the local IP address for the interface
     #	     $5      the remote IP address
     #	     $6      the parameter specified by the 'ipparam' option to pppd
     #
     case "$5" in
     # Handle the routing to the Newman Campus server
	     202.12.126.1)
		     /sbin/route add -net 202.12.126.0 gw 202.12.126.1
     # and flush the mail queue to get their email there asap!
	       /usr/sbin/sendmail -q &
		     ;;
	  139.130.177.2)
     # Our Internet link
     # When the link comes up, start the time server and synchronise to the world
     # provided it is not already running
		     if [ ! -f /var/lock/subsys/xntpd ]; then
			     /etc/rc.d/init.d/xntpd.init start &
		     fi
     # Start the news server (if not already running)
		     if [ ! -f /var/lock/subsys/news ]; then
			     /etc/rc.d/init.d/news start &
		     fi
		     ;;
	  203.18.8.104)
     # Get the email down to my home machine as soon as the link comes up
     # No routing is required as my home Ethernet is handled by IP
     # masquerade and proxyarp routing.
	       /usr/sbin/sendmail -q &
	       ;;
	     *)
     esac
     exit 0

ͨ Newman У԰ ppp
ԼָĽõͱ¼̨Ҳͨõ
PPP ŷҴǵ·ᣩ
ѾһЩעԽÿĿʲ:















PPP HOWTO 							     54



     [root@kepler /root]# route -n
     Kernel routing table
     Destination     Gateway	     Genmask	     Flags MSS	  Window Use Iface
     # the HOST route to our remote internet gateway
     139.130.177.2   *		     255.255.255.255 UH    1500   0	 134 ppp4
     # the HOST route to our Newman campus server
     202.12.126.1    *		     255.255.255.255 UH    1500   0	  82 ppp5
     # the HOST route to my home ethernet
     203.18.8.104    *		     255.255.255.255 UH    1500   0	  74 ppp3
     # two of our general dial up PPP lines
     203.18.8.64     *		     255.255.255.255 UH    552	  0	   0 ppp2
     203.18.8.62     *		     255.255.255.255 UH    552	  0	   1 ppp1
     # the specific network route to the Newman campus LAN
     202.12.126.0    202.12.126.1    255.255.255.0   UG    1500   0	   0 ppp5
     # the route to our local Ethernet (super-netting two adjacent C classes)
     203.18.8.0      *		     255.255.254.0   U	   1500   0	1683 eth0
     # the route to the loop back device
     127.0.0.0	     *		     255.0.0.0	     U	   3584   0	 483 lo
     # the default route to the Internet
     default	     139.130.177.2   *		     UG    1500   0	3633 ppp4

23.4  ʼ

һἰδ͵ʼ  һ߽֮򵥵ؽʼдɣ

ִ·ᣬԸԶ··ЭִȫͬĶ
磬ǵĹ· Newman У԰һ˵ /etc/ppp/ip-up ָ忴:

     #!/bin/bash
     #
     # Script which handles the routing issues as necessary for pppd
     # Only the link to Hedland requires this handling.
     #
     # When the ppp link comes up, this script is called with the following
     # parameters
     #	     $1      the interface name used by pppd (e.g. ppp3)
     #	     $2      the tty device name
     #	     $3      the tty device speed
     #	     $4      the local IP address for the interface
     #	     $5      the remote IP address
     #	     $6      the parameter specified by the 'ipparam' option to pppd
     #
     case "$5" in
	     203.18.8.4)
		     /usr/sbin/sendmail -q
		     ;;
	     *)
     esac
     exit 0

Ȼֻʹö̬ IP 뷽ʽ PPP   ISPô ISP
ϵʺȡĵʼ ͨʹ POP(Post Office Proto
col)Эɵģʹ `popclient' ʽ   ip-up
ָҲΪԶ








PPP HOWTO 							     55



򵥵ؽһ /etc/ppp/ip-up ָ壬а popclient ʽʵָ
ִ Red Hat Linux	ϥ͵ϣκʱҶ

     popclient -3 -c -u hartr -p <password> kepler.hedland.edu.au |formail -s procmail

ʹ slurp ͬķʽȡ·ţԼķ
ǵãip-up ָֻǸ׼ bash ָ˿Զÿʵ
PPP ὨʱҪɵκιܣ


24.  ʹ /etc/ppp/ip-down

Խһָһִ֮У /etc/ppp/ip-down 
ԭκζӦ /etc/ppp/ip-up ָ⶯


25.  ·ϵĵ

Ѿĳ·ϵȻҪʹ˵ Linux ϵ pppd
ĻҪӦĳЩͷ⣬Ļ·̫·棩ԼԶ˵
PPP ŷ͸磮

һڲԽйط͵Ļ 
ֻһ򵥵ģضĵ̬ģ!

㲻ϤͻƵĻǿҵعĶ Linux Network Administrator
Guide (NAG) ͬʱ O'Reilly  "TCP/IP Network Administration"
ҲԷǳ˽ķʽ⣮

̬·ĻԤ·Ӧָ·λַһ
·ڵͱָ·

Ψһܵ Linux һû··
 ҪȻ·²ӵ·ϹԼʹã

ȣȷ̫··ܹͨ·ָ·λַ 
Ԥ·!

ɷ route	ָ֮ӦûῴµѶϢ:

     [root@hwin /root]# route -n
     Kernel routing table
     Destination     Gateway	     Genmask	     Flags MSS	  Window Use Iface
     loopback	     *		     255.255.255.0   U	   1936   0	  50 lo
     10.0.0.0	     *		     255.255.255.0   U	   1436   0	 565 eth0

̫· (eth0) ָԤ· eth0 еĵһϻʾ
"default"
Ҫ̫·ʼָʹָض·Ԥ·
Net2 HOWTO Լ NAG

⽫ pppd Ԥ·ʾ:










PPP HOWTO 							     56



     [root@hwin /root]# route -n
     Kernel routing table

     Destination     Gateway	     Genmask	     Flags MSS	  Window Use Iface
     10.144.153.51   *		     255.255.255.255 UH    488	  0	   0 ppp0
     127.0.0.0	     *		     255.255.255.0   U	   1936   0	  50 lo
     10.1.0.0	     *		     255.255.255.0   U	   1436   0	 569 eth0
     default	     10.144.153.51   *		     UG    488	  0	   3 ppp0

ͬģӵо ppp0  PPP
ŷ(10.144.153.51)趨Ҳӵʹ PPP
ŷΪբԤ·趨

趨Ҫȴ˸  ĶѾйص͵ļԵר!

·Ѿ·Ѿͨ·բ
ӦԤ·ָ PPP  
ʹĵ·ָ··

25.1  ȫϵע

е·趨һ̨ Linux
ᵽ·ϣڲ֪Ѿ·  Լĺ 
·
֮ǰǿҵع·߲οôİȫԣ 
PPP
߱ɹվ̨ĻҲͬⷵʹߣ·ϵͳĹǿҵķŭ
ҲܻᷢԼ춷ǳص鷳!

··ȥ֮ǰǶ̬㶼ӦҪǰȫ 
ο O'Reilly  "Building Internet Firewalls"!


26.   PPP ŷ

ͬǰģ෽ԿԴɣ
ܵķʹ Cyclades
಺пԼһԶתӵĵ绰·

㲻ϲܵķɵʹԼķ
Һʹ˵δİ汾аķʽԣ۸ĸ!

ע⣬һֻ趨 Linux  Ϊ PPP
ŷйأҲ루й趨ն˻ŷһѶ

ңδʵ shadow
ʹãӦûĿǰܵѶκ shadow Ҫ趨

26.1  

춱Լ pppd
汾˵ãڼѾļǰ½!

 PPP  ŷĺа IP forwarding Ĺܣ








PPP HOWTO 							     57



ҲܻϣĹܣ IP firewalls, accounting ȵȣ

ʹö಺пҲȷĺаҪʽ!

26.2  ŷϵͳĸŹ

ʹͬʹƣṩ PPP (and SLIP) ʺԼ shell ʺţ
ĺôǶԣʹֻҪһʺžͿʹߣ

Ϊǽ֯ǲְԱԼѧʹշѣԲصļշѵ⣮

ǵĽڵ·֮һ̨ǽĳЩʹߵĴȡΪ·ǵģ·ǽڣɺԣ·ǽϸҲڴ˳ֶκ¶ûйϵ

ʹ߽ǽڵ֮ PPP ĳ򣨵ȻӵЧʺᣩ:

    ǵԶתӲһݻĵһ绰 
     һ̨աݻĵ绰

    ʹһЧʹԼǩ룮

     shell ʾ£ ppp ָŷϵ PPP 

    ǻϵ PPPִ Windows, DOS, Linux, MAC OS
     κҵϵͳĻ  ǵ⣩

̨ŷΪÿĲʹø /etc/ppp/options.ttyXX Ϊ̬ IP
趨Զ˵ IP 룮 ŷΪԶصĿͻʹôλַЭ(prox
yarp)ͷʵ pppd ѡ趨 ʹ routed 
gated 

ʹߴǶ˹Ҷʱpppd ݻҪҶϣͬʱͣ PPP
ᣮ

26.3  ȫ

㽫Ҫе:-

    Linuxʵر԰Ҫѡ

    ʺĵ pppd 汾

    һܹشݻͨѶ 'getty' ʽ

     ʹõ getty_ps2.0.7h  mgetty ˽ mgetty
     ʹ pap/chap ĺУ pap  Windows 95
     ʹõı׼Զ pppdδо

    Ĳʹܹȡһ̨ŷ (DNS)

     пܵĻӦִԼŷ...

26.4  趨׼Ĳ(shell access)

 PPP  ŷ֮ǰ Linux ܹ׼ĲӴȡ








PPP HOWTO 							     58



ʹ˵趨ѡ֮ getty ļԼ Serial HOWTO
й趨Ѷ

26.5   PPP ѡ

㽫ΪвӲһȫ /etc/ppp/options ͨõѡ
ʹõѡ:

     asyncmap 0
     netmask 255.255.254.0
     proxyarp
     lock
     crtscts
     modem

ע - ûʹκ(Ե)趨 - رû defaultroute ѡ
Ϊ(Ϊ PPP ŷ)Ҫľǽ PPP
ͻ˵͵··ҽ·͵Ŀͻˣ

ȫֻǵͻͣʹ pppd  'proxyarp' ѡɣ

 'proxyarp' ѡһλַЭĿ PPP
ŷλַЭ(ARP)УǻϾ˵ 'Ҫ PPP
ͻ˵ķ͸' ǽһ PPP ͻ˵ĵ·򵥵һʽ -
㲻ַʽ·֮ͷ -
ʵ·ͶʹôλַЭ

㼸һϣṩ̬ IP ĲʹߣԽɷ IP
ÿӲĿģ ڣΪÿӲһ
/etc/ppp/options.ttyXX 

棬ֻҪ򵥵ط뱾أŷ IP 뼰òҪʹõ IP 룮

     kepler:slip01

رע⣬ʹúϷƣҷֻǵ·Ҫ豸
IP   ƻŶԣ!

26.6  趨 pppd Աʹߣɹأִ

Ϊ ppp
ú豸·棩ٿغĵͱĶҪرȨ
 ʵҪ root Ȩޣ

˵ǣ pppd ѾƳɿ԰ȫ趨Ϊ root ִУ

     chmod u+s /usr/sbin/pppd

гʱӦûͬ

     -rwsr-xr-x   1 root     root	 74224 Apr 28 07:17 /usr/sbin/pppd

ûʹ߽ǵ PPP ᣮ









PPP HOWTO 							     59



26.7  Ϊ pppd 趨һȫı(alias)

Ϊ˼ǲ PPP ʹߵ߳ǽһȫı(
/etc/bashrc)һǩֻ֮Ҫһ򵥵ָŷ˵ ppp

⿴

     alias ppp="exec /usr/sbin/pppd -detach"



    exec : ִָָеĳʽ滻ִеĳʽ
     shell

    pppd -detach :  pppd ҲҪѲĳ뱳ִУȷ pppd
     ʱκγ

һʹǩʱ 'w' п

       6:24pm  up 3 days,  7:00,  4 users,  load average: 0.05, 0.03, 0.00
     User     tty	login@	idle   JCPU   PCPU  what
     hartr    ttyC0	3:05am	9:14		    -

... Ҹ߹һܼ򵥵ģ PPP ŷϵͳ!


27.   null modem (ֱ)ʹ PPP

ǳؼ - Ϊûݻøף

ȣѡһΪ'ŷ'ڴв getty
ԱԴ'ͻ'ʹ minicom ȥȡô˴вԲԣ

һɹˣԳȥ gettyʹ/ȷߣ
Ϊ'ʵȨ'Ҽ㲢

ڣŷ˳ȥ getty ȷȷʹ 'setserial'
趨в

Ҫľϵͳ pppd Ҽ̨϶ʹ /dev/ttyS3
ߣ ˣִָ:-

     pppd -detach crtscts lock <local IP>:<remote IP> /dev/ttyS3 38400 &

⽫Ὠ - ĿǰΪֹ㻹δָ· ÿ ping
ָᣮԵĻֹһ pppd Խᣮ

Ҫĵ·ʵϿ㾿ʲ
һ˵һ̫·(估·)ĵȫ PPP
ŷͻһ

ھ̫·Ļϣpppd ָӦ

     pppd -detach crtscts lock proxyarp <local IP>:<remote IP> /dev/ttyS3 38400 &








PPP HOWTO 							     60



һ

     pppd -detach crtscts lock defaultroute <local IP>:<remote IP> /dev/ttyS3 38400 &

·(ʹô!)иӵĵȫļǰķʹ
/etc/ppp/ip-up

Robert Hart

Port Hedland, Western Australia

Melbourne, Victoria, Australia August/October 1996 January/March 1997


















































PPP HOWTO 							     61





































































				   CONTENTS



1.   .................................................................... 2
    1.1  ͻԼŷ ................................................... 2
    1.2  ͬ Linux ׼Ĳ ............................................ 3
    1.3  ׼ص PPP ù ............................................ 3

2.  IP  ................................................................. 4

3.  ļĿ .......................................................... 5
    3.1   PPP ͻ .................................................... 5
    3.2  ʹ PPP  ·һ·· ........... 5
    3.3   PPP ŷ .................................................... 5
    3.4  ʹ PPP ֱ(direct null modem) ......................... 6
    3.5  ļĿǰδǵ... .......................................... 6

4.  ǵ汾 .......................................................... 6

5.  õģҪļ .................................................. 7
    5.1  õ Linux ʵб .......................................... 8

6.   PPP 趨Ϊͻ˵ĹҪ ........................................... 8
    6.1  ȡ/װ ...................................................... 8
    6.2  ļ PPP ֧Ԯ .............................................. 9
    6.3   ISP ȡѶ ................................................ 9
    6.4  趨ݻв ............................................. 9
    6.5  Ƶλַ(DNS) ........................................... 10
    6.6  PPP  root Ȩ .................................................. 10
    6.7   PPP ׼趨 PPP ѡ .............................. 10
    6.8   PPP ŷʹ PAP ֤(Password Authentication Proto
	 col) .............................................................. 10
    6.9  ֶʽ PPP ŷ ....................................... 11
    6.10 ʹ PPP Զ ............................................. 11
    6.11  .......................................................... 11
    6.12  .................................................... 11
    6.13 ֮ ...................................................... 11
    6.14 ̬ IP ṩ׼ IP  ................................ 12

7.   Linux  .................................................... 12
    7.1  װ Linux ԭʼʽ ......................................... 12
    7.2  Ӳ ...................................................... 13
    7.3    Linux 1.2.13  ..................................... 13
    7.4    - Linux 1.3.x  2.0.x  ............................. 13
    7.5  PPP-2.2  /proc/net/dev ע ............................... 14
    7.6  úĵһ㿼 ................................................ 15

8.  ȡ PPP ŷѶ ............................................ 15

9.  趨ݻв ................................................. 16
    9.1  вٶԵע ...................................... 17
    9.2  в ........................................................ 18
    9.3


				       i









	 ݻ .................................................... 18
    9.4  ע .............................................. 19
    9.5  ݻĲ .......................................... 19

10. Ƶλַ(DNS) ................................................ 20
    10.1 /etc/resolv.conf  ............................................. 21
    10.2 /etc/host.conf  ............................................... 22

11. ʹ PPP  root Ȩ .................................................. 22

12. 趨 PPP ӵ ...................................................... 23
    12.1  options.tpl  ........................................... 24
    12.2 Ӧʹʲѡ? ( PAP/CHAP) ................................. 30

13.  PPP ŷʹ PAP ֤(Password Authentication Protocol) ..... 30
    13.1 ʹ MSCHAP ....................................................... 31
    13.2 PAP/CHAP 뵵 ................................................. 31
    13.3 PAP 뵵 ........................................................ 32
    13.4 CHAP 뵵 ....................................................... 32
    13.5  PAP ֤ ............................................. 33

14. ֶʽ PPP  ................................................ 33

15. ʹԶ - ָ ...................................... 36
    15.1 ʹƣָ֤ .................................... 36
    15.2 ppp-on ָ ..................................................... 37
    15.3 ༭ṩʼָ ........................................ 39
    15.4 һ chat ָеĺ... ..................................... 40
    15.5 ʹ PAP/CHAP ߵ chat ָ ............................ 42
    15.6 pppd  debug  file option_file ѡ ............................ 42

16. ָ ..................................................... 42

17.  PPP  .......................................................... 44

18.  ................................................................... 45
    18.1 Ұ PPP ȥ Linux ˵û... ........................... 45
    18.2 ҵݻ˵ PPP δ ................................... 45
    18.3 ϵͳ¼˵ "serial line is not 8 bit clean..." .................... 46
    18.4 Ԥ· .............................................. 47
    18.5  .......................................................... 47

19. ȫ춽ʱȡð ........................................... 47

20. ֮ձ ................................................. 48
    20.1 ޷ߵ PPP ŷ ........................... 48
    20.2 ҿԼ͵ʼܽ .................................... 48
    20.3 ΪʲǲҵĻ finger, WWW, gopher, talk ȵ? .......... 49

21. Զ̬ IP ṩ· ............................................. 49
    21.1 趨ʼ ...................................................... 49
    21.2 趨صŷ .............................................. 50




				       ii









22. ʹ PPP · .................................................. 50
    22.1 趨 IP  ...................................................... 51
    22.2 趨· ...................................................... 51
    22.3 ·ȫ .......................................................... 51

23. ֮ - /etc/ppp/ip-up ָ ................................... 51
    23.1 · ...................................................... 52
    23.2 ʼ .................................................. 52
    23.3 һ /etc/ppp/ip-up ָ .................................. 52
    23.4 ʼ ...................................................... 54

24. ʹ /etc/ppp/ip-down .................................................. 55

25. ·ϵĵ ................................................... 55
    25.1 ȫϵע .................................................. 56

26.  PPP ŷ ........................................................ 56
    26.1  .......................................................... 56
    26.2 ŷϵͳĸŹ .................................................. 57
    26.3 ȫ .................................................... 57
    26.4 趨׼Ĳ(shell access) ...................................... 57
    26.5  PPP ѡ ................................................. 58
    26.6 趨 pppd Աʹߣɹأִ ............................ 58
    26.7 Ϊ pppd 趨һȫı(alias) ................................. 59

27.  null modem (ֱ)ʹ PPP ..................................... 59






























				      iii


