以下配置命令在Telnet或Console模式下配置
基于端口VLAN的划分
<H3C>sys //进入配置模式
[H3C]vlan 2 //创建vlan2 (id范围 1-4094)
[H3C-vlan2] description caiwu //给vlan 2取个名字叫caiwu
[H3C-vlan2]port Ethernet 1/0/10 Ethernet 1/0/11 Ethernet 1/0/12 Ethernet 1/0/13 //将1/0/10-13端口一起加入到vlan2中
[H3C-vlan2]save //将配置信息保存
[H3C-vlan2]quit //退出vlan2
[H3C]interface Vlan-interface 2 //进入VLAN2接口模式
[H3C-Vlan-interface2]ip address 192.168.4.1 255.255.255.0 //给vlan 2分配IP地址和子网掩码
[H3C]vlan 2 //创建vlan2 (id范围 1-4094)
[H3C-vlan2] description caiwu //给vlan 2取个名字叫caiwu
[H3C-vlan2]port Ethernet 1/0/10 Ethernet 1/0/11 Ethernet 1/0/12 Ethernet 1/0/13 //将1/0/10-13端口一起加入到vlan2中
[H3C-vlan2]save //将配置信息保存
[H3C-vlan2]quit //退出vlan2
[H3C]interface Vlan-interface 2 //进入VLAN2接口模式
[H3C-Vlan-interface2]ip address 192.168.4.1 255.255.255.0 //给vlan 2分配IP地址和子网掩码
删除一个VLAN
[H3C] undo vlan 2//删除Vlan 2
[H3C] undo port Ethernet 1/0/10 //从Vlan 2中删除 端口Ethernet 1/0/10
[H3C] undo port Ethernet 1/0/10 //从Vlan 2中删除 端口Ethernet 1/0/10
如要删除上边VLAN 2的IP,操作如下
[H3C] interface Vlan-interface 2 //首先进入VLAN2的接口模式
[H3C-Vlan-interface2]undo ip add 192.168.4.1 255.255.255.0 //执行这条命令即可删除VLAN 2上的IP
[H3C-Vlan-interface2]undo ip add 192.168.4.1 255.255.255.0 //执行这条命令即可删除VLAN 2上的IP
配置Trunk允许通过的Vlan
命令
port trunk permit valn {vlan-id-list|all}
undo port trunk permit vlan {vlan-id-list|all}
undo port trunk permit vlan {vlan-id-list|all}
以上命令在进入端口视图中配置
举个栗子
将Trunk端口Ehternet 1/0/1 加入到2、3、4~10 Vlan中
[H3C] interface ehernet1/0/1
[H3C-Ethernet1/0/1] port trunk permit vlan 2 3 4 to 100
[H3C-Ethernet1/0/1] port trunk permit vlan 2 3 4 to 100