vlan配置命令
# 为VLAN10 指定一个描述字符串“connect to LAB1”。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] vlan 10
[Sysname-vlan10] description connect to LAB1
# 为Vlan-interface1 接口指定一个描述字符串“gateway of LAB1”
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface Vlan-interface 1
[Sysname-Vlan-interface1] description gateway of LAB1
# 显示所有已创建的VLAN 接口的相关信息。
<Sysname> display interface Vlan-interface 1
Vlan-interface1 current state :UP
Line protocol current state :UP
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 00e0-fc00-5191
Internet Address is 192.168.0.1/24 Primary
Internet Address is 10.1.1.1/24 Sub
Description : Vlan-interface1 Interface
The Maximum Transmit Unit is 1500
# 显示VLAN1 的信息。
<Sysname> display vlan 1
VLAN ID: 1
VLAN Type: static
Route Interface: configured
IP Address: 192.168.0.39
1-4
Subnet Mask: 255.255.255.0
Description: VLAN 0001
Name: VLAN 0001
Tagged Ports:
GigabitEthernet1/0/1
Untagged Ports:
GigabitEthernet1/0/2
# 为VLAN1 创建对应的VLAN 接口并进入Vlan-interface1 的接口视图。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface Vlan-interface 1
[Sysname-Vlan-interface1]
# 指定VLAN 2 的名称为“test vlan”。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] vlan 2
[Sysname-vlan2] name test vlan
# 关闭Vlan-interface2 接口。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface Vlan-interface 2
[Sysname-Vlan-interface2] shutdown
# 创建VLAN5 并进入VLAN5 的视图。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] vlan 5
[Sysname-vlan5]
# 删除VLAN 5。
[Sysname-vlan5] quit
[Sysname] undo vlan 5
# 创建VLAN 4 到VLAN 100。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] vlan 4 to 100
Please wait............. Done.
# 批量删除VLAN2 到VLAN9,其中VLAN 7 已经被配置为Voice VLAN。
[Sysname] undo vlan 2 to 9
Note:The VLAN kept by protocol, the voice VLAN, the default VLAN, the management VLAN and
the remote probe VLAN will not be deleted!
Please wait... Done.
[Sysname] display vlan
The following VLANs exist:
1(default), 7
以上信息表示,已经被配置为Voice VLAN 的VLAN 无法使用undo vlan 命令直接删除,其他VLAN
已经被正常删除。
# 显示当前系统存在的Hybrid 端口。
<Sysname> display port hybrid
The following hybrid ports exist:
GigabitEthernet1/0/1 GigabitEthernet1/0/2
以上信息表示当前系统有两个Hybrid 端口,分别为GigabitEthernet1/0/1 和GigabitEthernet1/0/2。
# 向VLAN 2 中加入从GigabitEthernet1/0/2 到GigabitEthernet1/0/4 的以太网端口。
1-9
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] vlan 2
[Sysname-vlan2] port GigabitEthernet 1/0/2 to GigabitEthernet 1/0/4
# 将GigabitEthernet1/0/1 端口加入到VLAN3 中。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface GigabitEthernet 1/0/1
[Sysname-GigabitEthernet1/0/1] port access vlan 3
# 将Hybrid 端口GigabitEthernet1/0/1 的缺省VLAN 设为100。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface GigabitEthernet 1/0/1
[Sysname-GigabitEthernet1/0/1] port link-type hybrid
[Sysname-GigabitEthernet1/0/1] port hybrid pvid vlan 100
# 将Hybrid 端口GigabitEthernet1/0/1 加入到VLAN2、VLAN4、VLAN50~VLAN100 中(假设指
定的VLAN 都已经创建),并且设置该端口在发送这些VLAN 的报文时将保留VLAN Tag。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface GigabitEthernet 1/0/1
[Sysname-GigabitEthernet1/0/1] port link-type hybrid
[Sysname-GigabitEthernet1/0/1] port hybrid vlan 2 4 50 to 100 tagged
# 将以太网端口GigabitEthernet1/0/1 设置为Trunk 端口。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface GigabitEthernet 1/0/1
1-12
[Sysname-GigabitEthernet1/0/1] port link-type trunk
# 将Trunk 端口GigabitEthernet1/0/1 加入到VLAN2、VLAN4、VLAN50~VLAN 100 中。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface GigabitEthernet 1/0/1
[Sysname-GigabitEthernet1/0/1] port link-type trunk
[Sysname-GigabitEthernet1/0/1] port trunk permit vlan 2 4 50 to 100
Please wait... Done.
# 将Trunk 端口GigabitEthernet1/0/1 的缺省VLAN 设为100。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface GigabitEthernet 1/0/1
[Sysname-GigabitEthernet1/0/1] port link-type trunk
[Sysname-GigabitEthernet1/0/1] port trunk pvid vlan 100
# 显示端口GigabitEthernet1 /0/1 和GigabitEthernet1/0/2 上所配置的协议信息及协议的索引。
<Sysname> display protocol-vlan interface GigabitEthernet 1/0/1 to GigabitEthernet 1/0/2
Interface: GigabitEthernet1/0/1
VLAN ID Protocol-Index Protocol-type
50 0 ip
80 1 ip
100 0 ip
100 1 ipx ethernetii
Interface: GigabitEthernet1/0/2
VLAN ID Protocol-Index Protocol-type
50 1 ipx raw
80 2 at
100 3 snap etype 0x0abc
100 4 llc dsap 0xac ssap 0xbd
# 显示VLAN10 到VLAN20 上所配置的协议信息及协议的索引。
<Sysname> display protocol-vlan vlan 10 to 20
VLAN ID: 10
VLAN Type: Protocol-based VLAN
Protocol-Index Protocol-Type
0 ip
1 ip
2 ipx ethernetii
3 at
VLAN ID: 15
VLAN Type: Protocol-based VLAN
Protocol-Index Protocol-Type
0 ip
1 snap etype 0x0abcd
# 将GigabitEthernet1/0/1 端口与协议VLAN 3 中索引值为0 到2 的协议模板进行绑定(假设相应
的协议模板已经创建)。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] interface GigabitEthernet 1/0/1
[Sysname-GigabitEthernet1/0/1] port hybrid protocol-vlan vlan 3 0 to 2
# 取消GigabitEthernet1/0/1 端口与协议VLAN3 中索引值为1 到4 之间的协议模板的绑定关系。
[Sysname-GigabitEthernet1/0/1] undo port hybrid protocol-vlan vlan 3 1 to 4
Protocol index 1 does not exist in VLAN 3
Protocol index 4 does not exist in VLAN 3
浙公网安备 33010602011771号