Odds and Ends August 11, 2004 at 6:17 pm

CDPR – Cisco Discovery Protocol

Are you on a Cisco Network – and need to know just what switch and port you are on?

try the cdpr tool – First download and install fink

Then visit monkeymetal.com
and get the latest tarball of the cdpr source.

Change the Makefile line for CDFLAGS to look like this:

CFLAGS = -Wall -ggdb -lpcap -I/sw/include

Then run make.

If it compiles all is well and run as follows…

sudo ./cdpr (Or if you copy the cdpr into a dir in your path just plain “sudo cdpr”.)

When it launches cdpr will ask what ethernet interface to look at.

If all is well it will return the DEVICE ID of the switch you are connected to, and its IP AND its port ID.

The cdpr utility can be very useful when central IT doesn’t know where everything is connected.

Good Luck!

No Comments

  • here is an update – slightly more clear version – – – –

    every now and then – I lose something… really – I do… but this new baby
    helps to get me back on track….

    CDPR – Cisco Discovery Protocol Reporter

    a tool to query the network and respond with what switch and port you are
    plugged into…

    never again will i lose an office or computer … I can "always" know just where
    things are plugged in now…

    On Windows –
    You will need the winpcap libraries


    the windows Binaries for older versions are here


    On OSX –
    You will need to have the Dev Tools installed
    and to make life easy – get fink

    have fink install libpcap and libpcap-shlibs

    then get the latest tarball from http://www.sourceforge.net/projects/cdpr or
    from the home site of the project http://www.monkeymental.com/nuke/

    untar the package – and make one change to the Makefile

    change the CDFLAGS line to read

    CFLAGS = -Wall -ggdb -lpcap -I/sw/include

    this assumes that you have fink installed in "/sw" (the default for fink)
    at that point "make" it.


    Running the Beastie!

    on the mac it must run as a privileged account (ala – sudo cdpr)

    on the PC – from a CMD window – just run it


    on the Mac – the output looks like this

    dragontooth:~/Documents/builds/cdpr-2.2.0 rmleonard$ sudo ./cdpr
    cdpr – Cisco Discovery Protocol Reporter
    Version 2.2.0
    Copyright (c) 2002-2004 – MonkeyMental.com

    1. en0 (No description available)
    2. lo0 (No description available)
    Enter the interface number (1-2):1
    Using Device: en0
    Waiting for CDP advertisement:
    (default config is to transmit CDP packets every 60 seconds)
    Device ID
    value: cpp-005-1c1.csupomona.net
    Port ID
    value: GigabitEthernet0/2
    dragontooth:~/Documents/builds/cdpr-2.2.0 rmleonard$

    so this machine is plugged into GB0/2 on 1c1 in Building 5

    Ain’t life grand – I am putting this on my diagnostic laptops as we speak

Leave a reply

You must be logged in to post a comment.