BBS水木清华站∶精华区
发信人: jllin.bbs@cis.nctu.edu.tw (肥猫喵喵), 看板: Linux
标 题: Re: 请教用Linux ppp连接seednet的问题
发信站: 交大资科_BBS (Sat Nov 30 04:02:16 1996)
转信站: sob!netnews.ntu!linux2.tpml!UUserv.Net.tw!news.cis.nctu!cisnews.cis.nc
==> 在 hugh@tpts1.seed.net.tw (Hugh Wu) 的文章中提到:
> 29 Nov 1996 13:46:42 GMT Jack Yang says...
> > 若有 pap 需要如何设定,
> +pap。
^^^^
这个指令会要求对方通过你的 PAP Auth.
当然结果是对方送来的Package中 username 及 password 都是空的
这是当做 Server 用的
> > 我曾经看过,忘了... 可否各知....
> 可能还需要一个 +ua <档名>。
pppd-2.2.0f 有 ppp-on ppp-off redialer ppp-on-dialer 等现成的 script
稍加修改即可使用
至於 PAP .... 提供我用的命令稿(也是修改自pppd-2.2.0f现成的命令稿)
ppp-on : 执行档
===========================
#!/bin/sh
DEVICE=/dev/cua0 <--- port
LOCAL_IP=0.0.0.0 \___ 视需要而定
REMOTE_IP=0.0.0.0 /
NETMASK=255.255.255.0 <--- netmask
MTU=296 <--- mtu or mru
DIALER_SCRIPT=$HOME/bin/redialer <--- chat 命令稿
OPTION_FILE=$HOME/.ppp-option <--- 自己的 pppd 预设档
PAP_SECRET_FILE=$HOME/.pap-secrets <--- PAP 验证用的 ID 及 password
exec /usr/sbin/pppd \
connect $DIALER_SCRIPT \
$DEVICE 57600 \
debug lock \
file $OPTION_FILE \
netmask $NETMASK \
crtscts modem defaultroute mru $MTU mtu $MTU \
$LOCAL_IP:$REMOTE_IP \
remotename "" \
noipdefault +ua $PAP_SECRET_FILE
============================
redialer : 顾名思义, 可以自动重拨 (执行档)
============================
#!/bin/sh
###################################################################
#
# These parameters control the attack dialing sequence.
#
# Maximum number of attempts to reach the telephone number(s)
MAX_ATTEMPTS=20
# Delay between each of the attempts. This is a parameter to sleep
# so use "15s" for 15 seconds, "1m" for 1 minute, etc.
SLEEP_DELAY=5s
###################################################################
#
# This is a list of telephone numbers. Add new numbers if you wish
# and see the function 'callall' below for the dial process.
PHONE1=123-4567
#PHONE2=411
###################################################################
#
# If you use the ppp-on script, then these are passed to this routine
# automatically. There is no need to define them here. If not, then
# you will need to set the values.
#
#ACCOUNT=my_account_name
#PASSWORD=my_password
###################################################################
#
# Function to initialize the modem and ensure that it is in command
# state. This may not be needed, but it doesn't hurt.
#
function initialize
{
chat -v TIMEOUT 3 '' AT 'OK-+++\c-OK'
return
}
###################################################################
#
# Script to dial a telephone
#
function callnumber
{
chat -v \
ABORT '\nBUSY\r' \
ABORT '\nNO ANSWER\r' \
ABORT '\nRINGING\r\n\r\nRINGING\r' \
'' ATDT$1 \
CONNECT ''
#
# If the connection was successful then end the whole script with a
# success.
#
if [ "$?" = "0" ]; then
exit 0
fi
return
}
###################################################################
#
# Script to dial any telephone number
#
function callall
{
# echo "dialing attempt number: $1" >/dev/console
callnumber $PHONE1
# callnumber $PHONE2
}
###################################################################
#
# Initialize the modem to ensure that it is in the command state
#
initialize
if [ ! "$?" = "0" ]; then
exit 1
fi
#
# Dial telephone numbers until one answers
#
attempt=0
while : ; do
attempt=`expr $attempt + 1`
callall $attempt
if [ "$attempt" = "$MAX_ATTEMPTS" ]; then
exit 1
fi
sleep "$SLEEP_DELAY"
done
===========================================
$HOME/.pap-secrets : 只有两行
==========================================
ID
PASSWORD
=========================================
$HOME/.ppp-option : 不是很重要, 反正在命令稿中都重新设定了
=========================================
asyncmap 00000000
netmask 255.255.255.0
-proxyarp
lock
crtscts
modem
=========================================
--
* Origin: ★ 交通大学资讯科学系 BBS ★ <bbs.cis.nctu.edu.tw: 140.113.23.3>
BBS水木清华站∶精华区