免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6223 | 回复: 3
打印 上一主题 下一主题

linux下用pppd脚本拨号的问题, 这方面的高手请来救火 着急解决 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-05 10:05 |只看该作者 |倒序浏览
我在linux下编译了pppd-2.4.1 想用脚本拨号上网, 但是一到授权阶段就被服务器中断,
想问问 问题出在什么地方,我拨的是C网.

用到的options脚本:
/dev/ttyS0
115200
lock
auth
#require-chap
#modem
crtscts
#asyncmap 20A0000
escape FF
kdebug 0
noipdefault
nodefaultroute
debug
login
#user "wap"
connect "chat -e -v -E -f /etc/ppp/connect"


用到的connect脚本:
TIMEOUT30
ABORT'BUSY'
ABORT'ERROR'
ABORT'NO CARRIER'
ECHOON
''AT
OKATE1
OKATH0
OKATDT#777
CONNECT''

我在chap-secrets 脚本中的设置如下, 大家帮我看看有没有错误:
# INBOUND CONNECTIONS
#clienthostname   <password>192.168.1.1
'card'        *        'card'          *

我对这个脚本这4个选项配置不清楚,请配置过的大虾给我点解释

我运行脚本的情况:
AT
OK
ATE1
OK
ATH0
OK
ATDT#777
CONNECT
Serial connection established.
using channel 22
Using interface ppp0
Connect: ppp0 <--> /dev/ttyS0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <auth chap MD5> <magic 0xe0065788> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <auth chap MD5> <magic 0xd1910924>]
sent [LCP ConfRej id=0x1 <auth chap MD5>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <auth chap MD5> <magic 0xe0065788> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x2 <asyncmap 0x0> <magic 0xd1910924>]
sent [LCP ConfAck id=0x2 <asyncmap 0x0> <magic 0xd1910924>]
sent [LCP EchoReq id=0x0 magic=0xe0065788]
sent [CHAP Challenge id=0x1 <a8455e41ac86dbf31d404a9b69469231fb7e0e73>, name = "linux"]
rcvd [LCP EchoRep id=0x0 magic=0xd1910924]
rcvd [LCP TermReq id=0x3]
LCP terminated by peer
sent [LCP TermAck id=0x3]
Connection terminated.

大家请看 上面显示 LCP terminated by peer
我不知道错在什么地方,请大家 帮帮我呀!!!!

论坛徽章:
0
2 [报告]
发表于 2006-06-05 10:07 |只看该作者
我自己先顶一下吧 大家帮帮忙!

论坛徽章:
0
3 [报告]
发表于 2006-06-08 14:47 |只看该作者
你在哪个公司任职阿
有问题你可以给我发邮件,NUAA@VIP.SINA.COM

[ 本帖最后由 ccjjhua 于 2006-6-8 14:50 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-06-09 14:49 |只看该作者

我也有类世问题

日志:

un  8 08:52:21 turbo7 pppd[1053]: pppd 2.4.0 started by root, uid 0
Jun  8 08:52:22 turbo7 chat[1054]: timeout set to 8 seconds
Jun  8 08:52:22 turbo7 chat[1054]: abort on (\nBUSY\r)
Jun  8 08:52:22 turbo7 chat[1054]: abort on (\nNO ANSWER\r)
Jun  8 08:52:22 turbo7 chat[1054]: abort on (\nRINGING\r\n\r\nRINGING\r)
Jun  8 08:52:22 turbo7 chat[1054]: send (AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0^M)
Jun  8 08:52:22 turbo7 chat[1054]: timeout set to 45 seconds
Jun  8 08:52:22 turbo7 chat[1054]: expect (OK)
Jun  8 08:52:22 turbo7 chat[1054]: AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0^M^M
Jun  8 08:52:22 turbo7 chat[1054]: OK
Jun  8 08:52:22 turbo7 chat[1054]:  -- got it
Jun  8 08:52:22 turbo7 chat[1054]: send (ATDT9,16300^M)
Jun  8 08:52:23 turbo7 chat[1054]: expect (CONNECT)
Jun  8 08:52:23 turbo7 chat[1054]: ^M
Jun  8 08:53:01 turbo7 chat[1054]: ATDT9,16300^M^M
Jun  8 08:53:01 turbo7 chat[1054]: CONNECT
Jun  8 08:53:01 turbo7 chat[1054]:  -- got it
Jun  8 08:53:01 turbo7 chat[1054]: send (^M)
Jun  8 08:53:01 turbo7 chat[1054]: expect (sername
Jun  8 08:53:01 turbo7 chat[1054]:  38400^M
Jun  8 08:53:01 turbo7 chat[1054]: ^M
Jun  8 08:53:02 turbo7 chat[1054]: ^M
Jun  8 08:53:02 turbo7 chat[1054]: *********************************^M
Jun  8 08:53:02 turbo7 chat[1054]: * Quidway A8010 Internet Server *^M
Jun  8 08:53:02 turbo7 chat[1054]: * welcome!!                     *^M
Jun  8 08:53:02 turbo7 chat[1054]: *********************************^M
Jun  8 08:53:02 turbo7 chat[1054]: please input username:
Jun  8 08:53:02 turbo7 chat[1054]:  -- got it
Jun  8 08:53:02 turbo7 chat[1054]: send (16300^M)
Jun  8 08:53:02 turbo7 chat[1054]: expect (assword
Jun  8 08:53:47 turbo7 chat[1054]: alarm
Jun  8 08:53:47 turbo7 chat[1054]: Failed
Jun  8 08:53:47 turbo7 pppd[1053]: Connect script failed
Jun  8 08:53:48 turbo7 pppd[1053]: Exit.



拨号脚本:

下面就是 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=9,16300    # The telephone number for the connection
ACCOUNT=16300           # The account name for logon (as in George Burns)
PASSWORD=16300         # 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 dont ask.)
#
DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
#
# Initiate the connection
#
# I put most of the common options on this command. Please, dont
# 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. Dont use the defaultroute option if you currently
# have a default route to an ethernet gateway.
#
exec /usr/sbin/pppd debug lock modem crtscts /dev/ttyS0 38400 \
asyncmap 20A0000 escape FF kdebug 0 $LOCAL_IPREMOTE_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    3                   \
ABORT      \nBUSY\r         \
ABORT '\nNO ANSWER\r'         \
ABORT '\nRINGING\r\n\r\nRINGING\r'         \
''   \rAT                                 \
OK- \c-OK    ATH0                         \
TIMEOUT      30                         \
OK           ATDT$TELEPHONE                 \
CONNECT      ''                         \
sername:--sername:   $ACCOUNT              \
assword:     $PASSWORD



用minicom可以手工拨上去,但用脚本到发送用户以后就没反应了!
我最终要给程序调用,所以还是要实现脚本拨号。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP