📄 808.html
字号:
src="images/header_r2_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r2_c1.gif" width=296 border=0
name=header_r2_c1></TD>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colSpan=5>
<DIV align=right><FONT class=normalfont>当前位置:
<A href="index.html" tppabs="http://www.linuxhero.com/docs/index.html">本站首页</A>
<font color="#FF6699">>></font>
<A href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</A> | <A href="copyright.html" tppabs="http://www.linuxhero.com/docs/copyright.html">版权说明</A></font></DIV>
</TD>
<TD><IMG height=22 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=10 cellPadding=0 width="100%" bgColor=#ffffff
border=0>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TR>
<TD vAlign=top align=middle width="60%">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>linux下如何拨号上网</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:作者<br>来自:Linux知识宝库<br>联系方式:无名<br><br>s linux在去年可谓春风得意,现在风头依然很劲,人们逐渐发现在Windows之外还有更好的选择,Linux被寄予了厚望,希望有一天它将能够取代Windows,它的创始人Linus Torvalds也成为因特网时代的英雄。作为天天面对Windows的电脑爱好者来说,对Windows是既爱又恨,因而怎能错过Linux呢?更何况它是免费的午餐。<br>
linux是因特网时代的神话,在Linux系统中各种Internet的软件、工具应有尽有也就不足为奇了。但是对大多数用户来说,通过Modem拨号上网是联结Internet的唯一途径,在此笔者以Redhat 5.1为例,详细介绍一种拨号上网的方法,希望Linux的新手能够尽快通过Linux去畅游Internet,体会Linux强大的网络功能,获取更多Linux的知识。<br>
先假设你的计算机已经安装好了Redhat 5.1或者以上版本的linux,并且Modem已经连接在计算机上。<br>
<br>
第一步:准备Modem<br>
需要确定Modem在计算机的哪个串口上。最简单的办法是启动Windows 95,在控制面板中察看Modem的属性;在linux下有一种简单的办法是:先确认Modem已经连接在计算机上,打开Modem电源,MR、HS灯应该是亮的,然后在提示符下输入以下命令:<br>
echo AT >/dev/ttyS0<br>
如果Modem的TR灯亮了,表明Modem连结在COM1口,否则,再试 /dev/ttyS1、/dev/ttyS2、/dev/ttyS3。<br>
<br>
第二步:准备核心<br>
版本2.0.34的linux核心已经内置了PPP功能,在此需要确认一下Linux的版本,如果是Redhat5.1就可以跳过这一步,因为Redhat5.1的内核版本即是2.0.34。否则就可能需要重新编译Linux内核以便支持PPP。<br>
<br>
第三步:准备拨号脚本<br>
在RedHat5.1中,已经在/usr/doc/ppp-2.3.3/scripts目录下为我们提供了拨号脚本程序的样本,需要我们做的是将其拷贝到正确的目录并将其改为可执行文件,具体操作如下:<br>
cp /usr/doc/ ppp-2.3.3/scripts/ppp-on /usr/sbin<br>
cp /usr/doc/ ppp-2.3.3/scripts/ppp-off /usr/sbin<br>
cp /usr/doc/ ppp-2.3.3/scripts/ppp-on-dialer /etc/ppp<br>
cd /usr/sbin<br>
chmod +x ppp-on<br>
chmod +x ppp-off<br>
cd /etc/ppp<br>
chmod +x ppp-on-dialer<br>
然后根据你的ISP做相应的少许改动。以下是笔者所用的两个脚本ppp-on和ppp-on-dialer的内容:<br>
ppp-on的内容:<br>
#!/bin/sh<br>
#<br>
# Script to initiate a ppp connection. This is the first part of the<br>
# pair of scripts. This is not a secure pair of scripts as the codes<br>
# are visible with the 'ps' command. However, it is simple.<br>
#<br>
# These are the parameters. Change as needed.<br>
TELEPHONE=96340 # ISP提供的上网电话号码<br>
ACCOUNT=yuangq # 账号名称<br>
PASSWORD=654321 # 登录密码,注意修改本文件权限以便保密<br>
LOCAL_IP=0.0.0.0 #本地IP地址,0.0.0.0表示由ISP动态分配<br>
REMOTE_IP=0.0.0.0 #远端IP地址,一般为0.0.0.0<br>
NETMASK=255.255.255.0 # 子网掩码地址<br>
#<br>
# Export them so that they will be available at 'ppp-on-dialer' time.<br>
export TELEPHONE ACCOUNT PASSWORD<br>
#<br>
# This is the location of the script which dials the phone and logs<br>
# in. Please use the absolute file name as the $PATH variable is not<br>
# used on the connect option. (To do so on a 'root' account would be<br>
# a security hole so don't ask.)<br>
#<br>
DIALER_SCRIPT=/etc/ppp/ppp-on-dialer<br>
#<br>
# Initiate the connection<br>
#<br>
# I put most of the common options on this command. Please, don't<br>
# forget the 'lock' option or some programs such as mgetty will not<br>
# work. The asyncmap and escape will permit the PPP link to work with<br>
# a telnet or rlogin connection. You are welcome to make any changes<br>
# as desired. Don't use the 'defaultroute' option if you currently<br>
# have a default route to an ethernet gateway.<br>
#<br>
exec /usr/sbin/pppd debug lock modem crtscts /dev/ttyS1 115200 <br>
asyncmap 20A0000 escape FF kdebug 0 $LOCAL_IP:$REMOTE_IP <br>
noipdefault netmask $NETMASK defaultroute connect $DIALER_SCRIPT &<br>
<br>
ppp-on-dialer的内容:<br>
#!/bin/sh<br>
#<br>
# This is part 2 of the ppp-on script. It will perform the connection<br>
# protocol for the desired connection.<br>
#<br>
exec chat -v <br>
TIMEOUT 3 <br>
ABORT 'BUSY
' <br>
ABORT 'NO ANSWER
' <br>
ABORT 'RINGING
RINGING
' <br>
''
AT <br>
'OK-+++c-OK' ATH0 <br>
TIMEOUT 30 <br>
OK ATDT$TELEPHONE <br>
CONNECT '' <br>
sername:--sername: $ACCOUNT <br>
assword: $PASSWORD <br>
<br>
需要注意的是,在ppp-on脚本的最后一行用exec启动pppd的参数中,/dev/ttyS1代表Modem连结在COM2口上,115200表示Modem的速率,可以根据实际情况进行修改;此外,如果ISP提供的拨号提示不是username,而是login的话,需要将ppp-on-dialer中的sername改为ogin(即把username和login去掉第一个字母)。<br>
<br>
第四步:配置DNS<br>
为了能够使用WWW浏览器、ftp、Telnet,还必须配置DNS,可以使用netconf命令进行配置,也可以直接修改/etc/resolv.conf文件,例如笔者的该文件内容如下:<br>
search szonline.net<br>
nameserver 202.96.154.15<br>
其中第一行表示域名搜索后缀,第二行为ISP提供的DNS服务器的IP地址。<br>
<br>
第五步:开始拨号上网<br>
上述准备工作完成之后,以root权限登录,开启Modem,运行ppp-on,该脚本将负责拨号、送出登录信息并完成协议验证,当看到Modem上的数据指示灯停止闪烁并保持连接状态的话,ppp就已经连接成功了。你可以用netstat -r查看路由表或者pppstats检查ppp的状态,也可以通过Ping你的ISP,或者直接启动Netscape浏览器来检查,如果一切正常的话,那么你的linux已经连接到Internet了。<br>
<br>
(我执行ppp-on之后,拨号应该是成功的,从modem的正常拨号音和之后的显示等可以看出,但是去还不能上网,ifconifg显示没有ppp0界面,过了不到一分钟时间就自动短线了,怎么回事呢?谢谢各位高手指点)<br>
<br>
<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -