语音 VLAN 信息

网络工程 思科 VLAN 思科-ios 嗓音
2021-07-30 20:21:30

我知道能够显示分配给 cisco 交换机接口的接入 VLAN。具体显示接口分配的语音VLAN怎么样?

#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 而不使用太多正则表达式或通过运行配置查找的命令吗?

2个回答

首先,一个警告:我不知道你为什么指定以下(强调我的),

有什么建议可以专门显示分配给交换机端口的语音 vlan而不使用太多正则表达式或通过运行配置查找的命令吗?

但是,即使 Cisco 设备中最长的 reg-ex 命令也可以通过该alias命令缩短事实上,我经常使用的别名之一就是显示您要查找的确切信息。我将在下面包括。


现在,有多种方法可以获取您要查找的信息,这取决于您确切知道什么以及您要查找什么。

如果您知道该特定交换机上的语音 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

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