Basic LLDP configuration example
Network requirements
As shown in Figure 51, enable LLDP globally on Device A and Device B to perform the following tasks:
Monitor the link between Device A and Device B on the NMS.
Monitor the link between Device A and the MED device on the NMS.
Figure 51: Network diagram
Configuration procedure
Configure Device A:
# Enable LLDP globally.
<DeviceA> system-view [DeviceA] lldp global enable
# Enable LLDP on GigabitEthernet 2/1/1. By default, LLDP is enabled on ports.
[DeviceA] interface gigabitethernet 2/1/1 [DeviceA-GigabitEthernet2/1/1] lldp enable
# Set the LLDP operating mode to Rx on GigabitEthernet 2/1/1.
[DeviceA-GigabitEthernet2/1/1] lldp admin-status rx [DeviceA-GigabitEthernet2/1/1] quit
# Enable LLDP on GigabitEthernet 2/1/2. By default, LLDP is enabled on ports.
[DeviceA] interface gigabitethernet2/1/2 [DeviceA-GigabitEthernet2/1/2] lldp enable
# Set the LLDP operating mode to Rx on GigabitEthernet 2/1/2.
[DeviceA-GigabitEthernet2/1/2] lldp admin-status rx [DeviceA-GigabitEthernet2/1/2] quit
Configure Device B:
# Enable LLDP globally.
<DeviceB> system-view [DeviceB] lldp global enable
# Enable LLDP on GigabitEthernet 2/1/1. By default, LLDP is enabled on ports.
[DeviceB] interface gigabitethernet 2/1/1 [DeviceB-GigabitEthernet2/1/1] lldp enable
# Set the LLDP operating mode to Tx on GigabitEthernet 2/1/1.
[DeviceB-GigabitEthernet2/1/1] lldp admin-status tx [DeviceB-GigabitEthernet2/1/1] quit
Verifying the configuration
# Verify the following items:
GigabitEthernet 2/1/1 of Device A connects to a MED device.
GigabitEthernet 2/1/2 of Device A connects to a non-MED device.
Both ports operate in Rx mode, and they can receive LLDP frames but cannot send LLDP frames.
[DeviceA] display lldp status Global status of LLDP: Enable Bridge mode of LLDP: customer-bridge The current number of LLDP neighbors: 2 The current number of CDP neighbors: 0 LLDP neighbor information last changed time: 0 days, 0 hours, 4 minutes, 40 seconds Transmit interval : 30s Fast transmit interval : 1s Transmit credit max : 5 Hold multiplier : 4 Reinit delay : 2s Trap interval : 30s Fast start times : 4 LLDP status information of port 1 [GigabitEthernet2/1/1]: LLDP agent nearest-bridge: Port status of LLDP : Enable Admin status : Rx_Only Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 1 Number of MED neighbors : 1 Number of CDP neighbors : 0 Number of sent optional TLV : 21 Number of received unknown TLV : 0 LLDP agent nearest-customer: Port status of LLDP : Enable Admin status : Disable Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 0 Number of MED neighbors : 0 Number of CDP neighbors : 0 Number of sent optional TLV : 16 Number of received unknown TLV : 0 LLDP status information of port 2 [GigabitEthernet2/1/2]: LLDP agent nearest-bridge: Port status of LLDP : Enable Admin status : Rx_Only Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 1 Number of MED neighbors : 0 Number of CDP neighbors : 0 Number of sent optional TLV : 21 Number of received unknown TLV : 3 LLDP agent nearest-nontpmr: Port status of LLDP : Enable Admin status : Disable Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 0 Number of MED neighbors : 0 Number of CDP neighbors : 0 Number of sent optional TLV : 1 Number of received unknown TLV : 0 LLDP agent nearest-customer: Port status of LLDP : Enable Admin status : Disable Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 0 Number of MED neighbors : 0 Number of CDP neighbors : 0 Number of sent optional TLV : 16 Number of received unknown TLV : 0
# Remove the link between Device A and Device B.
# Verify that GigabitEthernet 2/1/2 of Device A does not connect to any neighboring devices.
[DeviceA] display lldp status Global status of LLDP: Enable The current number of LLDP neighbors: 1 The current number of CDP neighbors: 0 LLDP neighbor information last changed time: 0 days, 0 hours, 5 minutes, 20 seconds Transmit interval : 30s Fast transmit interval : 1s Transmit credit max : 5 Hold multiplier : 4 Reinit delay : 2s Trap interval : 30s Fast start times : 4 LLDP status information of port 1 [GigabitEthernet2/1/1]: LLDP agent nearest-bridge: Port status of LLDP : Enable Admin status : Rx_Only Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 1 Number of MED neighbors : 1 Number of CDP neighbors : 0 Number of sent optional TLV : 0 Number of received unknown TLV : 5 LLDP agent nearest-nontpmr: Port status of LLDP : Enable Admin status : Disable Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 0 Number of MED neighbors : 0 Number of CDP neighbors : 0 Number of sent optional TLV : 1 Number of received unknown TLV : 0 LLDP status information of port 2 [GigabitEthernet2/1/2]: LLDP agent nearest-bridge: Port status of LLDP : Enable Admin status : Rx_Only Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 0 Number of MED neighbors : 0 Number of CDP neighbors : 0 Number of sent optional TLV : 0 Number of received unknown TLV : 0 LLDP agent nearest-nontpmr: Port status of LLDP : Enable Admin status : Disable Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 0 Number of MED neighbors : 0 Number of CDP neighbors : 0 Number of sent optional TLV : 1 Number of received unknown TLV : 0 LLDP agent nearest-customer: Port status of LLDP : Enable Admin status : Disable Trap flag : No MED trap flag : No Polling interval : 0s Number of LLDP neighbors : 0 Number of MED neighbors : 0 Number of CDP neighbors : 0 Number of sent optional TLV : 16 Number of received unknown TLV : 0