个人工具

“Quick HOWTO : Ch04 : Simple Network Troubleshooting/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
产生以太网错误的可能原因
 
(未显示5个用户的9个中间版本)
第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}}
+
{{Translation}}
= 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:
+
{{From|http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch04_:_Simple_Network_Troubleshooting}}
  
<br>
+
{{Translator|Apshai}}
  
== Sources of Network Slowness ==
+
{{Languages|Quick HOWTO : Ch04 : Simple Network Troubleshooting}}
  
* 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, "[[Quick HOWTO : Ch18 : Configuring DNS|Configuring DNS]]" and Chapter 19, "[[Quick HOWTO : Ch19 : Dynamic DNS|Dynamic 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.
+
* 网络涌堵
 +
* 路由问题
 +
* 线缆问题
 +
* 电阻,电波干扰
 +
* 远端服务器负载过重
 +
* DNs配置不当 (参考第18章 "[[Quick HOWTO : Ch18 : Configuring DNS|配置DNS]]" 和19章, "[[Quick HOWTO : Ch19 : Dynamic DNS|动态DNS]]")
  
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, "[[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.
+
我们会讨论如何隔离这些问题,在以後的章节中会有更详细的讨论。
  
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.
+
其他的一些原因包括:
 +
 
 +
* 线缆坏了。
 +
*服务器连接的交换机或路由器停掉了。
 +
*线缆没有插好。
 +
 
 +
如果你有外网,投资买一个电池驱动的线缆测试仪是非常值得的。市面上一些好的模型可以告诉你线缆坏的大概位置以及用的线缆是否过长。
 +
 
 +
=测试你的网卡 =
 +
在排障的过程中,从命令行监视你网卡的状态是一个很好的习惯。下面的章节将会介绍一些非常有用的命令。
 +
==查看你激活的网卡 ==
 +
ifconfig命令不加任何参数会显示你系统上活动的网卡。那些没有激活的网卡将不会被显示。
 +
 
 +
[root@bigboy tmp]# ifconfig
 +
 
 +
注意:那些被激活但没有连接的网卡也会被显示。我们待会讨论如何查看连接的状态。<br />
 +
 
 +
==查看所有的网卡==
 +
ifconfikg -a 会显示所有的网卡设备,不管他们是否被激活。那些没有被系统管理员激活或没有功用的网卡将不会显示ip地址这一行,同时UP这个词也不会在第二行的输出中显示。下面的例子说明了这个现象:
 +
 
 +
*显示没有激活的网卡
 +
 
 +
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
 +
 
 +
==从命令行来测试连接的状态==
 +
mii-tool和ethtool这两个命令会提供一个连接状态和双工设置的报告。
 +
 
 +
mii-tool不加任何参数会提供一个简短的报告。当加上-v这个参数时,因为它提供了关于网卡是否支持全自动等更详细的信息,这在解决网络速度和双工等排障的过程中非常有用。
 +
 
 +
ethtool命令相对mii-tool命令提供了更详细的信息,尤其是mii-tool可能将来在linux中不再得到支持的情况下,ethtool应该成为你的不二选择。
 +
 
 +
下面的两个例子中,网卡都是100Mbps的传输速度,全双工,连接状态是正常的。
 +
 
 +
===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]#
 +
 
 +
==查看网卡的错误信息==
 +
错误是网络慢的常见标志,这可能是由不合适的网卡配置和带宽的过度利用造成的。只要在可能的情况下这都应该得到纠正。超过0.5%的错误率会导致显着的缓慢。
 +
===Ifconfig的错误输出===
 +
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的错误输出===
 +
ethtool命令当加上-S参数时提供了更详细的信息。<br />
 +
 
 +
[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错误输出==
 +
netstat命令是有非常多用途的命令,当加上-i参数时可以提供一个简短的报告。这在系统缺少mii-tool和ethtool工具时是非常有用的。
 +
<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>
 +
===产生以太网错误的可能原因===
 +
<b>冲突:</b>
 +
预示着以太网卡检测到它和局域网的另一个服务器正在同时尝试传输数据。可以认为冲突是以太正常网操作的的一部分,它所占有的部分不到所有帧0.1%。更高的错误几率是由以太网卡错误或网线错误造成的。
 +
 
 +
<b>单冲突:</b>以太网帧在单次冲突后通过。
 +
<b>多冲突:</b> 由于冲突以太网卡尝试多次才发送成功。
 +
 
 +
<b>CRC错误:</b> 帧被发送出去但是在传世过程中损坏。表现为CRC错误,但很多情况下并不是冲突,通常可能是电子噪音。确保你在使用正确类型的网线,网线没有损坏并且接口插接牢固。
 +
 
 +
<b>帧错误:</b>CRC错误,接收到非整数字节的数据。这常常是由冲突或者以太网设备错误造成的。
 +
</p><p><b>FIFO 和 Overrun错误:</b>由于数据量超过了硬件的存储能力,以太网卡不能把数据存入缓存的次数。这通常表示数据过多。
 +
 
 +
<b>长度错误:</b> 接收到的帧长度比以太网标准长或短。这大多是由于不兼容的互联设定造成的。
 +
</p><p><b>载波错误:</b> 错误通常由以太网卡失去和集线器或交换机的连接造成。检查网线错误或网络设备接口错误。
 +
[[Category:Quick_HOWTO]]

2010年7月18日 (日) 16:03的最新版本


简介

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

网络慢的根源

  • 网卡的双工和速度的不兼容
  • 网络涌堵
  • 路由问题
  • 线缆问题
  • 电阻,电波干扰
  • 远端服务器负载过重
  • DNs配置不当 (参考第18章 "配置DNS" 和19章, "动态DNS")

连接丢失的根源

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

  • 电源问题
  • 远端的服务器或程序被关掉

我们会讨论如何隔离这些问题,在以後的章节中会有更详细的讨论。

做一些基本的连接测试

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

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

其他的一些原因包括:

  • 线缆坏了。
  • 服务器连接的交换机或路由器停掉了。
  • 线缆没有插好。

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

测试你的网卡

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

查看你激活的网卡

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

[root@bigboy tmp]# ifconfig

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

查看所有的网卡

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

  • 显示没有激活的网卡
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

从命令行来测试连接的状态

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

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

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

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

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]#

查看网卡的错误信息

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

Ifconfig的错误输出

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的错误输出

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错误输出

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]#

产生以太网错误的可能原因

冲突: 预示着以太网卡检测到它和局域网的另一个服务器正在同时尝试传输数据。可以认为冲突是以太正常网操作的的一部分,它所占有的部分不到所有帧0.1%。更高的错误几率是由以太网卡错误或网线错误造成的。

单冲突:以太网帧在单次冲突后通过。 多冲突: 由于冲突以太网卡尝试多次才发送成功。

CRC错误: 帧被发送出去但是在传世过程中损坏。表现为CRC错误,但很多情况下并不是冲突,通常可能是电子噪音。确保你在使用正确类型的网线,网线没有损坏并且接口插接牢固。

帧错误:CRC错误,接收到非整数字节的数据。这常常是由冲突或者以太网设备错误造成的。

</p>

FIFO 和 Overrun错误:由于数据量超过了硬件的存储能力,以太网卡不能把数据存入缓存的次数。这通常表示数据过多。 长度错误: 接收到的帧长度比以太网标准长或短。这大多是由于不兼容的互联设定造成的。

载波错误: 错误通常由以太网卡失去和集线器或交换机的连接造成。检查网线错误或网络设备接口错误。