Pythian Blog: Technical Track

Automate Network Discovering via LLDP and Puppet

When you are managing a very large bare metal infrastructure, documenting your resources is of key importance.  One of the more difficult things to keep updated is how your servers are linked with your switches. One important goal is having accurate and up-to-date port descriptions, but that is not as simple as it seems due to eventual inconsistencies and errors that might accumulate over time with manual maintenance of inventory lists.

A good way to solve this problem is to take advantage of the LLDP (Link Layer Discovery Protocol-IEEE 802.1ab) protocol. The concept is simple.: LLDP provides mechanisms to deliver link layer notifications to adjacent network devices that provides identities and capabilities to neighbours.  If you combine a client such as OpenLLDP and configure management tools like Puppet, you can dynamically generate a current list that describes how your switch ports and servers are linked.

Here is a Puppet module (https://github.com/narcisbcn/puppet-lldp) which will install lldpad binaries and also enable LLDP on your servers.  You will need to separately enable LLDP protocol on the switch side as well. Once applied to your severs, the module will allow you to use Puppet facts to view link information.

This is an example between CentOS 6 and Cisco Nexus 5000:

switch_name_eth0 => N5K1
switch_name_eth1 => N5K2
switch_port_eth0 => Ethernet116/1/22
switch_port_eth1 => Ethernet117/1/22

As shown above, the server is linked to the switch tagged as N5K1 and N5K2 via Ethernet116/1/22 and Ethernet117/1/22 ports.

No Comments Yet

Let us know what you think

Subscribe by email