📄 63.html
字号:
<TR>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=296
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=76
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=100
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=98
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=79
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=103
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=26
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR>
<TR>
<TD colSpan=3><A title=linux知识宝库
href="index.html" tppabs="http://www.linuxhero.com/docs/index.html"><IMG height=83
src="images/header_r1_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c1.gif" width=472 border=0
name=header_r1_c1></A></TD>
<TD colSpan=3>
<form action="http://www.linuxhero.com/docs/search.html" method=get>
<table
style="BORDER-RIGHT: #c4c4c4 1px solid; BORDER-TOP: #c4c4c4 1px solid; BORDER-LEFT: #c4c4c4 1px solid; BORDER-BOTTOM: #c4c4c4 1px solid"
cellspacing=0 cellpadding=3 width="95%" border=0 align="center">
<tbody>
<tr>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif">
<div align=center><font class=normalfont>搜索文章:
<input type=hidden value=result name=action2>
<input type=radio checked value=title name=type>标题
<input type=radio value=content name=type>内容
<input type=image src="images/button_go.gif" tppabs="http://www.linuxhero.com/docs/images/button_go.gif" border=0 name=image2>
</font></div>
</td>
</tr>
<tr>
<td noWrap>
<div align="center">
<input maxlength=100 size=30 name=keyword2>
</div>
</td>
</tr></tbody>
</table>
</form>
</TD>
<TD rowSpan=2><IMG src="images/header_r1_c7.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c7.gif" width=26 border=0 name=header_r1_c7></TD>
<TD><IMG height=83 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1 border=0></TD></TR>
<TR>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif"><IMG height=22
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="type2.html" tppabs="http://www.linuxhero.com/docs/type2.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下配置TCP/IP</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>这是IBM公司的教学课程,送初级Linux学生!!呵呵~~<br>
<br>
关键文件和脚本<br>
<br>
网络接口初始化的实际过程(有时也称做“启动接口”)是由一组配置文件和脚本控制的,这些文件和脚本大多数在/etc 目录下。这些配置文件告诉 Linux 它的 IP 地址、主机名和域名;脚本则负责网络接口的初始化。<br>
遗憾的是,不同分发版(distribution)中文件位置和命名约定至今还没有统一的标准。为给本文提供具体的示例,将基于广泛使用的 Red Hat 7.0 包做出描述。请记住,若您的分发版不是使用 Red Hat 或不是基于 Red Hat 约定(如 Mandrake 分发版),在此所引用的一些文件会位于别的目录中或有其它的名称。然而,网络效果和实际效果是一样的 — 将存储在一系列配置文件中的网络信息传递给脚本,然后用脚本初始化接口和网络路由。<br>
涉及初始化和配置网络接口的关键文件有:<br>
/etc/hosts (将主机名映射到 IP 地址)<br>
/etc/networks (将域名映射到网络地址)<br>
/etc/sysconfig/network (打开或关闭联网,设置主机名和网关)<br>
/etc/resolv.conf (设置名称服务器或 DNS 服务器的 IP 地址)<br>
/etc/rc.d/rc3.d/S10network (在引导时激活已配置的以太网接口,由运行级别目录 /etc/rc.d/rcN.d/ 中的符号链接调用)<br>
/etc/sysconfig/network-scripts 中一些文件的集合。这些文件包括用于网络连接的主要配置,以及提供接口状态和控制功能的符号链接。<br>
<br>
/etc/hosts<br>
<br>
/etc/hosts 是将 IP 地址和主机名联系起来的简单文本文件。 TCP/IP 网络中的每台计算机都必须有唯一的 IP 地址。hosts 文件只允许用户将主机名与 IP 地址联系起来,以便当访问计算机时使用该名称,而不用输入一长串数字。/etc/hosts 中的每一项都依次包含一个 IP 地址、空白和主机名和/或别名。井号(#)表示注释开始。例如:<br>
# /etc/hosts<br>
# last updated 12/3/2000<br>
<br>
127.0.0.1 loopback localhost # loopback (lo0) name/address<br>
<br>
192.168.1.5 janus.syroidmanor.com janus<br>
192.168.1.6 thumper.syroidmanor.com thumper<br>
192.168.1.7 donovan.syroidmanor.com donovan<br>
192.168.1.8 raidserver<br>
<br>
192.168.1.20 phoenix.syroidmanor.com phoenix<br>
192.168.1.15 hydras.syroidmanor.com hydras<br>
在上面显示的 Hosts 文件中,IP 地址 192.168.1.5 映射到主机 janus.syroidmanor.com ,并且分配给它一个备用主机名(或别名)janus。尽管 DNS 已经取代了这个主机文件,但出于以下原因仍然使用它:<br>
大多数系统都有一个包含本地网络上的关键主机的名称和地址信息的小主机表。当 DNS 未运行时,例如,在最初系统启动期间,则使用该表。即便本地 DNS 服务器正在运行,在每个系统上也应该有一个小 hosts 文件,该文件包含一个主机本身项、一个 localhost 项以及局域网上任何主要的网关和服务器项。<br>
未连接到因特网或其他网络的小网络不需要 DNS 服务。然而,这些网络上的主机也需要知道如何定位同一网络上的其它主机。<br>
<br>
/etc/networks<br>
<br>
就如主机有名称和地址一样,为方便起见,也可以为网络和子网命名。 /etc/networks 文件在布局上与 /etc/hosts 很相似,只不过名称和地址互换了一下。<br>
# /etc/networks for syroidmanor.com<br>
<br>
localnet 127.0.0.0 #loopback<br>
syroid-C1 192.168.1 #development, class C<br>
syroid-C2 192.168.2 #support, class C<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -