{"id":132,"date":"2010-03-06T11:24:00","date_gmt":"2010-03-06T16:24:00","guid":{"rendered":"https:\/\/rick.sh\/index.php\/2010\/03\/06\/easily-display-cdp-connection-info\/"},"modified":"2010-03-06T11:24:00","modified_gmt":"2010-03-06T16:24:00","slug":"easily-display-cdp-connection-info","status":"publish","type":"post","link":"https:\/\/rick.sh\/index.php\/2010\/03\/06\/easily-display-cdp-connection-info\/","title":{"rendered":"Easily display CDP connection info"},"content":{"rendered":"<p><span style=\"font-size:100%;\"><span style=\"font-family:arial;\">Here&#8217;s a quick one-liner to efficiently display CDP (Cisco Discovery Protocol) information on your windows PC. I must give credit to <a href=\"http:\/\/sidewynder.blogspot.com\/2005\/07\/tcpdump-filter-for-capturing-only.html\">this post<\/a>.<\/span><\/p>\n<p><span style=\"font-family:arial;\">First of all, download and install WinPcap and a copy of WinDump.exe here. WinDump is a runtime .exe, so no installation is necessary.<\/span><\/p>\n<p><span style=\"font-family:arial;\">Now, WinDump is a command-line utility, so to easily access it, I recommend you put it in your windows or system32 directory so you can easily access it from the command-line in any working directory.<\/span><\/p>\n<p><span style=\"font-family:arial;\">Use WinDump.exe -D to get your network connection&#8217;s identifier string.<\/span><br \/><span style=\"font-family:arial;\">Sample:<\/span><br \/><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">C:WinDump.exe -D<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">1.DeviceNPF_{FD16AF8D-2700-46D5-8C2B-759B0C54991A} (Sun)<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">2.DeviceNPF_{39E87FB9-DB40-4476-8B05-601AB3F4CC08} (Microsoft)<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">3.DeviceNPF_{6588B9CB-A7E7-4998-A780-3652193EA45B} (Intel(R) PRO\/1000 PL Network Connection)<\/span><\/p>\n<p><span style=\"font-family:arial;\">Here&#8217;s the command format I use:<\/span><br \/><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">C:WinDump.exe -nn -v -i DeviceNPF_{6588B9CB-A7E7-4998-A780-3652193EA45B} -s 1500 -c 1 &#8220;ether[20:2] == 0x2000&#8221;<\/span><\/p>\n<p><span style=\"font-family:arial;\">The command breakdown is similar to what is on the original post sample.<\/span><br \/><span style=\"font-family:arial;\">-nn displays output in numeric only format<\/span><br \/><span style=\"font-family:arial;\">-v displays verbose information<\/span><br \/><span style=\"font-family:arial;\">-i specifies the interface to use for the captures<\/span><br \/><span style=\"font-family:arial;\">-s specifies packet byte size to be snagged<\/span><br \/><span style=\"font-family:arial;\">-c exits the program after capturing one packet matching bytes 20 and 21 from the start of the Ethernet header for a hex value of 2000<\/span><\/p>\n<p><span style=\"font-family:arial;\">The output of the command above after successfully capturing a CDP packet looks like this:<\/span><br \/><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">15:50:59.355171 CDPv2, ttl: 180s, checksum: 692 (unverified), length 418<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Device-ID (0x01), length: 11 bytes: &#8216;Switch2&#8217;<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Address (0x02), length: 13 bytes: IPv4 (1) 10.1.1.2<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Port-ID (0x03), length: 19 bytes: &#8216;GigabitEthernet1\/2&#8217;<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Capability (0x04), length: 4 bytes: (0x00000029): Router, L2 Switch, IGMP snooping<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Version String (0x05), length: 289 bytes:<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Cisco Internetwork Operating System Software<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">IOS &#8482; Catalyst 4000 L3 Switch Software (cat4000-IS-M), Version 12.1(13)EW1, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1)<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">TAC Support: http:\/\/www.cisco.com\/tac<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Copyright (c) 1986-2003 by cisco Systems, Inc.<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Compiled Tue 18-Mar-03 07:33 by hqluong<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Platform (0x06), length: 15 bytes: &#8216;cisco WS-C4507R&#8217;<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Prefixes (0x07), length: 5 bytes: IPv4 Prefixes (1): 10.1.1.0\/24<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">VTP Management Domain (0x09), length: 5 bytes: &#8216;vtpdomain&#8217;<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Native VLAN ID (0x0a), length: 2 bytes: 129<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">Duplex (0x0b), length: 1 byte: full<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">AVVID trust bitmap (0x12), length: 1 byte: 0x00<\/span><span style=\"font-size:78%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:78%;\">AVVID untrusted ports CoS (0x13), length: 1 byte: 0x00<\/span><span style=\"font-size:78%;\"><\/p>\n<p><\/span><span style=\"font-family:arial;\">This info is great, there is lots of useful data: switch name, ip, interface, switchport native vlan, vtp domain, etc. But is not immediately clear what&#8217;s on the other end. So here&#8217;s a little bit of help.<\/span><\/p>\n<p><span style=\"font-family:arial;\">I put this command and others in a batch file to simplify things and to initiate CDP capture from an icon. Start the batch file with the WinDump command and have the output echo into a .txt file.<\/span><br \/><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">WinDump.exe -nn -v -i DeviceNPF_{6588B9CB-A7E7-4998-A780-3652193EA45B} -s 1500 -c 1 &#8220;ether[20:2] == 0x2000&#8221; >RESULT.txt<\/span><\/p>\n<p><span style=\"font-family:arial;\">Now, using the Find command, have it search the RESULT.txt file and output the data you like as so:<\/span><br \/><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">FIND \/I &#8220;Device-ID&#8221; RESULT.txt<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">FIND \/I &#8220;Port-ID (0x03)&#8221; RESULT.txt<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">FIND \/I &#8220;Address (0x02)&#8221; RESULT.txt<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">FIND \/I &#8220;Native VLAN ID (0x0a)&#8221; RESULT.txt<\/span><\/p>\n<p><span style=\"font-family:arial;\">So now, just run the batch file, and when a CDP packet is captured, the output will display only the data you need as so:<\/span><br \/><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">&#8212;&#8212;&#8212;- RESULT.TXT<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">Device-ID (0x01), length: 11 bytes: &#8216;Switch2&#8217;<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">&#8212;&#8212;&#8212;- RESULT.TXT<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">Port-ID (0x03), length: 19 bytes: &#8216;GigabitEthernet1\/2&#8217;<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">&#8212;&#8212;&#8212;- RESULT.TXT<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">Address (0x02), length: 13 bytes: IPv4 (1) 10.1.1.2<\/span><span style=\"font-size:85%;\"><\/p>\n<p><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">&#8212;&#8212;&#8212;- RESULT.TXT<\/span><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-family: courier new;font-family:arial;font-size:85%;\">Native VLAN ID (0x0a), length: 2 bytes: 100<\/span><span style=\"font-size:85%;\"><br \/><\/span><br \/><span style=\"font-family:arial;\">This little script saves me so much time everyday, and is a great alternative to commercial software that does the same. If anyone has any ideas to help make it better, please let me know!<\/span><br \/><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a quick one-liner to efficiently display CDP (Cisco Discovery Protocol) information on your windows PC. I must give credit to this post. First of all, download and install WinPcap and a copy of WinDump.exe here. WinDump is a runtime .exe, so no installation is necessary. Now, WinDump is a command-line utility, so to easily &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/rick.sh\/index.php\/2010\/03\/06\/easily-display-cdp-connection-info\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Easily display CDP connection info&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/posts\/132"}],"collection":[{"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":0,"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"wp:attachment":[{"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rick.sh\/index.php\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}