通俗地说线缆检测可以检测交换机接口到终端之间的网线情况。不管是思科还是华为、华三,在线缆检测时都使用了时域反射time domain reflectometer (TDR)技术。 通过时域反射TDR (Time Domain Reflectometry)检测电缆状态的原理如下: 交换机发送一个脉冲信号,脉冲信号在电缆中传输,如果遇到电缆末端或其它故障点,部分能量会被反射回来,这种现象称为时域反射。线缆检测技术就是测量脉冲在电缆中传输、达到故障点及返回的时间,把测量到的时间转换成距离。 华为和华三称之为虚电缆检测VCT(Virtual Cable Test)技术。
一、下面先以思科为例说一下:
测试环境一:思科3560-CG,一台8口千兆POE交换机
1、交叉线测试:
SDYC-UCDEMO_SW1#test cable-diagnostics tdr interface g0/8
TDR test started on interface Gi0/8
A TDR test can take a few seconds to run on an interface
Use 'show cable-diagnostics tdr' to read the TDR results.
SDYC-UCDEMO_SW1#show cable-diagnostics tdr interface g0/8
TDR test last run on: March 30 02:30:30
Interface Speed Local pair Pair length Remote pair Pair status
Gi0/8 1000M Pair A 0 +/- 10 meters Pair B Normal
Pair B 0 +/- 10 meters Pair A Normal
Pair C 0 +/- 10 meters Pair C Normal
Pair D 0 +/- 10 meters Pair D Normal
2、直通线测试:
SDYC-UCDEMO_SW1#test cable-diagnostics tdr interface g0/8 TDR test started on interface Gi0/8 A TDR test can take a few seconds to run on an interface Use 'show cable-diagnostics tdr' to read the TDR results.
SDYC-UCDEMO_SW1#show cable-diagnostics tdr interface g0/8 TDR test last run on: March 30 02:32:09
Interface Speed Local pair Pair length Remote pair Pair status
Gi0/8 1000M Pair A 0 +/- 10 meters Pair B Normal
Pair B 0 +/- 10 meters Pair A Normal
Pair C 0 +/- 10 meters Pair D Normal
Pair D 0 +/- 10 meters Pair C Normal
3、错误线序测试:
SDYC-UCDEMO_SW1#test cable-diagnostics tdr interface g0/8 Link state may be affected during TDR test TDR test started on interface Gi0/8 A TDR test can take a few seconds to run on an interface Use 'show cable-diagnostics tdr' to read the TDR results.
SDYC-UCDEMO_SW1#show cable-diagnostics tdr interface g0/8 TDR test last run on: March 30 02:34:36
Interface Speed Local pair Pair length Remote pair Pair status
Gi0/8 100M Pair A N/A Pair B Normal
Pair B N/A Pair A Normal
Pair C N/A Pair D Normal
Pair D N/A Pair C Normal
这条线的线序虽然是错的,但是是通的,所以后面显示的状态都是normal
4、线序超有问题的测试:
SDYC-UCDEMO_SW1#show cable-diagnostics tdr interface g0/8 TDR test last run on: March 30 03:06:38
Interface Speed Local pair Pair length Remote pair Pair status
Gi0/8 auto Pair A N/A N/A Normal
Pair B 0 +/- 10 meters N/A Short/Crosstalk
Pair C 0 +/- 10 meters N/A Open
Pair D N/A N/A Normal
这条线缆是线序超有问题的,接上去根本不通的,这时可以看到Pair Status上面显示的内容。
测试环境:一台2960XR交换机
1、直通线测试:
Switch#show cable-diagnostics tdr int g1/0/24 TDR test last run on: November 12 21:56:11
Interface Speed Local pair Pair length Remote pair Pair status
Gi1/0/24 1000M Pair A 22 +/- 10 meters Pair A Normal
Pair B 22 +/- 10 meters Pair B Normal
Pair C 22 +/- 10 meters Pair C Normal
Pair D 22 +/- 10 meters Pair D Normal
同一条网线,这个显示结果与3560-CG上有些不同。不过Pair的状态都是正常的。
2、交叉线测试:
Switch#test cable-dia tdr int g1/0/1 TDR test started on interface Gi1/0/1 A TDR test can take a few seconds to run on an interface Use 'show cable-diagnostics tdr' to read the TDR results. Switch#show cable-diag tdr int g1/0/1 TDR test last run on: November 12 21:58:42
Interface Speed Local pair Pair length Remote pair Pair status
Gi1/0/1 1000M Pair A 21 +/- 10 meters Pair B Normal
Pair B 21 +/- 10 meters Pair A Normal
Pair C 21 +/- 10 meters Pair C Normal
Pair D 21 +/- 10 meters Pair D Normal
3、线序超有问题的线缆测试:
Switch#test cable-diagnostics tdr int g1/0/5 TDR test started on interface Gi1/0/5 A TDR test can take a few seconds to run on an interface Use 'show cable-diagnostics tdr' to read the TDR results. Switch#show cable-diagnostics tdr int g1/0/5 TDR test last run on: November 12 22:03:52
Interface Speed Local pair Pair length Remote pair Pair status
Gi1/0/5 auto Pair A N/A N/A Normal
Pair B N/A N/A Normal
Pair C 1 +/- 10 meters N/A Open
Pair D 0 +/- 10 meters N/A Open
虽然这个也与3560-CG上显示的不同,不过都可以看出来这条线缆是有问题的。
需要说明一点,当我们进行TDR测试时,会影响到这条链路数据的传输,也就是说会导致该条线缆连接的客户端或是设备断网。 另外,它不支持对SFP口进行测试。
二、华为VCT测试
由于手头没有测试设备,下面的命令是查看文档所得
测试方法在接口模式下输入virtual-cable-test,如下所示:
相关输出的说明如下:
三、H3C的VCT测试
测试方法同华为一样,在接口模式下输入virtual-cable-test
显示结果如下:
相关输出解释如下:
在这里需要补充一下,这三家并不是所有的交换机都支持VCT,如果需要请查看相关文档。
还有就是这三家的VCT都只是针对网线的测试,不要用来测试光缆!