作家
登录
    用户名:  密码:   

arm上实现PPP拨号脚本

作者: 来源: 2012-06-13 05:08:40 阅读6043次 我要评论

在之前的《Linux内核PPP套件设置》一文中,我们已经讲解了相关的一些PPP套件设置操作。那么这里,我们依据前文的一些内容,再来详细讲解一下arm上成功实现ppp拨号脚本的过程。

arm上成功实现ppp拨号脚本

ppp-on:

  1. #!/bin/sh  
  2. pppd modem -d -detach lock /dev/ttySAC0 19200 kdebug 4 file /etc/ppp/options crtscts noipdefault netmask 255.255.255.0 defaultroute connect /etc/ppp/chat-script 

ppp-off:

  1. #!/bin/sh  
  2. ######################################################################  
  3. #  
  4. # Determine the device to be terminated.  
  5. #  
  6. if [ "$1" = "" ]; then  
  7. DEVICE=ppp0 
  8. else  
  9. DEVICE=$1  
  10. fi  
  11.  
  12. ######################################################################  
  13. #  
  14. # If the ppp0 pid file is present then the program is running. Stop it.  
  15. if [ -r /var/run/$DEVICE.pid ]; then  
  16.         kill -INT `cat /var/run/$DEVICE.pid`  
  17. #  
  18. # If the kill did not work then there is no process running for this  
  19. # pid. It may also mean that the lock file will be left. You may wish  
  20. # to delete the lock file at the same time.  
  21.         if [ ! "$?" = "0" ]; then  
  22.                 rm -f /var/run/$DEVICE.pid  
  23.                 echo "ERROR: Removed stale pid file"  
  24.                 exit 1  
  25.         fi  
  26. #  
  27. # Success. Let pppd clean up its own junk.  
  28.         echo "PPP link to $DEVICE terminated."  
  29.         exit 0  
  30. fi  
  31. #  
  32. # The ppp process is not running for ppp0  
  33. echo "ERROR: PPP link is not active on $DEVICE"  
  34. exit 1 

chat-script:

  1. #!/bin/sh  
  2. exec chat -v   
  3. TIMEOUT 5   
  4. ABORT   "BUSY"   
  5. ABORT   "ERROR"   
  6. ABORT   "NO CARRIER"   
  7. '' rAT     
  8. OK 'AT+CGDCONT=1,"IP","CMNET"'   
  9. OK 'ATDT*99***1#'   
  10. CONNECT ''  

设置DNS的resove.conf:

  1. nameserver 211.136.20.203  
  2. nameserver 211.136.17.107 

到此,arm ppp拨号脚本就设置好了。那么希望本文的代码展示,能够让大家对此有所了解。


  推荐阅读

  从基础了解PPP协议

想要掌握一个协议,我们就需要从它基础来了解。那么这里我们就具体解析一下PPP协议的内容。首先让我们看一下PPP协议概述,目前大多数模拟拨号连接都采用PPP做为数据链路协议,主要有下面特点:错误检测自动协商网络层>>>详细阅读


本文标题:arm上实现PPP拨号脚本

地址:http://www.17bianji.com/xieyi/4203.html

12

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

6043

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)