本节介绍如何在Catalyst交换机上配置LLDP和LLDTP-MED协议。主要内容包括: n 默认LLDP配置 n 配置LLDP特性 n 全局禁用和启用LLDP n 在接口上禁用和启用LLDP n 配置LLDP-MED TVL 1. 默认LLDP配置表4-33显示了Catalyst交换机上的默认LLDP配置。要改变这些默认配置,可以使用LLDP全局配置和LLDP接口配置命令,具体将在本节后面介绍。 表4-33 默认LLDP配置 | | LLDP global state(LLDP全局状态) | | LLDP holdtime (before discarding)(LLDP信息丢弃前的持有时间) | | LLDP timer (packet update frequency) (LLDP信息发送频次) | | LLDP reinitialization delay (LLDP初始化延时) | | LLDP tlv-select(LLDP的TLV选择) | | LLDP interface state(LLDP接口状态) | | | | | | LLDP med-tlv-select (LLDP-MED 的TLV选择) | | 2. 配置LLDP特性你可以配置LLDP信息更新频次、在丢弃前LLDP信息持有的时长,初始化延时。你也可以选择可以接收和发送的LLDP和LLDP-MED TLV。 自特权模式开始,按照表4-34所示步骤来配置LLDP各项主要特性。同甘共苦样Step 2~Step 5是可选项属性配置,先后顺序没有固定,可根据习好任意选择。 表4-34 LLDP特性配置步骤 | | | | Switch#configure terminal | | | Switch(config)#lldp holdtime seconds | (可选)指定接收设备在接收到你的设备发送的LLDP信息后,在丢弃前持有的时间长度。取值范围为0~65535秒,默认为120秒。 | | Switch(config)#lldp reinit | (可选)指定所有接口上初始化LLDP延时。取值范围为2~5秒,默认2秒。 | | Switch(config)#lldp timer seconds | (可选)设置LLDP信息更新频次。取值范围是5~65534秒,默认为30秒。 | | Switch(config)#lldp tlv-select | | | Switch(config)#lldp med-tlv-select | (可选)指定可以接收和发送的LLDP-MED TLV。 | | | | | Switch#copy running-config startup-config | |
使用“no”格式LLDP命令可以恢复到默认设置。 以下是一个显示如何配置LLDP特性的示例。 Switch# configure terminal Switch(config)# lldp holdtime 120 Switch(config)# lldp reinit 2 Switch(config)# lldp timer 30 Switch(config)# end
以下示例显示的是如何仅传送(不接收)LLDP包。 switch# configure terminal siwtch(config)# no lldp receive switch(config)# end
如果想要恢复接收LLDP包,则可按以下步骤进行: switch# configure terminal siwtch(config)# lldp receive switch(config)# end
3. 全局禁用或者启用LLDP默认LLDP是全局禁用的。从特权模式开始,按照表4-35所示步骤来全局禁用LLDP。 表4-35 全局禁用LLDP的步骤 | | | | Switch# configure terminal | | | Switch(config)#no lldp run | | | | |
从特权模式开始,按照表4-36所示步骤来启用已全局禁用的LLDP。 表4-36 全局启用LLDP的步骤 | | | | Switch#configure terminal | | | | | | | |
以下示例显示了如何在交换机上全局禁用LLDP。 Switch# configure terminal Switch(config)# no lldp run Switch(config)# end
以下示例显示如何在交换机上全局启用已禁止的LLDP协议。 Switch# configure terminal Switch(config)# lldp run Switch(config)# end
4. 在接口上禁用和启用LLDP默认情况下,在所有支持LLDP的接口上都是禁止接收和发送LLDP信息的。可以自特权模式开始,按照表4-37所示步骤在具体接口上禁用LLDP。 【说明】如果接口是配置的隧道端口,LLDP则是自动禁止的。 表4-37 在接口上禁用LLDP的步骤 | | | | Switch#configure terminal | | | Switch(config)#interface interface-id | | | Switch(config)#no lldp transmit | | | Switch(config)#no lldp receive | | | | | | Switch#copy running-config startup-config | |
自特权模式开始,按照表4-38所示步骤启用已禁用LLDP接口上的LLDP。 表4-38 在接口上启用LLDP的步骤 | | | | Switch#configure terminal | | | Switch(config)#interface interface-id | | | Switch(config)#lldp transmit | | | Switch(config)#lldp receive | | | | | | Switch#copy running-config startup-config | |
以下示例显示了如何在接口GigabitEthernet1/0/1上双向启用LLDP。 Switch# configure terminal Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# lldp transmit Switch(config-if)# lldp receive Switch(config-if)# end
5. 配置LLDP-MED TLV默认情况下,交换机仅发送LLDP数据包,直接它从终端设备上接收到LLDP-MED数据包。这时它与发送LLDP数据包一样也可以发送LLDP-MED数据包了。使用LLDP接口配置命令可以配置接口不要发送如表4-39所示的TLV。 表4-39 LLDP接口不发送的TLV包 | | inventory-management (清单管理) | | | | | | | |
自特权模式开始,按照表4-40所示步骤来在接口上禁止TLV。 表4-40 禁止TVL包发送的步骤 | | | | Switch#configure terminal | | | Switch(config)#interface interface-id | 指定要配置LLDP-MED TLV包的接口,并进入接口配置模式 | | Switch(config)#no lldp med-tlv-select tlv | | | | | | Switch#copy running-config startup-config | |
自特权模式开始,按照4-41所示步骤来在接口上启用TLV。 表4-41 启用TLV包发送的步骤 | | | | Switch#configure terminal | | | Switch(config)#interface interface-id | 指定要配置LLDP-MED TLV包的接口,并进入接口中配置模式 | | Switch(config)#lldp med-tlv-select tlv | | | | | | Switch#copy running-config startup-config | |
以下示例显示了如何在已禁用TLV包发送的GigabitEthernet1/0/1接口上启用TLV发送。 Switch# configure terminal Switch(config)# interface GigabitEthernet1/0/1 Switch(config-if)# lldp med-tlv-select inventory-management Switch(config-if)# end
|