Linux拨号服务快速指南
来源:Linux-cn.com
作者:Webmaster
时间:2007-05-05
点击:
[ 收藏] [ 投稿]
|
然后根据你的ISP作出相应的改动,比如ppp-on和ppp-on-dialer两个可执行文件:
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 scr ipts as the codes
# are visible with the'ps' command. However, it is simple.
#
# These are the parameters. Change as needed.
TELEPHONE=32768 # ISP提供的上网电话号码
ACCOUNT=ynguo #账号名称
PASSWORD=faintyou #登录密码,注意修改本文件权限以便保密
LOCAL_IP=0.0.0.0 #本地IP地址,0.0.0.0表示由ISP动态分配
REMOTE_IP=0.0.0.0 #远端IP地址,一般为0.0.0.0
NETMASK=255.255.255.0 #子网掩码地址
#
# 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 th e 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' a ccount 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.
#
exec/usr/sbin/pppd debug lock modem crtscts/dev/tty S1115200
asyncmap20A0000 escape FF kdebug0$LOCAL_IP:$REMOTE_ IP
noipdefault netmask$NETMASK defaultroute connect$DI ALER_SCRIPT&
|
ppp-on-dialer文件:
#!/bin/sh
#
# This is part2 of the ppp-on script. It will perform the connection
# protocol for the desired connection.
#
exec chat-v
TIMEOUT3
ABORT’
BUSY
’
ABORT’
NO ANSWER
’
ABORT’
RINGING
RINGING
’
’’
AT
’OK-+++c-OK’ ATH0
TIMEOUT30
OK ATDT$TELEPHONE
CONNECT’’
username:--username:$ACCOUNT
password:$PASSWORD
|
需要注意的是,在ppp-on脚本的最后一行用exec启动pppd的参数中,/dev/ttyS1代表modem连结在COM2口上,115200表示modem的速率,可以根据实际情况进行修改;此外,如果ISP提供的拨号提示不是username,而是login的话,需要将ppp-on-dialer中的username改为login (即把username和login去掉第一个字母)。
3.配置域名服务器
编辑/etc/resolv.conf文件,加入ISP提供的域名服务器的IP地址。例如:
search ustc.edu.cn
nameserver 202.38.64.1
|
4.拨号上网
上述准备工作完成之后,以root权限登录,开启Modem,运行ppp-on,该脚本将负责拨号、送出登录信息并完成协议验证,当看到Modem上的数据指示灯停止闪烁并保持连接状态的话,ppp就已经连接成功了。你可以用 netstat -r查看路由表或者pppstats检查ppp的状态,也可以通过Ping你的ISP,或者直接启动Netscape浏览器来检查,如果一切正常的话,那么你的Linux已经连接到Internet了。
如果您对本文有任何疑问或者建议,请到讨论区发表您的意见:
>>
论坛入口 <<
上一篇:理解IDS的主动响应机制
下一篇:ProFtpd快速指南
【文章评论】
【收藏本文】
【推荐好友】
【打印本文】
【我要投稿】 【论坛讨论】
更多相关文章
|