#show run int fa1/47
interface FastEthernet1/47
description Data&Voice
switchport access vlan 1
switchport mode access
switchport voice vlan 2
end
#show int status module 1 | in Fa1/47
Port Name Status Vlan Duplex Speed Type
Fa1/47 Data&Voice notconnect 1 full 100 10/100BaseTX
show interface status命令仅显示访问VLAN,而不显示语音VLAN。对命令的建议是否有建议,以专门显示分配给交换机端口的语音VLAN,而无需使用过多的正则表达式或查找正在运行的配置?
#1 楼
首先,请注意:我不确定为什么要指定以下内容(强调我的意思),关于命令的任何建议,这些命令要专门显示分配给交换机端口的语音VLAN,而无需使用
,通过
alias
命令可以缩短Cisco设备中最长的reg-ex命令。实际上,我经常使用的别名之一就是显示您要查找的确切信息。现在,我将在下面进行介绍。现在,有几种方法可以获取您要查找的信息,这取决于您确切地知道什么以及您想要做什么。查找。
如果您知道该特定交换机上的语音VLAN,并且正在寻找分配给它们的端口,则只需发出以下命令:
show vlan id <voice-vlan-number>
这将为您提供使用该VLAN的所有端口的列表:
ATR4506-A1A-1#show vlan id 210
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
210 ATRIUM-IP-PHONES active Gi2/2, Gi2/3, Gi2/4, Gi2/5, Gi2/6,
如果您知道感兴趣的端口(或想要查看所有端口),并且只想查看该端口上正在使用哪个语音VLAN,则需要查找以下内容:
show interfaces switchport | include Name|Voice
我将此命令别名为
svv
(用于显示语音VLAN),如下所示:conf t
alias exec svv show interfaces switchport | include Name|Voice
这是我最常使用的命令收集此信息,然后输出:
ATR4506-A1A-1#svv
Name: Te1/1
Voice VLAN: none
Name: Te1/2
Voice VLAN: none
Name: Gi2/2
Voice VLAN: 210 (ATRIUM-IP-PHONES)
Name: Gi2/3
Voice VLAN: 210 (ATRIUM-IP-PHONES)
Name: Gi2/4
Voice VLAN: 210 (ATRIUM-IP-PHONES)
Name: Gi2/5
Voice VLAN: 210 (ATRIUM-IP-PHONES)
另一种选择是过滤
show run
如果需要确切的接口名称和切换端口信息(例如,出于脚本目的),则输出:show running-config | include interface GigabitEthernet|switchport voice vlan
这给出:
ATR4506-A1A-1#show running-config | include interface GigabitEthernet|switchport voice vlan
interface GigabitEthernet1/3
interface GigabitEthernet1/4
interface GigabitEthernet1/5
interface GigabitEthernet1/6
interface GigabitEthernet2/1
interface GigabitEthernet2/2
switchport voice vlan 210
interface GigabitEthernet2/3
switchport voice vlan 210
#2 楼
show interfaces <interface> switchport
或show interfaces <interface> switchport | i Voice
会为您提供所需的东西。Switch# show interfaces gigabitethernet0/1 switchport
Name: Gi0/1
Switchport: Enabled
Administrative Mode: dynamic auto
Operational Mode: static access
Administrative Trunking Encapsulation: negotiate
Operational Trunking Encapsulation: native
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlan host-association:10 (VLAN0010) 502 (VLAN0502)
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
或
Switch# show interfaces gigabitethernet0/1 switchport | i Voice
Voice VLAN: none