LLDP是一个数据链路层发现协议,LLDP协议使得接入网络的一台设备可以将其主要的能力,管理地址,设备标识,接口标识等信息发送给接入同一个局域网络的其它设备。lldptool工具采用的是LLDP协议,一般我们使用lldptool是为了得到设备的物理拓扑结构以及管理配置信息,比如说,和eth1网口相连的网络交换机的Vlan ID是多少?网络交换机的名称是什么?网线插在网络交换机的什么地方?
LLDP协议有四种工作模式:
- TxRx:既发送也接收LLDP 帧
- Tx:只发送不接收LLDP 帧
- Rx:只接收不发送LLDP 帧
- Disable:既不发送也不接收
一般设置LLDP工作在TxRx模式。
CentOS 7的RPM下载: http://mirror.centos.org/centos/7/os/x86_64/Packages/lldpad-1.0.1-5.git036e314.el7.x86_64.rpm
[Mon Mar 04 14:29:09 root@localhost ~ ]# rpm -ivh lldpad-1.0.1-5.git036e314.el7.x86_64.rpm warning: lldpad-1.0.1-5.git036e314.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:lldpad-1.0.1-5.git036e314.el7 ################################# [100%] systemctl start lldpad.service # 启动lldp
Lldptool使用
EXAMPLES Configure LLDP adminStatus to Receive and Transmit for interface eth2 # 配置LLDP状态 lldptool -L -i eth2 adminStatus=rxtx lldptool set-lldp -i eth2 adminStatus=rxtx Query the LLDP adminStatus for interface eth3 # 查询网口eth3的LLDP状态 lldptool -l -i eth3 adminStatus lldptool get-lldp -i eth3 adminStatus Query the LLDP statistics for interface eth3 # 查询网口ens3的统计信息 lldptool -S -i eth3 adminStatus lldptool stats -i eth3 adminStatus Query the local TLVs which are being transmitted for a given interface: # 查询本地 lldptool -t -i eth3 lldptool get-tlv -i eth3 Query the received neighbor TLVs received on a given interface: #查询给定接口上收到的接收邻居TLV lldptool -t -n -i eth3 lldptool get-tlv -n -i eth3 Query the value of the System Description TLV as received from the neighbor on a given inter‐ # 查询指定接口从邻居接收到的System Description TLV的值 face: lldptool -t -n -i eth3 -V sysDesc lldptool get-tlv -n -i eth3 -V 6 Disable transmit of the IEEE 802.3 MAC/PHY Configuration Status TLV for a given interface: # 关闭指定接口的IEEE 802.3 MAC/PHY配置状态TLV的发送: lldptool -T -i eth3 -V macPhyCfg enableTx=no lldptool set-tlv -i eth3 -V 0x120f01 enableTx=no Query value of the transmit setting for the Port Description TLV for a given interface: # 查询指定接口的端口描述TLV的发送设置值: lldptool -t -i eth3 -V portDesc -c enableTx lldptool get-tlv -i eth3 -V 4 -c enableTx Set a Management Address TLV on eth3 to carry IPv4 address 192.168.10.10 # 在eth3上配置管理地址TLV,携带IPv4地址192.168.10.10 lldptool -T -i eth3 -V mngAddr ipv4=192.168.10.10 Set a Management Address TLV on eth3 to carry IPv6 address ::192.168.10.10 # 在eth3上配置管理地址TLV,携带IPv6地址::192.168.10.10 lldptool -T -i eth3 -V mngAddr ipv6=::192.168.10.10 Get the configured IPv4 address for the Management Address TLV on eth3 # 获取eth3上的Management address TLV配置的IPv4地址 lldptool -t -i eth3 -V mngAddr -c ipv4 Get all configured attributes for the Management Address TLV on eth3 # 获取eth3上管理地址TLV的所有配置属性 lldptool -t -i eth3 -V mngAddr -c Enable transmit of the Edge Virtual Bridging TLV for interface eth4 # 使能接口eth4的边缘虚桥TLV发送 lldptool -i eth4 -T -g ncb -V evbCfg enableTx=yes Enable transmit of VDP for interface eth4 # 使能接口eth4的VDP传输 lldptool -i eth4 -T -V vdp enableTx=yes Display process identifier of lldpad # 显示lldpad进程标识符 lldptool -p
标签:LLDP,adminStatus,TLV,lldptool,命令,Linux,interface,eth3 From: https://www.cnblogs.com/HByang/p/18121685