找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
.COM/.NET/.ORG 国际域名注册全功能虚拟主机/免备案虚拟主机
查看: 1482|回复: 2

如何在一台Linux单机上拨ISP上网

[复制链接]

77

主题

701

回帖

1万

积分

论坛元老

积分
16048
发表于 2003-10-7 09:28:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
目的:在家里有一台机器,装有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_IPREMOTE_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即可。
回复

使用道具 举报

281

主题

3228

回帖

55万

积分

管理员

积分
551869
发表于 2003-10-7 12:44:41 | 显示全部楼层
就感觉这样的和dos差不多,郁闷
网路游侠 www.youxia.org
回复 支持 反对

使用道具 举报

77

主题

701

回帖

1万

积分

论坛元老

积分
16048
 楼主| 发表于 2003-10-8 14:07:55 | 显示全部楼层
其实linus和dos就是差不多!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|西京校友网 ( 陕ICP备11003551号-5 )

GMT+8, 2025-5-7 07:10 , Processed in 0.021468 second(s), 8 queries , MemCache On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表