Conditional Debug on Cisco IOS Router

Conditional debug is very useful to filter out some of the debug information that you see on a (busy) router. It allows us to only show debug information that matches a certain interface, MAC address, username and some other items.

It’s best to demonstrate this with an example, so let me show you the following router that is running RIP on two interfaces:

single Cisco router Two FE Interfaces

Let’s enable RIP debugging on this router:

R1#debug ip rip 
RIP protocol debugging is on

We will see RIP debug information from both interfaces:

R1#
RIP: sending v2 update to 224.0.0.9 via FastEthernet0/0 (192.168.12.1)
RIP: build update entries
	192.168.13.0/24 via 0.0.0.0, metric 1, tag 0
R1#
RIP: sending v2 update to 224.0.0.9 via FastEthernet0/1 (192.168.13.1)
RIP: build update entries
	192.168.12.0/24 via 0.0.0.0, metric 1, tag 0

If I only want to see the debug information from one interface then I can use a debug condition:

R1#debug condition ?
  application  Application
  called       called number
  calling      calling
  card         card
  glbp         interface group
  interface    interface
  ip           IP address
  mac-address  MAC address
  match-list   apply the match-list
  standby      interface group
  username     username
  vcid         VC ID
  vlan         vlan
  voice-port   voice-port number
  xconnect     Xconnect conditional debugging on segment pair

This is quite a list with different items to choose from. I’ll use the interface as a condition:

R1#debug condition interface fastEthernet 0/0
Condition 1 set

Using this debug condition we will only see RIP debug information from the FastEthernet 0/0 interface:

R1#
RIP: sending v2 update to 224.0.0.9 via FastEthernet0/0 (192.168.12.1)
RIP: build update entries
	192.168.13.0/24 via 0.0.0.0, metric 1, tag 0

When you want to get rid of the debug condition then you can use the following command:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 655 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

535 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Forum Replies

  1. Rene,

    Hi. With the debug condition there are multiple options that can be used such as interface (as you highlighted) ip address, mac address, etc… When you have multiple debug conditions configured is it a logical “and” or “or”? In other words do they all have to match for it to work with multiple conditions? When using the “ip” condition could that be any IP going through the router? Could it also include traffic to the router itself? Many thanks.

    Thomas

  2. Rene,

    I have been able to get conditional debug to work with interface. However, I have yet to perform a successful conditional debug with ip. Here’s an example:

    R5#debug ip ospf hello
    OSPF hello debugging is on
    R5#
    OSPF-1 HELLO Gi1.45: Send hello to 224.0.0.5 area 0 from 155.1.45.5
    R5#
    OSPF-1 HELLO Tu0: Send hello to 224.0.0.5 area 0 from 155.1.0.5
    R5#
    OSPF-1 HELLO Gi1.5: Send hello to 224.0.0.5 area 0 from 155.1.5.5
    OSPF-1 HELLO Gi1.58: Send hello to 224.0.0.5 area 0 from 155.1.58.5
    R5#
    OSPF-1 HELLO Gi1.45: Rcv hello from 150.1.4.4 area 0 155.1.45.4
    OSPF-1 
    ... Continue reading in our forum

  3. Rene,

    Thank you for checking as well. Much appreciated.

    Roland

  4. I tried a couple of different combinations and maybe in GNS3 this command doesn’t work at all.
    I set conditions for completely different IP and only enable debug ip icmp, ping from another router and I still get output.
    enable condition for interface that isn’t used and I still get debug output when pinging.
    Seems this command isn’t working at all in GNS3.

    I’d fire up my rack of gear but it’s 110 here …

    R5#debug ip icmp
    ICMP packet debugging is on
    
    R5#debug condition ip 192.168.1.1
    Condition 1 set
    
    R5#
    *Jun 23 05:13:31.239: ICMP: echo reply sent, src 10.1.3
    ... Continue reading in our forum

  5. Hi Daniel,

    Same issue here, conditional debugging works for interfaces but I was unable to get any wanted results with debug ip condition. Tried it in VIRL and on real hardware.

    Rene

2 more replies! Ask a question or join the discussion by visiting our Community Forum