Linux: Configuring CDP for mapping physical network ports

We're turning up a lot of servers, with a lot of Ethernet ports, and it's hard to keep track of what's where. Our network guy turned me on to the concept of CDP to list out what's connected to certain ports. On a modern CentOS or Fedora box you simply need to install lldpd and enable it for CDP mode and you're off to the races.

yum install -y lldpd
perl -pi -e 's/LLDPD_OPTIONS=""/LLDPD_OPTIONS="-c"/' /etc/sysconfig/lldpd
systemctl enable lldpd --now

This will start the lldpd service and begin broadcasting on all ethernet ports. After 30 seconds or so you should be able to run the following command to see what your local Ethernet neighbors are.

lldpcli show neighbors
Leave A Reply
All content licensed under the Creative Commons License