|
谢谢你关注!!!!
1 首先交叉编译pppd源码包,生成拨号所需的程序pppd和chat
2 配置三个拨号脚本ppp-on,ppp-on-dialer,ppp-off
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=*99***1# # The telephone number for the connection
ACCOUNT= # The account name for logon (as in 'George Burns')
PASSWORD= # 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 at 'ppp-on-dialer' time.
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=/pppdial/ppp-on-dialer
#
# Initiate the connection
#
# I put most of the common options on this command. Please, don't
# forget the 'lock' option or some programs such as mgetty will not
# work. The asyncmap and escape will permit the PPP link to work with
# a telnet or rlogin connection. You are welcome to make any changes
# as desired. Don't use the 'defaultroute' option if you currently
# have a default route to an ethernet gateway.
#
exec /pppdial/pppd debug lock modem crtscts /dev/rfcomm0 115200 \
asyncmap 20A0000 escape FF kdebug 7 $LOCAL_IP:$REMOTE_IP \
noipdefault netmask $NETMASK defaultroute connect $DIALER_SCRIPT
ppp-on-dialer
#!/bin/sh
#
# This is part 2 of the ppp-on script. It will perform the connection
# protocol for the desired connection.
#
exec chat -v \
TIMEOUT 5 \
ABORT '\nBUSY\r' \
ABORT '\nNO ANSWER\r' \
ABORT '\nRINGING\r\n\r\nRINGING\r' \
'' \rAT \
'OK-+++\c-OK' ATH0 \
TIMEOUT 30 \
OK AT+IPR=115200 \
OK AT+CGDCONT=1,'IP','CMNET' \
OK ATDT$TELEPHONE \
CONNECT ''
ppp-off
略去
运行pppd-on
/var/log/message中显示如下:
Jan 1 03:30:36 ATR daemon.notice pppd[943]: pppd 2.4.1 started by root, uid 0
Jan 1 03:30:37 ATR daemon.info hcid[710]: link_key_request (sba=00:18:E4:0B:3E:B3, dba=00:17:84:0B:D0:7F)
Jan 1 03:30:39 ATR local2.info chat[947]: timeout set to 5 seconds
Jan 1 03:30:39 ATR local2.info chat[947]: abort on (\nBUSY\r)
Jan 1 03:30:39 ATR local2.info chat[947]: abort on (\nNO ANSWER\r)
Jan 1 03:30:39 ATR local2.info chat[947]: abort on (\nRINGING\r\n\r\nRINGING\r)
Jan 1 03:30:39 ATR local2.info chat[947]: send (rAT^M)
Jan 1 03:30:39 ATR local2.info chat[947]: expect (OK)
Jan 1 03:30:39 ATR local2.info chat[947]: rAT^M^M
Jan 1 03:30:39 ATR local2.info chat[947]: OK
Jan 1 03:30:39 ATR local2.info chat[947]: -- got it
Jan 1 03:30:39 ATR local2.info chat[947]: send (ATH0^M)
Jan 1 03:30:39 ATR local2.info chat[947]: timeout set to 30 seconds
Jan 1 03:30:39 ATR local2.info chat[947]: expect (OK)
Jan 1 03:30:39 ATR local2.info chat[947]: ^M
Jan 1 03:30:39 ATR local2.info chat[947]: ATH0^M^M
Jan 1 03:30:39 ATR local2.info chat[947]: OK
Jan 1 03:30:39 ATR local2.info chat[947]: -- got it
Jan 1 03:30:39 ATR local2.info chat[947]: send (AT+IPR=115200^M)
Jan 1 03:30:39 ATR local2.info chat[947]: expect (OK)
Jan 1 03:30:39 ATR local2.info chat[947]: ^M
Jan 1 03:30:39 ATR local2.info chat[947]: AT+IPR=115200^M^M
Jan 1 03:30:39 ATR local2.info chat[947]: OK
Jan 1 03:30:39 ATR local2.info chat[947]: -- got it
Jan 1 03:30:39 ATR local2.info chat[947]: send (AT+CGDCONT=1,IP,CMNET^M)
Jan 1 03:30:40 ATR local2.info chat[947]: expect (OK)
Jan 1 03:30:40 ATR local2.info chat[947]: ^M
Jan 1 03:30:40 ATR local2.info chat[947]: AT+CGDCONT=1,IP,CMNET^M^M
Jan 1 03:30:40 ATR local2.info chat[947]: OK
Jan 1 03:30:40 ATR local2.info chat[947]: -- got it
Jan 1 03:30:40 ATR local2.info chat[947]: send (ATDT*99***1#^M)
Jan 1 03:30:40 ATR local2.info chat[947]: expect (CONNECT)
Jan 1 03:30:40 ATR local2.info chat[947]: ^M
Jan 1 03:30:40 ATR local2.info chat[947]: ATDT*99***1#^M^M
Jan 1 03:30:40 ATR local2.info chat[947]: CONNECT
Jan 1 03:30:40 ATR local2.info chat[947]: -- got it
Jan 1 03:30:40 ATR local2.info chat[947]: send (^M)
Jan 1 03:30:40 ATR daemon.info pppd[943]: Serial connection established.
Jan 1 03:30:40 ATR daemon.debug pppd[943]: using channel 6
Jan 1 03:30:40 ATR daemon.info pppd[943]: Using interface ppp0
Jan 1 03:30:41 ATR daemon.notice pppd[943]: Connect: ppp0 <--> /dev/rfcomm0
Jan 1 03:30:42 ATR daemon.debug pppd[943]: sent [LCP ConfReq id=0x1 <asyncmap 0x20a0000> <magic 0x332c7724> <pcomp> <accomp>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: rcvd [LCP ConfAck id=0x1 <asyncmap 0x20a0000> <magic 0x332c7724> <pcomp> <accomp>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: rcvd [LCP ConfReq id=0x1 <asyncmap 0x20a0000> <auth pap> <magic 0x473f7de> <pcomp> <accomp>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: sent [LCP ConfRej id=0x1 <auth pap>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: rcvd [LCP ConfReq id=0x2 <asyncmap 0x20a0000> <magic 0x473f891> <pcomp> <accomp>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: sent [LCP ConfAck id=0x2 <asyncmap 0x20a0000> <magic 0x473f891> <pcomp> <accomp>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <compress VJ 0f 01>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: rcvd [LCP ProtRej id=0x1 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
Jan 1 03:30:42 ATR daemon.debug pppd[943]: sent [IPCP ConfReq id=0x2 <addr 0.0.0.0>]
Jan 1 03:30:45 ATR daemon.debug pppd[943]: sent [IPCP ConfReq id=0x2 <addr 0.0.0.0>]
问题就在这里,正常情况下要rcvd一个addr,不知道问题出在哪里了,望哪个高人不吝提点
Jan 1 03:30:47 ATR daemon.info pppd[943]: Hangup (SIGHUP)
Jan 1 03:30:47 ATR daemon.notice pppd[943]: Modem hangup
Jan 1 03:30:47 ATR daemon.notice pppd[943]: Connection terminated.
Jan 1 03:30:48 ATR daemon.info pppd[943]: Exit.
这个问题已经困扰我很长时间了,很郁闷啊,小弟在这里恳求大家了
PS:我是通过蓝牙设备利用蓝牙手机网络拨号上网的
QQ 6056991
|
|