Hmmm….I wonder what switch port this box is connected to???

[~]> apt-get install cdpr
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  cdpr
0 upgraded, 1 newly installed, 0 to remove and 31 not upgraded.
Need to get 17.4 kB of archives.
After this operation, 102 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/universe cdpr amd64 2.4-1ubuntu1 [17.4 kB]
Fetched 17.4 kB in 0s (150 kB/s)
Selecting previously unselected package cdpr.
(Reading database ... 103666 files and directories currently installed.)
Preparing to unpack .../cdpr_2.4-1ubuntu1_amd64.deb ...
Unpacking cdpr (2.4-1ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up cdpr (2.4-1ubuntu1) ...
[~]> ifconfig
eth0      Link encap:Ethernet  HWaddr 00:25:90:a8:e6:1e
          inet addr:10.1.1.188  Bcast:10.1.25.255  Mask:255.255.254.0
          inet6 addr: fe80::225:90ff:fea8:e61e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1014405338 errors:0 dropped:167145 overruns:0 frame:0
          TX packets:237792710 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1507693997786 (1.5 TB)  TX bytes:17683235227 (17.6 GB)
          Interrupt:16 Memory:dfa00000-dfa20000

eth1      Link encap:Ethernet  HWaddr 00:25:90:a8:e6:1f
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::225:90ff:fea8:e61f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4028437871 errors:0 dropped:594 overruns:0 frame:0
          TX packets:347873995 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6080452972041 (6.0 TB)  TX bytes:29736430772 (29.7 GB)
          Interrupt:18 Memory:df900000-df920000

And finally, we can get some damn useful info:

[~]> cdpr -d eth0
cdpr - Cisco Discovery Protocol Reporter
Version 2.4
Copyright (c) 2002-2010 - MonkeyMental.com

Using Device: eth0
Waiting for CDP advertisement:
(default config is to transmit CDP packets every 60 seconds)
Device ID
  value:  awesomeswitchbr0
Addresses
  value:  10.1.1.2
Port ID
  value:  GigabitEthernet3/0/2

So don’t leave work today until you’ve ensured CDP is enabled on all your equipment. Additionally, there isn’t that much overhead as announcements only occur every 60 seconds by default.

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.