Everyone knows about the great Cisco Discovery Protocol (CDP). It turns out that for Linux, too, it is possible to use its charms. There is an
LLDP project that will help us with this.
For those who are not in the blessing: on cisco, you can see the neighbors with the included CDP command
sh cdp nei . The command will display the equipment that is connected, on which port, etc., in more detail s
h cdp ent Device_ID , already on a specific device.
So, now we will try to turn it on in Linux, in this particular case, we will configure it on CentOS 5.4, on Debian-like distros almost the same thing, except for the build process and the location of the files.
')
First, download
src.rpm , install it:
# rpm -Uhv lldpd-0.4.0-1.fc10.src.rpm
A file of specifications /usr/src/redhat/SPECS/lldpd.spec will appear, who needs it, can edit it at its discretion, if necessary.
Next we actually need to build the package itself:
# rpmbuild -bb /usr/src/redhat/SPECS/lldpd.spec
Install the newly built package:
# rpm -Uhv /usr/src/redhat/RPMS/i386/lldpd-0.4.0-1.i386.rpm
configure daemon launch options, open the file:
# vim /etc/sysconfig/lldpd
and rule
OPTIONS=”-v -c”
-v - enable vlan support if you have them on a Linux machine
-c - enable CDP protocol
more information can be viewed by
man lldpdRun the daemon:
# /etc/init.d/lldpd start
after launch, in the / var / log / messages file we will see approximately the following lines:
lldpd[30206]: lldpd_decode: switching to CDPv2 on port eth1
lldpd[30206]: lldpd_decode: switching to CDPv2 on port eth0
everything is fine, the demon has started.
In order for everything to work, on the other side of the equipment, on the port, CDP must be enabled, that is, there should not be
no cdp enable on the interface.
Actually, it remains only to check how everything works and get information.
# lldpctl
:
--------------------------------------------------------
LLDP neighbors
--------------------------------------------------------
Interface: eth0
ChassisID: sw-b-48 (local)
SysName: sw-b-48
SysDescr:
cisco WS-C2960-48TT-L running on
Cisco IOS Software, C2960 Software (C2960-LANBASE-M)
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Thu 19-Jul-07 20:06 by nachen
MgmtIP: 172.16.25.48
Caps: Bridge(E)
PortID: FastEthernet0/4 (ifName)
PortDescr: FastEthernet0/4
--------------------------------------------------------
we see that on the other side we have a C2960 switch, an IOS version, a switch port that the Linux machine is connected to.
For the thrill of sensation, let's see the output on cisco, we got there:
my.linux.machine
Fas 0/4 92 R Linux eth0
that is, again, we see that we have a Linux machine, the network name of the machine, and its eth0 network card on the port fa0 / 4.
I will add : you can install a demon from the sors yourself, but in my case it is not a true way, everything should be streamlined. In Debian-like distros, the daemon configuration file is located in / etc / default /
It is worth noting the
cdpr utility, but with its help you can only receive information on the CDP, and not share it, for RH distros it is in the
rpmforge repository.
That's all. Good luck in the settings.
UPD : got an invite for the article, very happy.
UPD2 : wrote - this has already happened
habrahabr.ru/blogs/sysadm/83356 - mine differences are obvious