LLDP provides an alternative to proprietary protocol from Cisco CDP with the big advantage to be standardized on a large number of devices. Like CDP, LLDP allows network equipment to communicate with each other by indicating, as example, their position on a switch or IP address. The use and functioning of LLDP is close to that of CDP, I don’t want to go into detail. Information is available on this previous post.
In summary you can recover information to identify the location of a computer station on a switch without having to follow the wiring and even use this information in tools like Absolute Manage.
Compile openlldp for Mac OS X
As often, there are several tools to integrate the LLDP. The solution recommended in this post is to compile OpenLLDP with Mac OS X and use the application to retrieve information about the network location.
Before you begin this step, it is necessary to install Xcode from the Mac App Store and the “Command Line Tools”. These are in the Xcode preferences in the “Downloads”.
– Download the last version of openlldp from the website of the project and uncompress the files
– Go with the Terminal to the openlldp folder where are the sources of the application
– Prepare the compilation with the configuration command
– Start the compilation with the command “make”
– It is possible (but not required) to automatically install openlldp files
sudo make install
The OpenLDAP project is composed to two distinct applications :
lldp is a daemon to start at boot who will capture LLDP frames arriving on the client workstation.
lldpneighbors is the tool to find the network equipment that is connected to the client.
Since the software is in Alpha version, it’s best to create a script that will handle lldp launch, display the result with lldpneighbors and then exit the process lldp. The precautionary principle.
It should not forget that the frames are sent every 30 seconds by default, so it’s necessary to leave lldp launched long enough to capture packets. If your devices are configured to send lldp network information with more time, it’s needed to adapt your scripts.
Your directions worked without any issues. Being new to MAC/UNIX is it possible to provide a copy of the script that you suggested?
Sorry, I’m no longer using LLDP and I did not keep the scripts. But if I remember it was really simple (launching the daemon waiting for the infos, killing the daemon). If you really need help I can take a look, just leave me a message through the contact form.
Over 4 years later, I’m reading this. Thanks! I have a bunch of network interfaces on my early 2015 MBP — some are VLAN interfaces. While lldpd gets a lot of them but it misses en5 which is by Thunderbolt Ethernet 🙁
As far as “scripting” this 2-liner might work for ya:
sudo pkill lldpd
sudo /usr/local/sbin/lldpd && sleep 60 && /usr/local/bin/lldpneighbors
I’ll have to look at the code and see if I could do anything — I doubt I can because I’m not really a great programmer. But thanks for the info, regardless! -Jim
Thanks for the tips! This post was never updated and I never tested with trunked interfaces, but it’s good to know.
Pingback: Easy LanMap Creation