本文转自:http://zhengyin0211.blog.sohu.com/168115611.html

下面以Cisco1800路由器为例,介绍一下常用的查看端口和通道状况的命令。

在MS-DOS窗口里敲入命令telnet+IP地址,回车,即可远程登录路由器。一般用路由器局域网口地址。

1,用R1#sh ip int b命令查看端口状态
R1#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 100.100.100.226 YES NVRAM up up
FastEthernet0/1 200.200.200.226 YES NVRAM up up
Serial0/0/0 72.22.81.102 YES NVRAM up up
Serial0/0/1 72.22.81.109 YES NVRAM up up
正常情况下,思科1800路由器四个端口的Status和protocol都是up的。

2,用R1#sh int s0/0/0查看链路状态和通道情况
Serial0/0/0 is up, line protocol is up //接口与协议都已启动(正常)
Serial0/0/0 is up, line protocol is down //接口启动,协议没有匹配成功(端口无物理故障,但通道不通)
Serial0/0/0 is down, line protocol is down //接口与协议都DOWN掉(协转没有工作)
Serial0/0/0 is down,line protocol is down(disable)//端口出现物理性故障,需更换端口。
Serial0/0/0 is administratively down,line protocol is down //接口关闭,可用命令打开。
Serial0/0/0 is up, line protocol is down(looped) //此通道上有环(无论在协转、DDF架、SDH上做环,在路由器里看到的显示是一样的)。

Serial0 is up, line protocol is down
Hardware is PowerQUICC Serial
Interface is unnumbered. Using address of FastEthernet0/0 (172.22.128.193)
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255 //通道的可靠性
Encapsulation PPP, LCP Listen, loopback not set
Last input 00:00:27, output 00:00:27, output hang never
Last clearing of “show interface” counters 00:02:52 //上次计数器清零到现在的时间
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/2/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 1158 kilobits/sec
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
30 packets input, 420 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
6552 input errors, 0 CRC, 4 frame, 0 overrun, 0 ignored, 0 abort// 输入错误包数量
60 packets output, 840 bytes, 0 underruns
0 output errors, 0 collisions, 9 interface resets
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up
通道的可靠性,正常值是255/255,如果低于254将会造成丢包。可靠性越低,通道越差,错误包越多。

DCD 数据载体检测DTE CARrfer derect
DSR 数据设置就绪DATA SET READY
DTR 数据终端就绪DTE IS READY
RTS 请求发送Reguest To Send
CTS 清除发送Clear To send

3,路由器端口计数器清零
有故障的通道往往造成路由器接口的输入错误包数量很高,不便于比较查看。这时最好把接口数据包计数器清零,使其重新开始计数。用R1#clear coun命令清零。
R1#clear coun

4,判断以太网端口故障
用R1#sh int f0/0 来检查以太网口及其链路的状态,如下所示:
R1#sh int f0/0
FastEthernet 0 is up,line protocol is up //连接正常
Ethernet 0 is up,line protocol is down //连接故障,路由器没有连接到局域网
Ethernet 0 is down,line protocol is down(disable) //接口故障
Ethernet 0 is administratively down,line protocol is down //接口被关闭,可用命令打开

5,查看相邻路由器
用R2#sh cdp nei命令查看相邻路由器,输出如下:
R2#sh cdp nei
Capability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge
S – Switch, H – Host, I – IGMP, r – Repeater

Device ID Local Intrfce Holdtme Capability Platform Port ID
R1 Ser 0/0/0 133 R S I 1841 Ser 0/0/1
S2_SW1 Fas 0/0 125 S I WS-C2960-2Fas 0/6
S2_SW2 Fas 0/1 140 S I WS-C2960-2Fas 0/22
R3 Ser 0/0/1 156 R S I 1841 Ser 0/0/0
此命令可以查看到相邻的思科路由器和思科交换机,可以验证设备是否相通,以及连接关系是否正确。

6,观察路由器告警和报错信息
路由器发生故障或状态发生变化的时候,会发出告警、报错、提示信息。如果是用telnet命令登录路由器的话,不能直接看到这些信息,需要输入R1# ter mon命令后,才能使这些信息显示在MS-DOS窗口上。
R1#ter mon
该命令可以使你及时了解路由器状态变化,便于发现和排除故障。