linux技术中坚站 - redhat9_0上配置网卡ip.htm

来自「近日使用liunx 的一些实用资料」· HTM 代码 · 共 142 行

HTM
142
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0087)http://www.chinalinuxpub.com/printthread.php?s=cd6cad26039b79affa2345afe7c4fc14&t=51052 -->
<HTML lang=zh dir=ltr><HEAD><TITLE>Linux技术中坚站 - Redhat9.0上配置网卡IP</TITLE>
<META http-equiv=Content-Type content="text/html; charset=GB2312">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE type=text/css>TD {
	FONT: 12px tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif
}
P {
	FONT: 12px tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif
}
LI {
	FONT: 12px tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif
}
DIV {
	FONT: 12px tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif
}
.smallfont {
	FONT-SIZE: 11px
}
.tborder {
	BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid
}
.thead {
	BACKGROUND-COLOR: #eeeeee
}
.page {
	COLOR: #000000; BACKGROUND-COLOR: #ffffff
}
</STYLE>
</HEAD>
<BODY class=page>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR vAlign=bottom>
    <TD><A href="http://www.chinalinuxpub.com/"><IMG alt=Linux技术中坚站 
      src="Linux技术中坚站 - Redhat9_0上配置网卡IP.files/vbulletin3_logo_white.gif" 
      border=0></A></TD>
    <TD align=right>
      <DIV class=smallfont></DIV></TD></TR></TBODY></TABLE><BR>
<DIV><A accessKey=1 
href="http://www.chinalinuxpub.com/index.php"><STRONG>Linux技术中坚站</STRONG></A> 
(<SPAN class=smallfont><EM>http://www.chinalinuxpub.com/index.php</EM></SPAN>) 
</DIV>
<DIV>- &nbsp; <A 
href="http://www.chinalinuxpub.com/forumdisplay.php?f=69"><STRONG>RedHat/Fedora</STRONG></A> 
(<SPAN 
class=smallfont><EM>http://www.chinalinuxpub.com/forumdisplay.php?f=69</EM></SPAN>) 
</DIV>
<DIV>- &nbsp; - &nbsp; <A accessKey=3 
href="http://www.chinalinuxpub.com/showthread.php?t=51052"><STRONG>Redhat9.0上配置网卡IP</STRONG></A> 
(<SPAN 
class=smallfont><EM>http://www.chinalinuxpub.com/showthread.php?t=51052</EM></SPAN>) 
</DIV><BR>
<TABLE class=tborder cellSpacing=1 cellPadding=6 width="100%" border=0>
  <TBODY>
  <TR>
    <TD class=page>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR vAlign=bottom>
          <TD style="FONT-SIZE: 14pt">ygl23</TD>
          <TD class=smallfont align=right>2006-08-29 10:36</TD></TR></TBODY></TABLE>
      <HR>

      <DIV><STRONG>Redhat9.0上配置网卡IP</STRONG><BR>&nbsp;</DIV>
      <DIV>在我的笔记本上安装了redhat9.0,系统安装完成后,设置网卡IP地址。修改/etc/sysconfig/network-scripts/ifcfg-eth0这个文件,设置相应IP.文件内容如下:<BR>DEVICE=eth0<BR>ONBOOT=yes<BR>BOOTPROTO=static<BR>IPADDR=172.16.103.20<BR>NETMASK=255.255.255.0<BR>GATEWAY=172.16.103.254<BR><BR>可是重起系统后eth0没有启用:<BR>lo 
      Link encap:Local Loopback<BR>inet addr:127.0.0.1 Mask:255.0.0.0<BR>UP 
      LOOPBACK RUNNING MTU:16436 Metric:1<BR>RX packets:1416 errors:0 dropped:0 
      overruns:0 frame:0<BR>TX packets:1416 errors:0 dropped:0 overruns:0 
      carrier:0<BR>collisions:0 txqueuelen:0<BR>RX bytes:70800 (69.1 Kb) TX 
      bytes:70800 (69.1 
      Kb)<BR><BR>我查看了配置文件如上,这个配置肯定没有问题。刚开始,我只好在/etc/rc.local中添加了配置网卡IP的命令:<BR>ifconfig 
      eth0 172.161.03.20 netmask 255.255.255.0 up<BR>sleep 1<BR>route add 
      default gw 
      172.16.103.254<BR>但是感觉总是不爽,没有根本性的解决问题。所以继续寻找解决的方法,嘿,还找到了出现问题的原因:在/etc/sysconfig/networking/devices目录下也存在一个ifcfg-eth0文件,内容如下:<BR>DEVICE=eth0<BR>ONBOOT=no<BR>BOOTPROTO=static<BR>IPADDR=172.16.103.20<BR>NETMASK=255.255.255.0<BR>GATEWAY=172.16.103.254<BR>这个文件中的配置没有雇用eth0,我修改了配置(ONBOOT=yes)后,重起系统就可以自动启用eth0了。<BR>[root@ygl23 
      devices]# ifconfig<BR>eth0 Link encap:Ethernet HWaddr 
      00:02:B3:06:21:92<BR>inet addr:172.16.103.20 Bcast:172.16.103.255 
      Mask:255.255.255.0<BR>UP BROADCAST RUNNING MULTICAST MTU:1500 
      Metric:1<BR>RX packets:4031 errors:0 dropped:0 overruns:0 frame:0<BR>TX 
      packets:3154 errors:0 dropped:0 overruns:0 carrier:0<BR>collisions:0 
      txqueuelen:100<BR>RX bytes:1869938 (1.7 Mb) TX bytes:388457 (379.3 
      Kb)<BR>Interrupt:11 Base address:0x1800 Memory:e8120000-e8120038<BR><BR>lo 
      Link encap:Local Loopback<BR>inet addr:127.0.0.1 Mask:255.0.0.0<BR>UP 
      LOOPBACK RUNNING MTU:16436 Metric:1<BR>RX packets:1582 errors:0 dropped:0 
      overruns:0 frame:0<BR>TX packets:1582 errors:0 dropped:0 overruns:0 
      carrier:0<BR>collisions:0 txqueuelen:0<BR>RX bytes:79100 (77.2 Kb) TX 
      bytes:79100 (77.2 Kb)</DIV></TD></TR></TBODY></TABLE><BR>
<TABLE class=tborder cellSpacing=1 cellPadding=6 width="100%" border=0>
  <TBODY>
  <TR>
    <TD class=page>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR vAlign=bottom>
          <TD style="FONT-SIZE: 14pt">ygl23</TD>
          <TD class=smallfont align=right>2006-08-29 10:43</TD></TR></TBODY></TABLE>
      <HR>

      <DIV>同样还存在/etc/sysconfig/networking/profiles/default这个目录,目录中也有三个文件,具体作用相信大家都知道:<BR>hosts 
      ifcfg-eth0 resolv.conf</DIV></TD></TR></TBODY></TABLE><BR>
<TABLE class=tborder cellSpacing=1 cellPadding=6 width="100%" border=0>
  <TBODY>
  <TR>
    <TD class=page>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR vAlign=bottom>
          <TD style="FONT-SIZE: 14pt">ygl23</TD>
          <TD class=smallfont align=right>2006-08-29 10:45</TD></TR></TBODY></TABLE>
      <HR>

      <DIV>这个配置系统回环设备的配置文件:<BR>/etc/sysconfig/networking/ifcfg-lo 
      <BR>DEVICE=lo<BR>IPADDR=127.0.0.1<BR>NETMASK=255.0.0.0<BR>NETWORK=127.0.0.0<BR># 
      If you're having problems with gated making 127.0.0.0/8 a martian,<BR># 
      you can change this to something else (255.255.255.255, for 
      example)<BR>BROADCAST=127.255.255.255<BR>ONBOOT=yes<BR>NAME=loopback</DIV></TD></TR></TBODY></TABLE><BR>
<TABLE class=tborder cellSpacing=1 cellPadding=6 width="100%" border=0>
  <TBODY>
  <TR>
    <TD class=page>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR vAlign=bottom>
          <TD style="FONT-SIZE: 14pt">ygl23</TD>
          <TD class=smallfont align=right>2006-08-29 10:46</TD></TR></TBODY></TABLE>
      <HR>

      <DIV>这些文件是一个拷贝不是链接</DIV></TD></TR></TBODY></TABLE><BR><BR>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR vAlign=top>
    <TD class=smallfont>所有时间均为<STRONG>格林威治时间+8</STRONG>. 现在的时间是 <SPAN 
      class=time>16:58</SPAN>.</TD>
    <TD align=right>
      <DIV class=smallfont></DIV></TD></TR></TBODY></TABLE>
<P class=smallfont align=center>Powered by: <FONT 
color=#cc0000>Red</FONT>Hat/Apache/PHP/MySQL<BR>Copyright &copy;2000 - 2006, 
Linux技术中坚站.<BR>我们的口号: 自由,开放,平等 <A title="欢迎访问“Linux技术中坚战”, 专业讨论Linux技术的网站" 
href="http://www.chinalinuxpub.com/" target=_blank><B>ChinaLinuxPub<FONT 
color=#cc0000>.COM&#8482;</FONT></A>. <BR></P></B></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?