• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : ppp拨号请教 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 2571
精华: 0
发帖: 15
金钱: 145 两
威望: 42 点
综合积分: 30 分
注册时间: 2008-11-25
最后登录: 2012-12-05
楼主  发表于: 2008-11-27 14:26

 ppp拨号请教

ppp套件拨号上网在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        3                \
    ABORT        '\nBUSY\r'            \
    ABORT        '\nNO ANSWER\r'            \
    ABORT        '\nRINGING\r\n\r\nRINGING\r'    \
    ''        \rAT                \
    'OK-+++\c-OK'    ATH0                \
    TIMEOUT        30                \
    OK        AT+CIPMODE=1            \
    OK        AT+CGDCONT=1,"IP","CMNET","",0,0    \
    OK        ATD$TELEPHONE            \
    CONNECT        ''                \
    #ogin:--ogin:    $ACCOUNT            \
    #assword:    $PASSWORD

这两条指令就是发不出去,不太懂,特来请教
                      OK        AT+CIPMODE=1            \
    OK        AT+CGDCONT=1,"IP","CMNET","",0,0    \
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2008-11-27 15:09
'OK-+++\c-OK'    ATH0 

是ATH0还是ATH?

AT+CIPMODE=1

你的Modem支持这个命令?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 2571
精华: 0
发帖: 15
金钱: 145 两
威望: 42 点
综合积分: 30 分
注册时间: 2008-11-25
最后登录: 2012-12-05
2楼  发表于: 2008-11-28 08:20
ATH0,
modem支持的,
现在不是modem的问题,我直接串口输出看数据,
\rAT +++可以看到

AT+CIPMODE=1           
AT+CGDCONT=1,"IP","CMNET","",0,0   
这两条是出不来的
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2008-11-28 09:29
不明白你在说什么,贴点东西出来看看吧
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 2571
精华: 0
发帖: 15
金钱: 145 两
威望: 42 点
综合积分: 30 分
注册时间: 2008-11-25
最后登录: 2012-12-05
4楼  发表于: 2008-11-28 10:32
引用第3楼kasim于2008-11-28 09:29发表的  :
不明白你在说什么,贴点东西出来看看吧

我现在是实现gprs上网功能,猫和主机通过串口连接,现在利用ppp套件进行拨号,其中有2条指令要发给猫(就上面两条),但是在脚本里面就是发不出去。脚本上面已经贴过了
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
5楼  发表于: 2008-11-28 10:52
我知道你是在拨号上网,脚本又不会告诉你哪个命令发了哪个没发,贴点能说明问题的东西,明白了吗?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 2571
精华: 0
发帖: 15
金钱: 145 两
威望: 42 点
综合积分: 30 分
注册时间: 2008-11-25
最后登录: 2012-12-05
6楼  发表于: 2008-11-28 11:14
#!/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=/etc/ppp/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.
#
#ifconfig eth0 down

echo "start pppd..."
exec /usr/sbin/pppd debug lock nocrtscts modem  /dev/ttyS0 115200 \
    asyncmap 20A0000 escape FF kdebug 0 $LOCAL_IP:$REMOTE_IP \
    noipdefault netmask $NETMASK defaultroute connect $DIALER_SCRIPT

我全贴了好了,我就是执行ppp-on脚本,如上,然后他调用了ppp-on-dialer(这个顶楼贴过了)
进行拨号上网,其中少这两条指令不能成功。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
7楼  发表于: 2008-11-28 11:51
脚本通常是不会告诉你出错在什么地方的,把你认为出错的东西贴出来
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 2571
精华: 0
发帖: 15
金钱: 145 两
威望: 42 点
综合积分: 30 分
注册时间: 2008-11-25
最后登录: 2012-12-05
8楼  发表于: 2008-11-28 13:40
Nov 28 13:25:50 ch pppd[8614]: pppd 2.4.4 started by root, uid 0
Nov 28 13:25:51 ch chat[8616]: timeout set to 30 seconds
Nov 28 13:25:51 ch chat[8616]: abort on (\nBUSY\r)
Nov 28 13:25:51 ch chat[8616]: abort on (\nNO ANSWER\r)
Nov 28 13:25:51 ch chat[8616]: abort on (\nRINGING\r\n\r\nRINGING\r)
Nov 28 13:25:51 ch chat[8616]: send (rAT^M)
Nov 28 13:25:51 ch chat[8616]: expect (OK)
Nov 28 13:25:51 ch chat[8616]: rAT^M^M
Nov 28 13:25:51 ch chat[8616]: OK
Nov 28 13:25:51 ch chat[8616]:  -- got it
Nov 28 13:25:51 ch chat[8616]: send (ATH0^M)
Nov 28 13:25:52 ch chat[8616]: timeout set to 30 seconds
Nov 28 13:25:52 ch chat[8616]: expect (OK)
Nov 28 13:25:52 ch chat[8616]: ^M
Nov 28 13:25:52 ch chat[8616]: ATH0^M^M
Nov 28 13:25:52 ch chat[8616]: OK
Nov 28 13:25:52 ch chat[8616]:  -- got it
Nov 28 13:25:52 ch chat[8616]: send (AT+CIPMKDE=1^M)
Nov 28 13:25:52 ch chat[8616]: expect (OK)
Nov 28 13:25:52 ch chat[8616]: ^M
Nov 28 13:25:52 ch chat[8616]: AT+CIPMKDE=1^M^M
Nov 28 13:25:52 ch chat[8616]: ERROR^M
Nov 28 13:26:22 ch chat[8616]: alarm
Nov 28 13:26:22 ch chat[8616]: Failed
Nov 28 13:26:23 ch pppd[8614]: Exit.

这个是用tail -f /var/log/messages的信息,你看看,
我的感觉是AT+CIPMKDE=1这条好像现在成功了,
AT+CGDCONT=1,“IP”,“CMNET”,“”,0,0
没发出去
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
9楼  发表于: 2008-11-28 13:48
在你啥都不懂的时候分析问题的方法:

找一个OK的例子
Nov 28 13:25:51 ch chat[8616]: send (ATH0^M)
Nov 28 13:25:52 ch chat[8616]: timeout set to 30 seconds
Nov 28 13:25:52 ch chat[8616]: expect (OK)
Nov 28 13:25:52 ch chat[8616]: ^M
Nov 28 13:25:52 ch chat[8616]: ATH0^M^M
Nov 28 13:25:52 ch chat[8616]: OK
Nov 28 13:25:52 ch chat[8616]:  -- got it


对比你觉得有问题的部分
Nov 28 13:25:52 ch chat[8616]: send (AT+CIPMKDE=1^M)
Nov 28 13:25:52 ch chat[8616]: expect (OK)
Nov 28 13:25:52 ch chat[8616]: ^M
Nov 28 13:25:52 ch chat[8616]: AT+CIPMKDE=1^M^M
Nov 28 13:25:52 ch chat[8616]: ERROR^M


这样总该知道问题所在了吧
另外,小心不要写错别字
OK        AT+CIPMODE=1

==>
AT+CIPMKDE=1
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go