VLAN 号VLAN 名 端口号2 Prod Switch 1 2-213 Fina Switch2 2-164 Huma Switch3 2-95 Info Switch3 10-21
【注】之所以把交换 <http://tech.itzero.com/network/switch/index.html>机的VLAN号从"2"号开始,那是因为交换 <http://tech.itzero.com/network/switch/index.html>机有一个默认的VLAN,那就是"1"号VLAN,它包括所有连在该交换 <http://tech.itzero.com/network/switch/index.html>机上的用户。
VLAN的配置过程其实非常简单,只需两步:(1)为各VLAN组命名;(2)把相应的VLAN对应到相应的交换 <http://tech.itzero.com/network/switch/index.html>机端口。 下面是具体的配置过程: 第1步:设置好超级终端,连接上1900交换 <http://tech.itzero.com/network/switch/index.html>机,通过超级终端配置交换 <http://tech.itzero.com/network/switch/index.html>机的VLAN,连接成功后出现如下所示的主配置界面(交换 <http://tech.itzero.com/network/switch/index.html>机在此之前已完成了基本信息的配置):
1 user(s) now active on Management Console. User Interface Menu [M] Menus [K] Command Line [I] IP Configuration Enter Selection:
【注】超级终端是利用Windows系统自带的"超级终端"(Hypertrm)程序进行的,具体参见有关资料。 第2步:单击"K"按键,选择主界面菜单中"[K] Command Line"选项 ,进入如下命令行配置界面:
CLI session with the switch is open. To end the CLI session,enter [Exit ]. >
此时我们进入了交换 <http://tech.itzero.com/network/switch/index.html>机的普通用户模式,就象路由 <http://tech.itzero.com/network/router/index.html> 器一样,这种模式只能查看现在的配置,不能更改配置,并且能够使用的命令很有限。所以我们必须进入"特权模式"。第3步:在上一步">"提示符下输入进入特权模式命令"enable",进入特权模式,命令格式为">enable",此时就进入了交换 <http://tech.itzero.com/network/switch/index.html>机配置的特权模式提示符:
#c onfig t Enter configuration commands,one per line.End with CNTL/Z (config)#
第4步:为了安全和方便起见,我们分别给这3个Catalyst 1900交换 <http://tech.itzero.com/network/switch/index.html>机起个名字,并且设置特权模式的登陆密码。下面仅以Switch1为例进行介绍。配置代码如下:
(config)#hostname Switch1 Switch1(config)# enable password level 15 XXXXXX Switch1(config)#
【注】特权模式密码必须是4~8位字符这,要注意,这里所输入的密码是以明文形式直接显示的,要注意保密。交换 <http://tech.itzero.com/network/switch/index.html>机用 level 级别的大小来决定密码的权限。Level 1 是进入命令行界面的密码,也就是说,设置了 level 1 的密码后,你下次连上交换 <http://tech.itzero.com/network/switch/index.html>机,并输入 K 后,就会让你输入密码,这个密码就是 level 1 设置的密码。而 level 15 是你输入了"enable"命令后让你输入的特权模式密码。 第5步:设置VLAN名称。因四个VLAN分属于不同的交换 <http://tech.itzero.com/network/switch/index.html>机,VLAN命名的命令为" vlan vlan号 name vlan名称 ,在Switch1、Switch2、Switch3、交换 <http://tech.itzero.com/network/switch/index.html>机上配置2、3、4、5号VLAN的代码为:
Switch1 (config)#vlan 2 name Prod Switch2 (config)#vlan 3 name Fina Switch3 (config)#vlan 4 name Huma Switch3 (config)#vlan 5 name Info
【注】以上配置是按表1规则进行的。
第6步:上一步我们对各交换机配置了VLAN组,现在要把这些VLAN对应于表1所规定的交换 <http://tech.itzero.com/network/switch/index.html> 机端口号。对应端口号的命令是"vlan- membership static/ dynamic VLAN号 "。在这个命令中"static"(静态)和"dynamic"(动态)分配方式两者必须选择一个,不过通常都是选择"static"(静态)方式。 VLAN端口号应用配置如下: (1). 名为"Switch1"的交换 <http://tech.itzero.com/network/switch/index.html>机的VLAN端口号配置如下:
Switch1(config)#int e0/2 Switch1(config-if)#vlan-membership static 2 Switch1(config-if)#int e0/3 Switch1(config-if)#vlan-membership static 2 Switch1(config-if)#int e0/4 Switch1(config-if)#vlan-membership static 2 …… Switch1(config-if)#int e0/20 Switch(config-if)#vlan-membership static 2 Switch1(config-if)#int e0/21 Switch1(config-if)#vlan-membership static 2 Switch1(config-if)#
【注】"int"是"nterface"命令缩写,是接口的意思。"e0/3"是"ethernet 0/2"的缩写,代表交换 <http://tech.itzero.com/network/switch/index.html>机的0号模块2号端口。 (2). 名为"Switch2"的交换 <http://tech.itzero.com/network/switch/index.html>机的VLAN端口号配置如下:
Switch2(config)#int e0/2 Switch2(config-if)#vlan-membership static 3 Switch2(config-if)#int e0/3 Switch2(config-if)#vlan-membership static 3 Switch2(config-if)#int e0/4 Switch2(config-if)#vlan-membership static 3 …… Switch2(config-if)#int e0/15 Switch2(config-if)#vlan-membership static 3 Switch2(config-if)#int e0/16 Switch2(config-if)#vlan-membership static 3 Switch2(config-if)#
(3). 名为"Switch3"的交换 <http://tech.itzero.com/network/switch/index.html>机的VLAN端口号配置如下(它包括两个VLAN组的配置),先看VLAN 4(Huma)的配置代码:
Switch3(config)#int e0/2 Switch3(config-if)#vlan-membership static 4 Switch3(config-if)#int e0/3 Switch3(config-if)#vlan-membership static 4 Switch3(config-if)#int e0/4 Switch3(config-if)#vlan-membership static 4 …… Switch3(config-if)#int e0/8 Switch3(config-if)#vlan-membership static 4 Switch3(config-if)#int e0/9 Switch3(config-if)#vlan-membership static 4 Switch3(config-if)#
下面是VLAN5(Info)的配置代码:
Switch3(config)#int e0/10 Switch3(config-if)#vlan-membership static 5 Switch3(config-if)#int e0/11 Switch3(config-if)#vlan-membership static 5 Switch3(config-if)#int e0/12 Switch3(config-if)#vlan-membership static 5 …… Switch3(config-if)#int e0/20 Switch3(config-if)#vlan-membership static 5 Switch3(config-if)#int e0/21 Switch3(config-if)#vlan-membership static 5 Switch3(config-if)#
好了,我们已经按表1要求把VLAN都定义到了相应交换 <http://tech.itzero.com/network/switch/index.html>机的端口上了。为了验证我们的配置,可以在特权模式使用"show vlan"命令显示出刚才所做的配置,检查一下是否正确。 以上是就Cisco Catalyst 1900交换 <http://tech.itzero.com/network/switch/index.html>机的VLAN配置进行介绍了,其它交换 <http://tech.itzero.com/network/switch/index.html>机的VLAN配置方法基本类似,参照有关交换 <http://tech.itzero.com/network/switch/index.html>机说明书即可。
责任编辑:小草