Linux 版 (精华区)

发信人: netiscpu (网中鸟~~离歌), 信区: Linux
标  题: 在一台Linux单机上拨ISP上网
发信站: 紫 丁 香 (Wed Aug 18 10:47:55 1999), 转信


发信人: bstone (飘), 信区: Linux 
标 题: 如何在一台Linux单机上拨ISP上网? 
发信站: BBS 荔园晨风站 (Wed Aug 18 00:40:44 1999), 站内信件 

目的:在家里有一台机器,装有Redhat Linux,希望能在命令行方式下拨ISP上网, 
然后进入KDE浏览。 

软件环境: Redhat Linux 

实现方法: 

1.Redhat已经默认安装了所有的ppp脚本,在/usr/doc/ppp*/scripts目录下, 
假若你刚刚装好一台Redhat Linux,首先拷贝这些脚本到相应的搜索路径下。 
[root@sh3 scripts]# pwd 
/usr/doc/ppp-2.3.7/scripts 
[root@sh3 scripts]# cp ppp-on ppp-off /usr/bin 
[root@sh3 scripts]# cp ppp-on-dialer /etc/ppp 

2.然后设定相应文件的执行权限位。 
[root@sh3 scripts]# chmod +x /usr/bin/ppp-on /usr/bin/ppp-off 
[root@sh3 scripts]# chmod +x /etc/ppp/ppp-on-dialer 

为每次启动PPP时就打入pppon,则 
[root@sh3 scripts]# cp /usr/bin/ppp-on /usr/bin/pppon -a 

3.设定DNS服务器为你的ISP的DNS。 
[root@sh3 /etc]# more resolv.conf 
search sta.net.cn 
nameserver 202.96.199.133 

4.更改/usr/bin/pppon象下面这样(假设你的外置modem接在com1口) 
[root@sh3 /usr/bin/] more pppon 
#!/bin/sh 
TELEPHONE=163 
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 TELEPHONE # ACCOUNT PASSWORD 
DIALER_SCRIPT=/etc/ppp/ppp-on-dialer 
exec /usr/sbin/pppd debug lock modem crtscts /dev/ttyS0 115200 \ 
$LOCAL_IP:$REMOTE_IP \ 
noipdefault netmask $NETMASK defaultroute connect $DIALER_SCRIPT 

5. 更改/etc/ppp/ppp-on-dialer中的chat为全路径/usr/sbin/chat, 
并去掉最后两行及connect行尾的符号'\',象下面这样 
[root@sh3 bin]# cd /etc/ppp 
[root@sh3 ppp]# more ppp-on-dialer 
#!/bin/sh 
exec /usr/sbin/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 '' 

6 . 设定/etc/ppp/options and /etc/ppp/pap-secrets,用PAP方式上网。 
[root@sh3 ppp]# more options 
lock 
asyncmap 0 
name your_isp_account 
[root@sh3 ppp] # more pap-secrets 
your_isp_account * your_isp_passwd 

7.打入pppon,开另一终端输入#tail -f /var/log/messages监视拨号过程, 
你应该看到最终得到了IP 地址,至此,你能进入KDE/GNOME防问Internet. 

注: 
1.其它特别有用的PPP参考文章在: 
http://members.bellatlantic.net/~mrdennis/mgetty.html 
http://www.ssc.com/lg/issue36/ali.html 
http://www.swcp.com/~jgentry/pers.html 
http://www.swcp.com/~jpentry/dialin2.html 
http://howto.linuxberg.com/LinuxGuide/linux-ppp.html 

2.请在测试前在Windows pc上确保modem和串行电缆一切OK,否则在linux拨号 
时可能会提示script 错误。 

3.如果你在监视拨号过程时发现script failure错误,可能是你没输入chat全 
路径/usr/sbin/chat. 

4.如果是网络服务器,为了允许其它普通用户能启动pppon,你可能要设定pppd 
的权限位 

# chmod u+s /usr/sbin/pppd,做为单机用户,不需要,每次就登录做为root, 
启动pppon即可。 

-- 

                              Enjoy Linux!
                          -----It's FREE!-----

※ 来源:.紫 丁 香 bbs.hit.edu.cn.[FROM: dns.mtlab.hit.ed]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.678毫秒