赞
踩
实验拓扑
操作步骤
在 SW1 上创建 VLAN10、VLAN20 和 VLAN30。
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]vlan batch 10 20 30
在 SW1上配置接口 GE0/0/1 为 Hybrid 类型,并加入 VLAN10、VLAN20和VLAN30。
#配置接口g0/0/1 加入VLAN10 [sw1]int g0/0/1 [sw1-GigabitEthernet0/0/1]port link-type access [sw1-GigabitEthernet0/0/1]port default vlan 10 [sw1-GigabitEthernet0/0/1]q #配置接口g0/0/2 加入VLAN20 [sw1]int g0/0/2 [sw1-GigabitEthernet0/0/2]port link-type access [sw1-GigabitEthernet0/0/2]port default vlan 20 [sw1-GigabitEthernet0/0/2]q #配置接口g0/0/3 加入VLAN30 [sw1]int g0/0/3 [sw1-GigabitEthernet0/0/3]port link-type access [sw1-GigabitEthernet0/0/3]port default vlan 30 [sw1-GigabitEthernet0/0/3]q #配置接口g0/0/24加入VLAN10以untagged方式加入VLAN10、VLAN20、VLAN30 [sw1]int g0/0/24 [sw1-GigabitEthernet0/0/24]port hybrid untagged vlan 10 20 30 #开启IP子网划分VLAN功能 [sw1-GigabitEthernet0/0/24]ip-subnet-vlan enable [sw1-GigabitEthernet0/0/24]
查看vlan信息确认配置结果是否正确
[sw1]dis vlan The total number of vlans is : 4 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/9(D) GE0/0/10(D) GE0/0/11(D) GE0/0/12(D) GE0/0/13(D) GE0/0/14(D) GE0/0/15(D) GE0/0/16(D) GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D) GE0/0/23(D) GE0/0/24(U) 10 common UT:GE0/0/1(U) GE0/0/24(U) 20 common UT:GE0/0/2(U) GE0/0/24(U) 30 common UT:GE0/0/3(U) GE0/0/24(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 10 enable default enable disable VLAN 0010 20 enable default enable disable VLAN 0020 30 enable default enable disable VLAN 0030 [sw1]
[sw1]vlan 10 [sw1-vlan10]ip-subnet-vlan ip 192.168.10.0 24 [sw1-vlan10]q [sw1]vlan 20 [sw1-vlan20]ip-subnet-vlan ip 192.168.20.0 24 [sw1-vlan20]q [sw1]vlan 30 [sw1-vlan30]ip-subnet-vlan ip 192.168.30.0 24 [sw1-vlan30]dis this # vlan 30 ip-subnet-vlan 1 ip 192.168.30.0 255.255.255.0 #1是组ID # return [sw1-vlan30]q
我们敲的时候是没有1的,这里自动生成一个组ID1,它的范围1-12,也就是说你可以把多个网段绑定到组中。
[sw1]dis ip-subnet-vlan vlan all
----------------------------------------------------------------
Vlan Index IpAddress SubnetMask Priority
----------------------------------------------------------------
10 1 192.168.10.0 255.255.255.0 0
20 1 192.168.20.0 255.255.255.0 0
30 1 192.168.30.0 255.255.255.0 0
----------------------------------------------------------------
ip-subnet-vlan count: 3 total count: 3
[Huawei]sys R1
[R1]un in en
Info: Information center is disabled.
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.10.254 24
[Huawei]sys R2
[R2]un in en
[R2]int g0/0/2
[R2-GigabitEthernet0/0/2]ip add 192.168.20.254 24
[Huawei]sys R3
[R3]un in en
[R3]in g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.30.254 24
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。