CentOS7 LLDP使用方法 のバックアップ(No.1)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- CentOS7 LLDP使用方法 へ行く。
- 1 (2017-05-07 (日) 23:55:10)
- 2 (2017-05-08 (月) 00:17:07)
- 3 (2017-07-04 (火) 21:56:45)
目次
概要 †
CetnOS7にてlldpdを使用する方法。
†
ARMへの導入(Raspberry Pi) †
Raspberry Piに導入した場合の事例となるため、CPUアーキテクチャはARMとなる。
環境情報 †
- ディストリビューション
# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
- Kernel
# cat /proc/version Linux version 4.4.26-v7.1.el7 (mockbuild@armv7-02.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) ) #1 SMP Sat Oct 22 16:14:43 UTC 2016
- CPUタイプ
# cat /proc/cpuinfo processor : 0 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 〜以下略
導入手順 †
インストール †
- パッケージ導入
# yum install lldpad ============================================================================================================================== Package Arch Version Repository Size ============================================================================================================================== Installing: lldpad armv7hl 0.9.46-8.git48a5f38.fc21 fedora 239 k Installing for dependencies: libconfig armv7hl 1.4.9-7.fc21 fedora 58 k
- サービスの自動起動を設定する
# systemctl enable lldpad.service Created symlink from /etc/systemd/system/multi-user.target.wants/lldpad.service to /usr/lib/systemd/system/lldpad.service. Created symlink from /etc/systemd/system/sockets.target.wants/lldpad.socket to /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) Active: active (running) since Thu 2016-10-06 23:10:25 JST; 4min 44s ago Main PID: 19571 (lldpad) CGroup: /system.slice/lldpad.service └─19571 /usr/sbin/lldpad -t Oct 06 23:10:25 hw-mon02.localnet.asabiya.net systemd[1]: Started Link Layer Discovery Protocol Agent Daemon..
設定 †
- eth0が返す値を設定
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
- eth0のアドレスを設定
lldptool -T -i eth0 -V mngAddr ipv4=[IPADDR]
実行例
# lldptool -T -i eth0 -V mngAddr ipv4=192.168.1.10 ipv4 = 192.168.1.10
- 設定の有効化
# systemctl restart lldpad.service
- 設定結果の確認
# lldptool get-tlv -i eth0 Chassis ID TLV MAC: b8:27:eb:39:f8:13 Port ID TLV MAC: b8:27:eb:39:f8:13 Time to Live TLV 120 Port Description TLV Interface 2 as eth0 System Name TLV hw-mon02.localnet.asabiya.net System Description TLV Linux hw-mon02.localnet.asabiya.net 3.18.13-501.20150510gitf36e19f.sc20.armv7hl.bcm2709 #1 SMP PREEMPT Sun May 10 13:50:02 BST 2015 armv7l System Capabilities TLV System capabilities: Station Only Enabled capabilities: Station Only Management Address TLV IPv4: 192.168.xxx.xxx Ifindex: 2 End of LLDPDU TLV