第3部分:使用Debug命令
最后,我们来学习如何正确使用调试工具Debug,实验过程见监测清单2-4。
监测清单2-4正确使用Debug
Router#debug?
aaa AAA Authentication, Authorization and Accounting
Access-eXPression Boolean access expression
adjacency adjacency
all Enable all debugging
apple Appletalk information
arap Appletalk Remote Access
arp IP ARP and HP Probe transactions
async Async interface information
backup Backup events
callback Callback activity
cca CCA activity
... (此处省略)
ip IP information
ipx Novell/IPX information
lapb LAPB protocol transactions
... (此处省略)
vtemplate Virtual Template information
x25 X.25, CMNS and XOT information
x28 X28 mode
Router#debug ip ?
bgp BGP information
cache IP cache operations
cef IP CEF operations
cgmp CGMP protocol activity
dhcp CGMP protocol activity
drp Director response protocol
dvmrp DVMRP protocol activity
egp EGP information
eigrp IP-EIGRP information
error IP error debugging
flow IP Flow switching operations
FTP FTP dialogue
Html HTML
http HTTP connections
icmp ICMP protocol activity
igmp IGMP information
interface IP interface configuration changes
mbgp MBGP information
mcache IP multicast cache operations
mpacket IP multicast packet debugging
mrm IP Multicast Routing Monitor
mrouting IP multicast routing table activity
msdp Multicast Source Discovery Protocol (MSDP)
mtag IP multicast tagswitching activity
nat NAT events
ospf OSPF information
packet General IP debugging and IPSO security transactions
peer IP peer address activity
pim PIM protocol activity
policy Policy routing
rip RIP protocol transactions
routing Routing table events
rsvp RSVP protocol activity
rtp RTP information
sd Session Directory(SD)
security IP security options
socket Socket event
tcp TCP information
tempacl IP temporary ACL
trigger-authentication Trigger authentication
udp UDP based transactions
wccp WCCP information
Router#debug ip icmp
ICMP packet debugging is on
Router#ping 172.16.1.1
Type escape sequence to abort.
Sending5,100-byte ICMP Echos to 172.16.1.1,timeout is 2 seconds:
!!!!!
SUCcess rate is 100 percent(5/5),round-trip min/avg/max=8/11/12ms
Router#
04:13:25:ICMP:echo reply sent,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply rcvd,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply sent,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply rcvd,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply sent,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply rcvd,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply sent,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply rcvd,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply sent,src 172.16.1.1,dst 172.16.1.1
04:13:25:ICMP:echo reply rcvd.src 172.16.1.1,dst 172.16.1.1
Router#
Router#show debug
Generic IP
ICMP packet debugging is on
Router#debug arp
ARP packet debugging is on
Router#debug ip packet
IP packet debugging is on
Router#show debug
ARP:
ARP packet debugging is on
Generic IP:
ICMP packet debugging is on
IP packet debugging is on
Router#no debug ip packet
IP packet debugging is off
Router#show debug
ARP:
ARP packet debugging is on
Generic IP:
ICMP packet debugging is on
Router#no debug all
Router#show debug
Router#
(1)第1个命令debug?是查看debug命令所包含的子命令,可以看到debug命令有非常丰富的子命令。其中debug all是打开所有的可用的debug在实际工作的网络环境中对这个命令的使用非常轻易造成路由器的处理资源耗尽,所以应尽量避免使用带all选项的debug命令。在使用debug命令时其子命令越具体越好,越能看到具体的监测内容,并且减小对于路由器处理能力的影响。
(2)在debug ip的子命令中,有icmp一项是用来监测ICMP协议执行情况的,我们启动这一监测项,即debug ip icmp。
(3)为了看出上述命令的监测结果,我们用ping命令来做测试。监测结果显示从源地址172.16.1.1向目标地址172.16.1.1(与源地址相同)发送了5个icmp reply包,同时目标地址接收到了5个icmp reply包。
(4)show debug 命令可以查看当前打开的监测项目。
(5)命令no debug ip packet 用来关闭对ip packet的监测,原来已打开的其他监测项目仍处于打开状态。
(6)命令no debug all或undebug all 可以关闭所有debug项目,最后的show debug结果显示一个空行表示没有正在打开的监测项目。