Debug
Throughout your career as a network professional, you will encounter issues with specific technologies and protocols. It is at times such as these, that debug will be your friend. There are loads of individual debug commands, that vary in command depth. E.g.
debug ip ospf packet
Will give you a general view of the various OSPF packets being sent and received by the device. However;
debug ip ospf mpls traffic-eng advertisements
Will give you a very focused output of the traffic engineering advertisements in OSPF.
An excellent document is available on the Cisco website with the majority of the available debug commands and what they do here: https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/debug/command/i1/db-i1-cr-book.html
Another method of finding your way around the debug command is simply to use the ‘?’ option on a router or switch.
When you’re experimenting with debug, it’s important to know how to switch it off, and that is simply done with the command:
undebug all
Conditional Debug
Debug can often be an overwhelming output to navigate and make sense of, comparable to attempting to drink from a fire hose. If you decide to debug ospf packets on a router with many interfaces for example, you’re likely to get a lot of activity on your logs. What if you only want to debug the ospf packets for a particular interface? Enter the conditional debug!
debug ip ospf packet
debug condition interface Gi1/0/1
This combination of commands is known as “Conditional debug” and will filter the debug output based on your conditions. In the example above, we will only ever see debug entries in the devices log, relating to the OSPF packets on interface Gi1/0/1. You can combine conditions too, as little or as many as you like to fine-tune the exact information you want to see in the output. Each condition added, will behave like an ‘And’ operator in Boolean logic. As before, to remove your debug, along with the conditions, simply use:
undebug all

