router_122(config)#interface serial 3/0
router_122(config-if)#no ip route-cache
router_122(config-if)#end
router_122#
00:11:57: IP: s=10.10.10.2 (Virtual-Access1), d=13.1.1.1
(Serial3/0), g=172.16.1.6, len 100, forward
00:11:57: ICMP type=8, code=0
! -- 從10.10.10.2到13.1.1.1的ICMP 包(回送)
00:11:57: IP: s=13.1.1.1 (Serial3/0), d=10.10.10.2 (Virtual-Access1),
g=10.10.10.2, len 100, forward
00:11:57: ICMP type=0, code=0
! -- 從13.1.1.1 到10.10.10.2的ICMP 返回包(回送應答)
00:11:57: IP: s=10.10.10.2 (Virtual-Access1), d=13.1.1.1 (Serial3/0),
g=172.16.1.6, len 100, forward
00:11:57: ICMP type=8, code=0
00:11:57: IP: s=13.1.1.1 (Serial3/0), d=10.10.10.2 (Virtual-Access1),
g=10.10.10.2, len 100, forward
00:11:57: ICMP type=0, code=0
請注意: debug ip packet 輸出不顯示任何不符合訪問列表標準的數據包。有關此過程的更多信息,請參考“了解Ping和Traceroute命令”的文獻資料。有關如何創建訪問列表的更多信息,請參考“ 配置IP訪問列表”的文獻。
四、有條件的觸發調試
在啟用有條件觸發調試功能的情況下,對于在特定接口路由器上發送或接收的數據包,路由器生成調試消息;對于通過不同接口發送或傳輸的數據包,路由器不生成調試輸出。有關使用有條件調試的更多信息,請參考“有條件觸發調試 ”的文獻資料。
下面研究一下有條件調試的簡單應用。考慮下面這個情況:下面所示的路由器(trabol)具有運行HDLC的兩個接口(串口0和串口3)。
現在通過常用的 debug serial interface 命令來觀察所有端口上所接收的HDLC保活信息。通過這種方法可以看到這兩個接口上的保活信息。
traxbol#debug serial interface
Serial network interface debugging is on
traxbol#
*Mar 8 09:42:34.851: Serial0: HDLC myseq 28, mineseen 28*, yourseen 41, line up
! -- 接口Serial 0上HDLC保活
*Mar 8 09:42:34.855: Serial3: HDLC myseq 26, mineseen 26*, yourseen 27, line up
! -- 接口Serial 3上的HDLC保活
*Mar 8 09:42:44.851: Serial0: HDLC myseq 29, mineseen 29*, yourseen 42, line up
*Mar 8 09:42:44.855: Serial3: HDLC myseq 27, mineseen 27*, yourseen 28, line up
現在啟用串接口3上的有條件調試。也就是說,只顯示串接口3的調試。因此,使用 debug interface
traxbol#debug interface serial 3
Condition 1 set
通過 show debug condition 命令來驗證有條件調試是否處于啟用狀態。請注意,串接口3處于激活狀態。
traxbol#show debug condition
Condition 1: interface Se3 (1 flags triggered)
Flags: Se3
traxbol#
*Mar 8 09:43:04.855: Serial3: HDLC myseq 29, mineseen 29*, yourseen 30, line up
*Mar 8 09:43:14.855: Serial3: HDLC myseq 30, mineseen 30*, yourseen 31, line up
若要取消有條件調試,則使用 undebug interface
traxbol#undebug interface serial 3
This condition is the last interface condition set.
Removing all conditions may cause a flood of debugging
messages to result, unless specific debugging flags
are first removed.
Proceed with removal? [yes/no]: y
Condition 1 has been removed
traxbol#
現在可以觀察到顯示兩個串接口0和串接口3的調試。
*Mar 8 09:43:34.927: Serial3: HDLC myseq 32, mineseen 32*, yourseen 33, line up
*Mar 8 09:43:44.923: Serial0: HDLC myseq 35, mineseen 35*, yourseen 48, line up
警告:有些調試運行本身是有條件的,這方面的例子是atm調試。通過ATM調試,可明確地指定啟用調試的接口,而不是啟用所有atm接口上的調試并規定一種條件。