About Me
- Name: SWeidner
- Location: Elk Point, South Dakota, United States
My Blogger Code
B5 d+ t k s u- f- i- o- x-- e l- c (decode it!)
My Geek Code
GAT/IT d-(+) s+(): a C+++$ ULC+++>$ P++>++++ L++$>++++ !E W++>$ N+ !o !K w+()@ !O !M- !V PS-(--)@>--- PE+ Y-- PGP>++ t+ !5(-) X+ !R- tv-(+)? b+ DI++++ D++>$ G e+>++ h----(-) r+++ y++++
Links
Blogmap
AdSense
Archives
Steve's random ramblings and technical notes
Monday, July 11, 2005
tcpdump filter for capturing only Cisco Discovery Protocol (CDP) Packets
I found the detail on this in the article "Ethereal: Capturing only Cisco Discovery Protocol (CDP) Packets." but it applies directly to tcpdump or windump as well. Ethereal, tcpdump and windump all use the same underlying capabilities of the Berkeley Packet Filter language for filtering packets.
To capture a single CDP packet, type the following at a command-prompt (need root privileges):
What kind of information can we get from this single packet?
To capture a single CDP packet, type the following at a command-prompt (need root privileges):
tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000'To break that down, we're
- running tcpdump (you can swap for windump if you like)
- not resolving dns or port numbers
- using verbose mode
- on the interface known as eth0
- snagging up to 1500 bytes of the packet
- counting one packet before exiting and (finally)
- checking bytes 20 and 21 from the start of the ethernet header for a value of 2000 (hex)
For reference, the whole expression as presented at the linked page is:
ether[12:2] <= 1500 &&amp;amp; ether[14:2] == 0xAAAA && ether[16:1] == 0x03 && ether[17:2] == 0x0000 && ether[19:1] == 0x0C && ether[20:2] == 0x2000
What kind of information can we get from this single packet?
- Hostname of the device
- IP address
- Interface
- IOS Version string
- Platform (a.k.a. model number)
- VTP Domain
- Native VLAN
- Duplex
- .. and more ..
Comments:
<< Home
I had several other packets matchin the filter in a jboss cluster multicast scenario. I solved it by adding the cisco destination MAC.
tcpdump -nn -v -s 1500 -c 1 'ether[20:2] == 0x2000 and ether dst 01:00:0c:cc:cc:cc'
Post a Comment
tcpdump -nn -v -s 1500 -c 1 'ether[20:2] == 0x2000 and ether dst 01:00:0c:cc:cc:cc'
<< Home