在不同的交换机上怎么创建VLAN

2024-11-18 13:49:22
推荐回答(3个)
回答1:

一、 不知道楼主要的配置是CISCO设备还是其它厂商的设备:
以下举例是CISCO设备划分vlan的步骤:
Switch>ena
Switch#conf t
Switch(config)#vlan 2 //建立一个vlan 2
Switch(config-vlan)#name caiwu //将vlan 2命名为caiwu
Switch(config-vlan)#exit
Switch(config)#vlan 3 //建立一个vlan 3
Switch(config-vlan)#name shichangbu //将vlan 3命名为shichangbu
Switch(config-vlan)#exit
Switch(config)#vlan 4 //建立一个vlan 4
Switch(config-vlan)#name yanfabu //将vlan 4命名为yanfabu
Switch(config-vlan)#end
Switch#
Switch#show vlan bri //查看交换机vlan 详细信息

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
2 caiwu active //刚刚建立的vlan 2
3 shichangbu active //刚刚建立的vlan 3
4 yanfabu active //刚刚建立的vlan 4
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
Switch#
Switch(config)#no vlan 2 // 删除vlan 2
Switch(config)#do show vlan bri // 再次查看交换机vlan的详细信息,已经没有vlan 2了。

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
3 shichangbu active
4 yanfabu active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
Switch(config)#

以下举例是华为设备划分vlan的步骤:
sys
[SwA]vlan 1
[SwA-vlan1]vlan 2 //创建vlan2
[SwA-vlan2]port ethernet 0/17 to eth 0/19 eth 0/22 //在vlan2中将第17至19端口,和第22端口加入VLAN2
[SwA-vlan2]vlan 3
[SwA-vlan3]port eth 0/21 //在vlan3中将第21端口加入VLAN3
[SwA-vlan3]inter e0/23
[SwA-Ethernet0/24]port link-type trunk //将第24端口设为trunk口,这个口是与防火墙或者路由器直连的口.
[SwA-Ethernet0/24]port trunk permit vlan vlan1 vlan 2 vlan20 vlan30 vlan40 vlan50 vlan60 在trunk口中加入允许通过的vlan。

以上供楼主参考,希望对楼主有所帮助,谢谢 !

回答2:

这个问题.比较复杂.不同的品牌之间,创建方法不一样.语法也不一样.全部写出来,一本书了.

回答3:

思科的
#vlan 100
#name XXX
#interface fa0/X
#switchport access vlan 100
#no shutdown
依此类推
华为以及H3C的
[SwitchA] vlan 10
[SwitchA-vlan10] port Ethernet 1/0/1
[SwitchA-vlan10] quit
[SwitchA] interface Vlan-interface 10
[SwitchA-Vlan-interface10] ip address 192.168.10.1 24
[SwitchA-Vlan-interface10] quit
[SwitchA] interface Vlan-interface 100
[SwitchA-Vlan-interface100] ip address 192.168.100.1 24
[SwitchA-Vlan-interface100] quit
[SwitchA] interface Vlan-interface 101
其他的厂家基本上和思科的差不多