下面我们针对arm上实现PPP拨号脚本的内容,进行一下具体的介绍。针对它具体实现的代码进行了分析,希望对大家能够有所帮助。

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

arm上实现PPP拨号脚本(armbian pppoe拨号)  arm PPP 第1张

arm上成功实现ppp拨号脚本

ppp-on:

  1. #!/bin/sh
  2. pppdmodem-d-detachlock/dev/ttySAC019200kdebug4file/etc/ppp/optionscrtsctsnoipdefaultnetmask255.255.255.0defaultrouteconnect/etc/ppp/chat-script

ppp-off:

  1. #!/bin/sh
  2. ######################################################################
  3. #
  4. #Determinethedevicetobeterminated.
  5. #
  6. if["$1"=""];then
  7. DEVICE=ppp0
  8. else
  9. DEVICE=$1
  10. fi
  11. ######################################################################
  12. #
  13. #Iftheppp0pidfileispresentthentheprogramisrunning.Stopit.
  14. if[-r/var/run/$DEVICE.pid];then
  15. kill-INT`cat/var/run/$DEVICE.pid`
  16. #
  17. #Ifthekilldidnotworkthenthereisnoprocessrunningforthis
  18. #pid.Itmayalsomeanthatthelockfilewillbeleft.Youmaywish
  19. #todeletethelockfileatthesametime.
  20. if[!"$?"="0"];then
  21. rm-f/var/run/$DEVICE.pid
  22. echo"ERROR:Removedstalepidfile"
  23. exit1
  24. fi
  25. #
  26. #Success.Letpppdcleanupitsownjunk.
  27. echo"PPPlinkto$DEVICEterminated."
  28. exit0
  29. fi
  30. #
  31. #Thepppprocessisnotrunningforppp0
  32. echo"ERROR:PPPlinkisnotactiveon$DEVICE"
  33. exit1

chat-script:

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

设置DNS的resove.conf:

  1. nameserver211.136.20.203
  2. nameserver211.136.17.107

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

转载请说明出处
知优网 » arm上实现PPP拨号脚本(armbian pppoe拨号)

发表评论

您需要后才能发表评论