- 论坛徽章:
- 0
|
脚本是用网上找到的,貌似连接对了,但是不知道还是有什么地方错了。
Serial connection established.
using channel 8
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ProtRej id=0x2 21 01 01 00 0e 02 06 00 00 00 00 07 02 08 02]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x3 <mru 1514> <asyncmap 0x0> <auth pap> <magic 0x0> <pcomp> <accomp>]
sent [LCP ConfRej id=0x3 <magic 0x0>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <pcomp> <accomp>]
(之后就一直是重复这两行内容)
这个是option
- #------------------------------------------------#
- # File:
- # /etc/ppp/gprs
- #
- # Description:
- # This file holds the serial cable and IrDA pppd options for GPRS phones
- # Tell the ppp-daemon to accept mangled data
- receive-all
- # Give some debug info
- debug
- kdebug 7
- # Print out all the option values which have been set.
- dump
- # Serial device to which terminal is connected;
- # with serial port (COM1 in Windows) use /dev/ttyS0
- # and with IrDA use /dev/ircomm0.
- #/dev/ircomm0 # IrDA
- /dev/ttyUSB0 # serial cable (NOTE: 这个地方你要改为真正的你用的串口,比如/dev/ttyS0)
- # Serial port line speed
- 115200
- # Turn off waiting of carrier detect or flow control signal
- # With IrDA it should be disabled with nocrtscts option.
- -crtscts # serial cable
- #nocrtscts # IrDA
- # Ignore carrier detect signal from the modem
- local
- # To keep pppd on the terminal
- nodetach
- # Accept the peer's idea of our local IP address
- ipcp-accept-local
- # Accept the peer's idea of its (remote) IP address
- ipcp-accept-remote
- # IP addresses:
- # - accept peers idea of our local address and set address peer as 10.0.0.1
- # (any address would do, since IPCP gives 0.0.0.0 to it)
- # - if you use the 10. network at home or something and pppd rejects it,
- # change the address to something else
- 0.0.0.0:0.0.0.0
- -chap
- #-pap
- # pppd must not propose any IP address to the peer!
- noipdefault
- # No ppp compression
- novj
- novjccomp
- nobsdcomp
- #nopcomp
- #noaccomp
- #papcrypt
- #nodeflate
- noauth
- #No ppp magic number
- nomagic
- # no asyn cmap
- asyncmap 0
- # Add default route
- defaultroute
- # Connect script
- connect /etc/ppp/peers/chap-gprs-connect
- # Disconnect script
- disconnect /etc/ppp/peers/chap-gprs-disconnect
- user "cmnet"
复制代码
这个是连接脚本
- #------------------------------------------------#
- #!/bin/sh
- #
- # File:
- # /etc/ppp/chat-gprs-connect
- #
- # Description:
- # chat script to open Sonera GPRS service with GPRS phones. If ppp
- # negotiation stalls, try restarting the phone. To try with other GPRS
- # operator setting, change the PDP contex setting. The settings work with
- # all Ericsson models, but Nokia 8310 does not suppor QoS parameters with
- # AT commands, so just delete those lines and it'll work.
- #
- # Set PDP context CID=1, protocol=IP, APN=internet:
- # AT+CGDCONT=1,"IP","internet","",0,0
- #
- # Set CID=1 QoS requirements from the network, not supported by 8310:
- # AT+CGQREQ=1,0,0,0,0,0
- #
- # Set CID=1 minimum acceptable QoS parameters, not supported by 8310:
- # AT+CGQMIN=1,0,0,0,0,0
- #
- # 'Call' CID=1 (activate PDP context one, perform GPRS attach):
- # ATD*99***1#
- #
- # ogin:-BREAK-ogin: \
- # TIMEOUT 5 \
- # assword: \
- # SAY "\nLogged in OK...\n" \
- # The actual chat script:
- exec chat \
- TIMEOUT 5 \
- ECHO ON \
- ABORT '\nBUSY\r' \
- ABORT '\nERROR\r' \
- ABORT '\nNO ANSWER\r' \
- ABORT '\nNO CARRIER\r' \
- ABORT '\nNO DIALTONE\r' \
- ABORT '\nRINGING\r\n\r\nRINGING\r' \
- '' AT \
- TIMEOUT 12 \
- SAY "Press CTRL-C to close the connection at any stage!" \
- SAY "\ndefining PDP context...\n" \
- OK AT+CGATT=1 \
- OK 'AT+CGDCONT=1,"IP","cmnet","",0,0' \
- TIMEOUT 120 \
- OK 'AT+CGDATA="PPP",1' \
- SAY "\nwaiting up to 2 mintues for connect...\n"\
- CONNECT ''\
- SAY "\nConnected. now logging in...\n" \
- SAY "\nIf the following ppp negotiations fail,\n" \
- SAY "try restarting the phone.\n"
- # NOTE: PDP context可能会因你的猫不同而有所区别,查它的手册来写吧
复制代码
'AT+CGDATA="PPP",1'
改成
'ATD*99#'
or
'ATD*99#***1#'
也是一样的效果。
[ 本帖最后由 blworld 于 2007-10-29 19:48 编辑 ] |
|