Quick HOWTO : Ch04 : Simple Network Troubleshooting/zh:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Doujikai留言 | 贡献
无编辑摘要
Doujikai留言 | 贡献
无编辑摘要
第1行: 第1行:
{{Translation}}{{From|http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch04_:_Simple_Network_Troubleshooting}} {{Translator|Apshai}} {{Languages|Quick HOWTO : Ch04 : Simple Network Troubleshooting}}
<p><span class="fck_mw_template">{{Translation}}</span><span class="fck_mw_template">{{From|http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch04_:_Simple_Network_Troubleshooting}}</span> <span class="fck_mw_template">{{Translator|Apshai}}</span> <span class="fck_mw_template">{{Languages|Quick HOWTO : Ch04 : Simple Network Troubleshooting}}</span>
</p>
<h1> Introduction简介 </h1>
<p>You will eventually find yourself trying to fix a network related problem which usually appears in one of two forms. The first is slow response times from the remote server, and the second is a complete lack of connectivity. These symptoms can be caused by:
</p><p>你最终会发现你试图修正的网络问题经常以两种形式出现。第一种是来自远程服务器的慢速响应,第二种是完全失去连接。这些症状会是由一下原因引起的:<br />
</p>
<h2> Sources of Network Slowness 网络慢的根源<br /> </h2>
<ul><li> NIC duplex and speed incompatibilities&nbsp; 网卡的双工和速度的不兼容<br />
</li><li> Network congestion 网络涌堵<br />
</li><li> Poor routing 路由问题<br />
</li><li> Bad cabling&nbsp; 线缆问题<br />
</li><li> Electrical interference 电阻<br />
</li><li> An overloaded server at the remote end of the connection 远端服务器负载过重<br />
</li><li> Misconfigured DNS (Covered in Chapter 18, "<a href="Quick HOWTO : Ch18 : Configuring DNS">Configuring DNS</a>" and Chapter 19, "<a href="Quick HOWTO : Ch19 : Dynamic DNS">Dynamic DNS</a>")DNs配置问题(参考18章“配置DNS”和19章“动态DNS”)
</li></ul>
<h2> Sources of a Lack of Connectivity 连接丢失的根源<br /> </h2>
<p>All sources of slowness can become so severe that connectivity is lost. Additional sources of disconnections are:
</p><p>所有网络慢的原因严重时都可以导致连接丢失。额外的原因包括:
</p>
<ul><li> Power failures 电源问题<br />
</li><li> The remote server or an application on the remote server being shut down. 远端的服务器或程序被关掉<br />
</li></ul>
<p>We discuss how to isolate these problems and more in the following sections.我们会讨论如何隔离这些问题,在以後的章节中会有更详细的讨论。
</p>
<h2> Doing Basic Cable and Link Tests做一些基本的连接测试 </h2>
<p>Your server won't be able to communicate with any other device on your network unless the NIC's "link" light is on. This indicates that the connection between your server and the switch/router is functioning correctly.
</p><p>你的服务器只有在网卡的连接指示灯亮的时候才可以和其他设备进行通信。这个指示灯表明服务器和交换机或路由器的连接是正常的。<br />
</p><p>In most cases a lack of link is due to the wrong cable type being used. As described in Chapter 2, "<a href="Quick HOWTO : Ch02 : Introduction to Networking">Introduction to Networking</a>", there are two types of Ethernet cables crossover and straight-through. Always make sure you are using the correct type.
</p><p>在大多数情况下,网络不通是因为用了错误的线缆所致。正如我们在第二章描述的,存在两种线:交叉线和直通线。一定要确保你使用了正确的线缆。<br />
</p><p>Other sources of link failure include:其他的一些原因包括:
</p>
<ul><li> The cables are bad.线缆坏了。
</li><li> The switch or router to which the server is connected is powered down.服务器连接的交换机或路由器停掉了。
</li><li> The cables aren't plugged in properly.线缆没有插好。
</li></ul>
<p>If you have an extensive network, investment in a battery-operated cable tester for basic connectivity testing is invaluable. More sophisticated models in the market will be able to tell you the approximate location of a cable break and whether an Ethernet cable is too long to be used.
</p><p>如果你有外网,投资买一个电池驱动的线缆测试仪是非常值得的。市面上一些好的模型可以告诉你线缆坏的大概位置以及用的线缆是否过长。
</p>
<h1> Testing Your NIC测试你的网卡 </h1>
<p>It is always a good practice in troubleshooting to be versed in monitoring the status of your NIC card from the command line. The following sections introduce a few commands that will be useful.
</p><p>在排障的过程中,从命令行监视你网卡的状态是一个很好的习惯。下面的章节将会介绍一些非常有用的命令。<br />
</p>
<h2> Viewing Your Activated Interfaces查看你激活的网卡。 </h2>
<p>The ifconfig command without any arguments gives you all the active interfaces on your system. Interfaces will not appear if they are shut down:
</p><p>ifconfig命令不加任何参数会显示你系统上活动的网卡。那些没有激活的网卡将不会被显示。<br />
</p>
<pre class="_fck_mw_lspace">[root@bigboy tmp]# ifconfig
</pre>
<p><b>Note:</b> Interfaces will appear if they are activated, but have no link. We'll soon discuss how to determine the link status using commands.
</p><p>注意:那些被激活但没有连接的网卡也会被显示。我们待会讨论如何查看连接的状态。<br />
</p>
<h2> Viewing All Interfaces 查看所有的网卡。<br /> </h2>
<p>The ifconfig -a command provides all the network interfaces, whether they are functional or not. Interfaces that are shut down by the systems administrator or are nonfunctional will not show an IP address line and the word UP will not show in the second line of the output. This can be seen in the next examples:
</p><p>ifconfikg -a 会显示所有的网卡设备,不管他们是否被激活。那些没有被系统管理员激活或没有功用的网卡将不会显示ip地址这一行,同时UP这个词也不会在第二行的输出中显示。下面的例子说明了这个现象:
</p>
<ul><li> Shut Down Interface显示没有激活的网卡
</li></ul>
<pre class="_fck_mw_lspace">wlan0 Link encap:Ethernet HWaddr 00:06:25:09:6A:D7
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
TX packets:2287 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:180948 (176.7 Kb) TX bytes:166377 (162.4 Kb)
Interrupt:10 Memory:c88b5000-c88b6000
</pre>
<p><br />
</p>
<ul><li> Active Interface 激活的网卡<br />
</li></ul>
<pre class="_fck_mw_lspace">wlan0 Link encap:Ethernet HWaddr 00:06:25:09:6A:D7
inet addr:216.10.119.243 Bcast:216.10.119.255
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
TX packets:2295 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:180948 (176.7 Kb) TX bytes:166521 (162.6 Kb)
Interrupt:10 Memory:c88b5000-c88b6000
</pre>
<p><br />
</p>
<h2> Testing Link Status from the Command Line从命令行来测试连接的状态 </h2>
<p>Both the mii-tool and ethtool commands command will provide reports on the link status and duplex settings for supported NICs.
</p><p>When used without any switches, the mii-tool gives a very brief report. Use it with the -v switch because it provides more information on the supported autonegotiation speeds of the NIC and this can be useful in troubleshooting speed and duplex issues.
</p><p>The ethtool command provides much more information than mii-tool and should be your command of choice, especially because mii-tool will be soon deprecated in Linux. In both of the following examples the NICs are operating at 100Mbps, full duplex and the link is ok.
</p><p>mii-tool和ethtool这两个命令会提供一个连接状态和双工设置的报告。
</p><p>mii-tool不加任何参数会提供一个简短的报告。当加上-v这个参数时,因为它提供了关于网卡是否支持全自动等更详细的信息,这在解决网络速度和双工等排障的过程中非常有用。
</p><p>ethtool命令相对mii-tool命令提供了更详细的信息,尤其是mii-tool可能将来在linux中不再得到支持的情况下,ethtool应该成为你的不二选择。
</p><p>下面的两个例子中,网卡都是100Mbps的传输速度,全双工,连接状态是正常的。<br />
</p>
<h3> Link Status Output from mii-tool mii-tool的连接状态输出<br /> </h3>
<pre class="_fck_mw_lspace">[root@bigboy tmp]# mii-tool -v


= Introduction简介 =
eth0: 100 Mbit, full duplex, link ok
product info: Intel 82555 rev 4
basic mode: 100 Mbit, full duplex
basic status: link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
link partner: 100baseTx-HD


You will eventually find yourself trying to fix a network related problem which usually appears in one of two forms. The first is slow response times from the remote server, and the second is a complete lack of connectivity. These symptoms can be caused by:
[root@bigboy tmp]#
</pre>
<h3> Link Status Output from ethtool ethtool的连接状态输出<br /> </h3>
<pre class="_fck_mw_lspace">[root@bigboy tmp]# ethtool eth0


你最终会发现你试图修正的网络问题经常以两种形式出现。第一种是来自远程服务器的慢速响应,第二种是完全失去连接。这些症状会是由一下原因引起的:<br>
Settings for eth0:
 
Supported ports: [ TP MII ]
== Sources of Network Slowness 网络慢的根源<br> ==
Supported link modes: 10baseT/Half 10baseT/Full
 
100baseT/Half 100baseT/Full
* NIC duplex and speed incompatibilities&nbsp; 网卡的双工和速度的不兼容<br>
Supports auto-negotiation: Yes
* Network congestion 网络涌堵<br>
Advertised link modes: 10baseT/Half 10baseT/Full
* Poor routing 路由问题<br>
100baseT/Half 100baseT/Full
* Bad cabling&nbsp; 线缆问题<br>
Advertised auto-negotiation: No
* Electrical interference 电阻<br>
Speed: 100Mb/s
* An overloaded server at the remote end of the connection 远端服务器负载过重<br>
Duplex: Full
* Misconfigured DNS (Covered in Chapter 18, "[[Quick HOWTO : Ch18 : Configuring DNS|Configuring DNS]]" and Chapter 19, "[[Quick HOWTO : Ch19 : Dynamic DNS|Dynamic DNS]]")DNs配置问题(参考18章“配置DNS”和19章“动态DNS”)
Port: MII
 
PHYAD: 1
== Sources of a Lack of Connectivity 连接丢失的根源<br> ==
Transceiver: internal
 
Auto-negotiation: off
All sources of slowness can become so severe that connectivity is lost. Additional sources of disconnections are:
Supports Wake-on: g
 
Wake-on: g
所有网络慢的原因严重时都可以导致连接丢失。额外的原因包括:
Current message level: 0x00000007 (7)
 
Link detected: yes
* Power failures 电源问题<br>
[root@bigboy tmp]#
* The remote server or an application on the remote server being shut down. 远端的服务器或程序被关掉<br>
</pre>
 
<p><br />
We discuss how to isolate these problems and more in the following sections.我们会讨论如何隔离这些问题,在以后的章节中会有更详细的讨论。
</p>
 
<h2> Viewing NIC Errors 查看网卡的错误信息<br /> </h2>
== Doing Basic Cable and Link Tests做一些基本的连接测试 ==
<p>Errors are a common symptom of slow connectivity due to poor configuration or excessive bandwidth utilization. They should always be corrected whenever possible. Error rates in excess of 0.5% can result in noticeable sluggishness.
 
</p><p>错误是网络慢的常见标志,这可能是由不合适的网卡配置和带宽的过度利用造成的。只要在可能的情况下这都应该得到纠正。超过0.5%的错误率会导致显着的缓慢。<br />
Your server won't be able to communicate with any other device on your network unless the NIC's "link" light is on. This indicates that the connection between your server and the switch/router is functioning correctly.
</p>
 
<h3> Ifconfig Error Output Ifconfig的错误输出<br /> </h3>
你的服务器只有在网卡的连接指示灯亮的时候才可以和其他设备进行通信。这个指示灯表明服务器和交换机或路由器的连接是正常的。<br>
<p>The ifconfig command also shows the number of overrun, carrier, dropped packet and frame errors.
 
</p><p>ifconfig命令显示了overrun,carrier,dropped packjet和frame errors的数量<br />
In most cases a lack of link is due to the wrong cable type being used. As described in Chapter 2, "[[Quick HOWTO : Ch02 : Introduction to Networking|Introduction to Networking]]", there are two types of Ethernet cables crossover and straight-through. Always make sure you are using the correct type.
</p>
 
<pre class="_fck_mw_lspace">wlan0 Link encap:Ethernet HWaddr 00:06:25:09:6A:D7
在大多数情况下,网络不通是因为用了错误的线缆所致。正如我们在第二章描述的,存在两种线:交叉线和直通线。一定要确保你使用了正确的线缆。<br>
BROADCAST MULTICAST MTU:1500 Metric:1
 
RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
Other sources of link failure include:其他的一些原因包括:
TX packets:2287 errors:0 dropped:0 overruns:0 carrier:0
 
collisions:0 txqueuelen:100
* The cables are bad.线缆坏了。
RX bytes:180948 (176.7 Kb) TX bytes:166377 (162.4 Kb)
* The switch or router to which the server is connected is powered down.服务器连接的交换机或路由器停掉了。
Interrupt:10 Memory:c88b5000-c88b6000
* The cables aren't plugged in properly.线缆没有插好。
</pre>
 
<h3> ethtool Error Output ethtool的错误输出<br /> </h3>
If you have an extensive network, investment in a battery-operated cable tester for basic connectivity testing is invaluable. More sophisticated models in the market will be able to tell you the approximate location of a cable break and whether an Ethernet cable is too long to be used.
<p>The ethtool command can provide a much more detailed report when used with the -S switch.
 
</p><p>ethtool命令当加上-S参数时提供了更详细的信息。<br />
如果你有外网,投资买一个电池驱动的线缆测试仪是非常值得的。市面上一些好的模型可以告诉你线缆坏的大概位置以及用的线缆是否过长。
</p>
<pre class="_fck_mw_lspace">[root@probe-001 root]# ethtool -S eth0
NIC statistics:
rx_packets: 1669993
tx_packets: 627631
rx_bytes: 361714034
tx_bytes: 88228145
rx_errors: 0
tx_errors: 0
rx_dropped: 0
tx_dropped: 0
multicast: 0
collisions: 0
rx_length_errors: 0
rx_over_errors: 0
rx_crc_errors: 0
rx_frame_errors: 0
rx_fifo_errors: 0
rx_missed_errors: 0
tx_aborted_errors: 0
tx_carrier_errors: 0
tx_fifo_errors: 0
tx_heartbeat_errors: 0
tx_window_errors: 0
tx_deferred: 0
tx_single_collisions: 0
tx_multi_collisions: 0
tx_flow_control_pause: 0
rx_flow_control_pause: 0
rx_flow_control_unsupported: 0
tx_tco_packets: 0
rx_tco_packets: 0
[root@probe-001 root]#
</pre>
<h2> netstat Error Output </h2>
<p>The netstat command is very versatile and can provide a limited report when used with the -i switch. This is useful for systems where mii-tool or ethtool are not available.
</p><p>netstat命令是有非常多用途的命令,当加上-i参数时可以提供一个简短的报告。这在系统缺少mii-tool和ethtool工具时是非常有用的。<br />
</p>
<pre class="_fck_mw_lspace">[root@bigboy tmp]# netstat -i
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 18976655 2 0 0 21343152 142 0 3 BMRU
eth1 1500 0 855154 0 0 0 15196620 0 0 0 BMRU
lo 16436 0 1784272 0 0 0 1784272 0 0 0 LRU
[root@bigboy tmp]#
</pre>
<h3> Possible Causes of Ethernet Errors </h3>
<p><b>Collisions:</b> Signifies when the NIC card detects itself and another server on the LAN attempting data transmissions at the same time. Collisions can be expected as a normal part of Ethernet operation and are typically below 0.1% of all frames sent. Higher error rates are likely to be caused by faulty NIC cards or poorly terminated cables.
</p><p><b>Single Collisions:</b> The Ethernet frame went through after only one collision
</p><p><b>Multiple Collisions:</b> The NIC had to attempt multiple times before successfully sending the frame due to collisions.
</p><p><b>CRC Errors:</b> Frames were sent but were corrupted in transit. The presence of CRC errors, but not many collisions usually is an indication of electrical noise. Make sure that you are using the correct type of cable, that the cabling is undamaged and that the connectors are securely fastened.
</p><p><b>Frame Errors:</b> An incorrect CRC and a non-integer number of bytes are received. This is usually the result of collisions or a bad Ethernet device.
</p><p><b>FIFO and Overrun Errors:</b> The number of times that the NIC was unable of handing data to its memory buffers because the data rate the capabilities of the hardware. This is usually a sign of excessive traffic.
</p><p><b>Length Errors:</b> The received frame length was less than or exceeded the Ethernet standard. This is most frequently due to incompatible duplex settings.
</p><p><b>Carrier Errors:</b> Errors are caused by the NIC card losing its link connection to the hub or switch. Check for faulty cabling or faulty interfaces on the NIC and networking equipment.
</p>

2008年1月31日 (四) 18:54的版本

{{#ifexist: :Quick HOWTO : Ch04 : Simple Network Troubleshooting/zh/zh | | {{#ifexist: Quick HOWTO : Ch04 : Simple Network Troubleshooting/zh/zh | | {{#ifeq: {{#titleparts:Quick HOWTO : Ch04 : Simple Network Troubleshooting/zh|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Quick HOWTO : Ch04 : Simple Network Troubleshooting/zh|1|-1|}} | zh | | }}

Introduction简介

You will eventually find yourself trying to fix a network related problem which usually appears in one of two forms. The first is slow response times from the remote server, and the second is a complete lack of connectivity. These symptoms can be caused by:

你最终会发现你试图修正的网络问题经常以两种形式出现。第一种是来自远程服务器的慢速响应,第二种是完全失去连接。这些症状会是由一下原因引起的:

Sources of Network Slowness 网络慢的根源

  • NIC duplex and speed incompatibilities  网卡的双工和速度的不兼容
  • Network congestion 网络涌堵
  • Poor routing 路由问题
  • Bad cabling  线缆问题
  • Electrical interference 电阻
  • An overloaded server at the remote end of the connection 远端服务器负载过重
  • Misconfigured DNS (Covered in Chapter 18, "<a href="Quick HOWTO : Ch18 : Configuring DNS">Configuring DNS</a>" and Chapter 19, "<a href="Quick HOWTO : Ch19 : Dynamic DNS">Dynamic DNS</a>")DNs配置问题(参考18章“配置DNS”和19章“动态DNS”)

Sources of a Lack of Connectivity 连接丢失的根源

All sources of slowness can become so severe that connectivity is lost. Additional sources of disconnections are:

所有网络慢的原因严重时都可以导致连接丢失。额外的原因包括:

  • Power failures 电源问题
  • The remote server or an application on the remote server being shut down. 远端的服务器或程序被关掉

We discuss how to isolate these problems and more in the following sections.我们会讨论如何隔离这些问题,在以後的章节中会有更详细的讨论。

Doing Basic Cable and Link Tests做一些基本的连接测试

Your server won't be able to communicate with any other device on your network unless the NIC's "link" light is on. This indicates that the connection between your server and the switch/router is functioning correctly.

你的服务器只有在网卡的连接指示灯亮的时候才可以和其他设备进行通信。这个指示灯表明服务器和交换机或路由器的连接是正常的。

In most cases a lack of link is due to the wrong cable type being used. As described in Chapter 2, "<a href="Quick HOWTO : Ch02 : Introduction to Networking">Introduction to Networking</a>", there are two types of Ethernet cables crossover and straight-through. Always make sure you are using the correct type.

在大多数情况下,网络不通是因为用了错误的线缆所致。正如我们在第二章描述的,存在两种线:交叉线和直通线。一定要确保你使用了正确的线缆。

Other sources of link failure include:其他的一些原因包括:

  • The cables are bad.线缆坏了。
  • The switch or router to which the server is connected is powered down.服务器连接的交换机或路由器停掉了。
  • The cables aren't plugged in properly.线缆没有插好。

If you have an extensive network, investment in a battery-operated cable tester for basic connectivity testing is invaluable. More sophisticated models in the market will be able to tell you the approximate location of a cable break and whether an Ethernet cable is too long to be used.

如果你有外网,投资买一个电池驱动的线缆测试仪是非常值得的。市面上一些好的模型可以告诉你线缆坏的大概位置以及用的线缆是否过长。

Testing Your NIC测试你的网卡

It is always a good practice in troubleshooting to be versed in monitoring the status of your NIC card from the command line. The following sections introduce a few commands that will be useful.

在排障的过程中,从命令行监视你网卡的状态是一个很好的习惯。下面的章节将会介绍一些非常有用的命令。

Viewing Your Activated Interfaces查看你激活的网卡。

The ifconfig command without any arguments gives you all the active interfaces on your system. Interfaces will not appear if they are shut down:

ifconfig命令不加任何参数会显示你系统上活动的网卡。那些没有激活的网卡将不会被显示。

[root@bigboy tmp]# ifconfig

Note: Interfaces will appear if they are activated, but have no link. We'll soon discuss how to determine the link status using commands.

注意:那些被激活但没有连接的网卡也会被显示。我们待会讨论如何查看连接的状态。

Viewing All Interfaces 查看所有的网卡。

The ifconfig -a command provides all the network interfaces, whether they are functional or not. Interfaces that are shut down by the systems administrator or are nonfunctional will not show an IP address line and the word UP will not show in the second line of the output. This can be seen in the next examples:

ifconfikg -a 会显示所有的网卡设备,不管他们是否被激活。那些没有被系统管理员激活或没有功用的网卡将不会显示ip地址这一行,同时UP这个词也不会在第二行的输出中显示。下面的例子说明了这个现象:

  • Shut Down Interface显示没有激活的网卡
wlan0 Link encap:Ethernet HWaddr 00:06:25:09:6A:D7
 BROADCAST MULTICAST MTU:1500 Metric:1
 RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
 TX packets:2287 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:100
 RX bytes:180948 (176.7 Kb) TX bytes:166377 (162.4 Kb)
 Interrupt:10 Memory:c88b5000-c88b6000


  • Active Interface 激活的网卡
wlan0 Link encap:Ethernet HWaddr 00:06:25:09:6A:D7
 inet addr:216.10.119.243 Bcast:216.10.119.255
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
 TX packets:2295 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:100
 RX bytes:180948 (176.7 Kb) TX bytes:166521 (162.6 Kb)
 Interrupt:10 Memory:c88b5000-c88b6000


Testing Link Status from the Command Line从命令行来测试连接的状态

Both the mii-tool and ethtool commands command will provide reports on the link status and duplex settings for supported NICs.

When used without any switches, the mii-tool gives a very brief report. Use it with the -v switch because it provides more information on the supported autonegotiation speeds of the NIC and this can be useful in troubleshooting speed and duplex issues.

The ethtool command provides much more information than mii-tool and should be your command of choice, especially because mii-tool will be soon deprecated in Linux. In both of the following examples the NICs are operating at 100Mbps, full duplex and the link is ok.

mii-tool和ethtool这两个命令会提供一个连接状态和双工设置的报告。

mii-tool不加任何参数会提供一个简短的报告。当加上-v这个参数时,因为它提供了关于网卡是否支持全自动等更详细的信息,这在解决网络速度和双工等排障的过程中非常有用。

ethtool命令相对mii-tool命令提供了更详细的信息,尤其是mii-tool可能将来在linux中不再得到支持的情况下,ethtool应该成为你的不二选择。

下面的两个例子中,网卡都是100Mbps的传输速度,全双工,连接状态是正常的。

Link Status Output from mii-tool mii-tool的连接状态输出

[root@bigboy tmp]# mii-tool -v

eth0: 100 Mbit, full duplex, link ok
 product info: Intel 82555 rev 4
 basic mode: 100 Mbit, full duplex
 basic status: link ok
 capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
 advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
 link partner: 100baseTx-HD

[root@bigboy tmp]#

Link Status Output from ethtool ethtool的连接状态输出

[root@bigboy tmp]# ethtool eth0

Settings for eth0:
 Supported ports: [ TP MII ]
 Supported link modes: 10baseT/Half 10baseT/Full
 100baseT/Half 100baseT/Full
 Supports auto-negotiation: Yes
 Advertised link modes: 10baseT/Half 10baseT/Full
 100baseT/Half 100baseT/Full
 Advertised auto-negotiation: No
 Speed: 100Mb/s
 Duplex: Full
 Port: MII
 PHYAD: 1
 Transceiver: internal
 Auto-negotiation: off
 Supports Wake-on: g
 Wake-on: g
 Current message level: 0x00000007 (7)
 Link detected: yes
[root@bigboy tmp]#


Viewing NIC Errors 查看网卡的错误信息

Errors are a common symptom of slow connectivity due to poor configuration or excessive bandwidth utilization. They should always be corrected whenever possible. Error rates in excess of 0.5% can result in noticeable sluggishness.

错误是网络慢的常见标志,这可能是由不合适的网卡配置和带宽的过度利用造成的。只要在可能的情况下这都应该得到纠正。超过0.5%的错误率会导致显着的缓慢。

Ifconfig Error Output Ifconfig的错误输出

The ifconfig command also shows the number of overrun, carrier, dropped packet and frame errors.

ifconfig命令显示了overrun,carrier,dropped packjet和frame errors的数量

wlan0 Link encap:Ethernet HWaddr 00:06:25:09:6A:D7
 BROADCAST MULTICAST MTU:1500 Metric:1
 RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
 TX packets:2287 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:100
 RX bytes:180948 (176.7 Kb) TX bytes:166377 (162.4 Kb)
 Interrupt:10 Memory:c88b5000-c88b6000

ethtool Error Output ethtool的错误输出

The ethtool command can provide a much more detailed report when used with the -S switch.

ethtool命令当加上-S参数时提供了更详细的信息。

[root@probe-001 root]# ethtool -S eth0
NIC statistics:
 rx_packets: 1669993
 tx_packets: 627631
 rx_bytes: 361714034
 tx_bytes: 88228145
 rx_errors: 0
 tx_errors: 0
 rx_dropped: 0
 tx_dropped: 0
 multicast: 0
 collisions: 0
 rx_length_errors: 0
 rx_over_errors: 0
 rx_crc_errors: 0
 rx_frame_errors: 0
 rx_fifo_errors: 0
 rx_missed_errors: 0
 tx_aborted_errors: 0
 tx_carrier_errors: 0
 tx_fifo_errors: 0
 tx_heartbeat_errors: 0
 tx_window_errors: 0
 tx_deferred: 0
 tx_single_collisions: 0
 tx_multi_collisions: 0
 tx_flow_control_pause: 0
 rx_flow_control_pause: 0
 rx_flow_control_unsupported: 0
 tx_tco_packets: 0
 rx_tco_packets: 0
[root@probe-001 root]#

netstat Error Output

The netstat command is very versatile and can provide a limited report when used with the -i switch. This is useful for systems where mii-tool or ethtool are not available.

netstat命令是有非常多用途的命令,当加上-i参数时可以提供一个简短的报告。这在系统缺少mii-tool和ethtool工具时是非常有用的。

[root@bigboy tmp]# netstat -i
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 18976655 2 0 0 21343152 142 0 3 BMRU
eth1 1500 0 855154 0 0 0 15196620 0 0 0 BMRU
lo 16436 0 1784272 0 0 0 1784272 0 0 0 LRU
[root@bigboy tmp]#

Possible Causes of Ethernet Errors

Collisions: Signifies when the NIC card detects itself and another server on the LAN attempting data transmissions at the same time. Collisions can be expected as a normal part of Ethernet operation and are typically below 0.1% of all frames sent. Higher error rates are likely to be caused by faulty NIC cards or poorly terminated cables.

Single Collisions: The Ethernet frame went through after only one collision

Multiple Collisions: The NIC had to attempt multiple times before successfully sending the frame due to collisions.

CRC Errors: Frames were sent but were corrupted in transit. The presence of CRC errors, but not many collisions usually is an indication of electrical noise. Make sure that you are using the correct type of cable, that the cabling is undamaged and that the connectors are securely fastened.

Frame Errors: An incorrect CRC and a non-integer number of bytes are received. This is usually the result of collisions or a bad Ethernet device.

FIFO and Overrun Errors: The number of times that the NIC was unable of handing data to its memory buffers because the data rate the capabilities of the hardware. This is usually a sign of excessive traffic.

Length Errors: The received frame length was less than or exceeded the Ethernet standard. This is most frequently due to incompatible duplex settings.

Carrier Errors: Errors are caused by the NIC card losing its link connection to the hub or switch. Check for faulty cabling or faulty interfaces on the NIC and networking equipment.