自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

ppp腳本源碼分享

網絡 網絡管理
下面我們針對ppp的腳本內容進行一下講解。希望大家能夠通過文章內容的分享,了解配置和編寫過程。

PPP撥號設置,在很多平臺上都有相關的操作。那么這里我們則重點講解一下平臺: L350和N300平臺上測試均通過的PPP腳本內容。那么現(xiàn)在就讓我們看下具體內容吧。希望對大家有所應用。

  1. /apps/etc/ppp >: uname -a  
  2. Linux netaccess 2.6.22.1 #17 Thu Jan 7 18:03:30 EST 2010 armv5tejl unknown 

pppd會從/etc/ppp下讀取相關配置文件,由于調試時會經常修改這些配置文件,所以建立了一個符號鏈接到我們的Nandflash分區(qū)上:

  1. /apps/etc/ppp >: ls -l /etc/ppp   
  2. lrwxrwxrwx    1 root     root           13 Nov 20  2009 /etc/ppp -> /apps/etc/ppp 

當使用pppd作ppp server時,主要有以下配置文件。在下面的文檔中,將詳細介紹他們:

  1. /apps/etc/ppp >: ls  
  2. chap-secrets     gprs-start-chat  options          options.ttyS1    pap-secrets 

pppd運行參數(shù)文件/etc/ppp/options

該文件指定pppd運行的參數(shù),若運行pppd時通過命令行指定的參數(shù)同時出現(xiàn)在該配置文件里時,pppd將使用/etc/ppp/options中的配置。關于pppd支持的一些參數(shù),可以在我們PC的linux上使用man命令查詢(man pppd)

[guowenxue@localhost ~]$ man 8 pppd
PPPD(8)                                                                                   PPPD(8)

NAME
pppd - Point-to-Point Protocol Daemon

SYNOPSIS
pppd [ options ]

/apps/etc/ppp >: cat options
#tty Options
/dev/ttyS1                #例如,這里可以將/dev/ttyS1注釋,然后使用命令行#pppd /dev/ttyS1 運行來指定;
115200
#lock
modem
nocrtscts                #無硬件流控

#login
nodetach             #若指定updetach則撥號成功后放入后臺運行,若為nodetach,則在前臺執(zhí)行

debug

#Auth options
auth                     #使能Authentication
+pap                    #使用pap認證
-chap                   #不要支持chap認證

# 源碼ppp-2.4.3/pppd/tty.c中的函數(shù)connect_tty()將會執(zhí)行這個腳本。主要是對客戶端的撥號的應答。
connect "/usr/sbin/chat -v -E -V -f /etc/ppp/gprs-start-chat"

#lcp options
#passive
asyncmap 0
lcp-echo-failure 3
lcp-echo-interval 5
ipcp-accept-local
ipcp-accept-remote


#proxyarp
netmask 255.255.255.0
ms-dns 10.78.28.10
ms-dns 10.78.28.11
nodefaultroute

gprs-start-chat  chat腳本

關于chat的用法,可以在Linux PC上使用man命令查詢:$ man 8 chat

  1. /apps/etc/ppp >: cat gprs-start-chat   
  2.         ABORT           'BUSY'  
  3. ABORT           'NO CARRIER'  
  4. ABORT           'NO DIALTONE'  
  5. ABORT           'ERROR'  
  6. TIMEOUT         0  
  7.  
  8. ''              'ATZ'                      //首先發(fā)送ATZ重置modem  
  9. 'OK'            'ATE0'                 //收到OK后,使用ATE0消除回顯  
  10. 'RING'          'ATA'                  //等待客戶端撥號,若客戶端開始撥號,Modem收到RING后,發(fā)送應答信號ATA  
  11. 'CONNECT'       ''                  //收到CONNECT信號后,將進入下一階段LCP的過程。 

#p#options.ttyS1  IP地址分配

配置PPP服務器端(本地)IP地址和客戶端(遠端)的IP地址

  1. /apps/etc/ppp >: cat options.ttyS1   
  2.  
  3. #Server_IP_address:Client_IP_address  
  4. 10.78.28.194:10.78.28.224  
  5.  
  6. chap和pap認證的帳號文件:  
  7. /apps/etc/ppp >: cat pap-secrets   
  8. # Secrets for authentication using  PAP  
  9.  
  10. #User           Server          Secret          IP Address  
  11. na_admin        *               123                   *  
  12.  
  13. /apps/etc/ppp >: cat chap-secrets   
  14. # Secrets for authentication using CHAP  
  15.  
  16. #User           Server          Secret          IP Address  
  17. na_admin        *               123                   * 


pppd啟動撥號過程:

  1. /apps/etc/ppp >: pppd /dev/ttyS1  
  2.  
  3. OK  
  4. ATE0                //chat腳本的調試輸出  
  5. OK  
  6.  
  7. RING  
  8.  
  9. CONNECTSerial connection established.  
  10. using channel 1  
  11. Using interface ppp0  
  12. Connect: ppp0 <--> /dev/ttyS1  
  13. rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <magic 0x58452c14> <pcomp> <accomp> <callback CBCP>]  
  14. Warning - secret file /etc/ppp/pap-secrets has world and/or group access  
  15. sent [LCP ConfReq id=0x1 <asyncmap 0x0> <auth pap> <magic 0xb701c04a> <pcomp> <accomp>]  
  16. sent [LCP ConfRej id=0x0 <callback CBCP>]  
  17. rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <auth pap> <magic 0xb701c04a> <pcomp> <accomp>]  
  18. rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x58452c14> <pcomp> <accomp>]  
  19. sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x58452c14> <pcomp> <accomp>]  
  20. sent [LCP EchoReq id=0x0 magic=0xb701c04a]  
  21. rcvd [LCP code=0xc id=0x2 58 45 2c 14 4d 53 52 41 53 56 35 2e 31 30]  
  22. sent [LCP CodeRej id=0x2 0c 02 00 12 58 45 2c 14 4d 53 52 41 53 56 35 2e 31 30]  
  23. rcvd [LCP code=0xc id=0x3 58 45 2c 14 4d 53 52 41 53 2d 30 2d 4d 45 49 51 49 4e 50 43 30 31]  
  24. sent [LCP CodeRej id=0x3 0c 03 00 1a 58 45 2c 14 4d 53 52 41 53 2d 30 2d 4d 45 49 51 49 4e 50 43 30 31]  
  25. rcvd [PAP AuthReq id=0xc user="na_admin" password=<hidden>]  
  26. Warning - secret file /etc/ppp/pap-secrets has world and/or group access  
  27. sent [PAP AuthAck id=0xc "Login ok"]  
  28. PAP peer authentication succeeded for na_admin  
  29. sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]  
  30. sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 10.78.28.194>]  
  31. rcvd [LCP EchoRep id=0x0 magic=0x58452c14]  
  32. rcvd [CCP ConfReq id=0x4 < 12 06 00 00 00 01>]  
  33. sent [CCP ConfRej id=0x4 < 12 06 00 00 00 01>]  
  34. rcvd [IPCP ConfReq id=0x5 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-wins 0.0.0.0> <ms- 
  35.  
  36. dns3 0.0.0.0> <ms-wins 0.0.0.0>]  
  37. sent [IPCP ConfRej id=0x5 <ms-wins 0.0.0.0> <ms-wins 0.0.0.0>]  
  38. rcvd [CCP ConfRej id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]  
  39. sent [CCP ConfReq id=0x2]  
  40. rcvd [IPCP ConfAck id=0x1 <compress VJ 0f 01> <addr 10.78.28.194>]  
  41. rcvd [CCP TermReq id=0x6"XE,\024\000<\315t\000\000\002\334"]  
  42. sent [CCP TermAck id=0x6]  
  43. rcvd [IPCP ConfReq id=0x7 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]  
  44. sent [IPCP ConfNak id=0x7 <addr 10.78.28.224> <ms-dns1 10.78.28.10> <ms-dns3 10.78.28.11>]  
  45. rcvd [IPCP ConfReq id=0x8 <compress VJ 0f 01> <addr 10.78.28.224> <ms-dns1 10.78.28.10> <ms-dns3   
  46.  
  47. 10.78.28.11>]  
  48. sent [IPCP ConfAck id=0x8 <compress VJ 0f 01> <addr 10.78.28.224> <ms-dns1 10.78.28.10> <ms-dns3   
  49.  
  50. 10.78.28.11>]  
  51. local  IP address 10.78.28.194  
  52. remote IP address 10.78.28.224 

測試

/apps/etc/ppp >: ping 10.78.28.224
PING 10.78.28.224 (10.78.28.224): 56 data bytes
64 bytes from 10.78.28.224: seq=0 ttl=64 time=194.570 ms
64 bytes from 10.78.28.224: seq=1 ttl=64 time=190.331 ms

 

責任編輯:佟健 來源: 互聯(lián)網
相關推薦

2010-09-03 10:42:02

ppp-on

2010-09-06 14:14:32

ppp-on

2010-09-03 09:50:19

armPPP

2010-09-03 11:33:55

PPPPPP-ON

2010-09-07 15:39:46

2022-05-30 10:31:34

Bash腳本Linux

2010-09-06 10:56:54

2015-09-22 11:07:29

源碼圖片預覽

2014-07-08 09:27:24

SQLSERVER腳本

2019-08-09 13:50:08

shellLinux

2019-08-12 07:45:44

Linux腳本shell

2010-09-09 17:27:43

PPP Multili

2010-09-06 14:32:55

CISCO PPP配置

2010-09-28 13:53:52

2010-09-03 10:04:51

PPP Multili

2010-09-03 11:10:04

ppp authent

2010-09-06 12:37:11

pppLCP

2010-07-08 13:19:34

UDP協(xié)議

2010-01-26 13:55:57

Android分享功能

2010-09-09 17:31:15

ppp authent
點贊
收藏

51CTO技術棧公眾號