目次~
#contents
*概要 [#ld6968ab]
Rocky Linux release 8.6 (Green Obsidian)にてlldpdを使用する方法。~
*導入手順 [#k0ed058e]
**インストール [#rff4aa48]
-パッケージ導入
# dnf install lldpad
依存関係が解決しました。
====================================================================================================================================
パッケージ アーキテクチャー バージョン リポジトリー サイズ
====================================================================================================================================
インストール:
lldpad x86_64 1.0.1-16.git036e314.el8 baseos 300 k
-サービスの自動起動を設定する~
# systemctl enable lldpad
Created symlink /etc/systemd/system/multi-user.target.wants/lldpad.service → /usr/lib/systemd/system/lldpad.service.
Created symlink /etc/systemd/system/sockets.target.wants/lldpad.socket → /usr/lib/systemd/system/lldpad.socket.
-サービスを起動する~
# systemctl start lldpad
-起動結果
# systemctl status lldpad.service
● lldpad.service - Link Layer Discovery Protocol Agent Daemon.
Loaded: loaded (/usr/lib/systemd/system/lldpad.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2022-08-21 17:28:40 JST; 6s ago
ether 00:10:f3:7d:53:89 txqueuelen 1000 (Ethernet)
RX packets 4849894 bytes 471135695 (449.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2951881 bytes 1419172350 (1.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xd0a00000-d0afffff
**設定 [#o4694c2d]
-インターフェイスが返す値を設定
for i in `ls /sys/class/net/ | grep 'eth\|ens\|eno'`;
do echo "enabling lldp for interface: $i";
lldptool set-lldp -i $i adminStatus=rxtx;
lldptool -T -i $i -V sysName enableTx=yes;
lldptool -T -i $i -V portDesc enableTx=yes;
lldptool -T -i $i -V sysDesc enableTx=yes;
lldptool -T -i $i -V sysCap enableTx=yes;
lldptool -T -i $i -V mngAddr enableTx=yes;
done
-設定の有効化
# systemctl restart lldpad.service
-設定結果の確認
# lldptool get-tlv -i enp2s0
Chassis ID TLV
MAC: 00:10:f3:7d:53:89
Port ID TLV
MAC: 00:10:f3:7d:53:89
Time to Live TLV
120
Port Description TLV
Interface 3 as enp2s0
System Name TLV
zp-7400-01
System Description TLV
Linux zp-7400-01 4.18.0-372.19.1.el8_6.x86_64 #1 SMP Tue Aug 2 16:19:42 UTC 2022 x86_64
System Capabilities TLV
System capabilities: Router
Enabled capabilities: Router
Management Address TLV
IPv4: 192.168.1.155
Ifindex: 3
End of LLDPDU TLV
**動作確認 [#q145f8df]
-隣接機器情報の参照
# lldptool get-tlv -i enp2s0 -n
Chassis ID TLV
MAC: 64:e9:50:db:50:00
Port ID TLV
Ifname: Fa0/3
Time to Live TLV
120
System Name TLV
EDGE-SW03.asabiya.net
System Description TLV
Cisco IOS Software, C2960C Software (C2960c405-UNIVERSALK9-M), Version 15.0(2)SE4, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Wed 26-Jun-13 04:13 by prod_rel_team
Port Description TLV
FastEthernet0/3
System Capabilities TLV
System capabilities: Bridge
Enabled capabilities: Bridge
Management Address TLV
IPv4: 192.168.1.8
System port number: 1
Port VLAN ID TLV
PVID: 1
MAC/PHY Configuration Status TLV
Auto-negotiation supported and enabled
PMD auto-negotiation capabilities: 0x6c00
MAU type: 100 BaseTXFD
End of LLDPDU TLV