下面是小编为大家整理的北电8600交换机VLAN配置命令(共含7篇),仅供大家参考借鉴,希望大家喜欢!同时,但愿您也能像本文投稿人“木木叔叔”一样,积极向本站投稿分享好文章。
北电8600交换机VLAN配置命令
ERS-8610:5# config vlan 2 ports add 1/17-1/20
ERS-8610:5# config vlan 10 ports remove 1/17
config vlan 2 ip delete 172.16.1.1
Passport-8600/Config/vlan/100# create byport 1
Passport-8600/Config/vlan/100# name “vlan blue”
Passport-8600/Config/vlan/100# ports add 1/1-1/4,2/1-2/4
Passport-8600/Config/vlan/100# ip create 200.10.10.1/24
Passport-8600/Config/vlan/100#
交换机基本状态:
hostname>/用户模式
hostname#/特权模式
hostname(config)#/全局配置模式
hostname(config-if)#/接口状态
交换机口令设置:
switch>enable/进入特权模式
switch#configterminal/进入全局配置模式
switch(config)#hostname/设置交换机的主机名
switch(config)#enablesecretxxx/设置特权加密口令
switch(config)#enablepasswordxxa/设置特权非密口令
switch(config)#lineconsole0/进入控制台口
switch(config-line)#linevty04/进入虚拟终端
switch(config-line)#login/允许登录
switch(config-line)#passwordxx/设置登录口令xx
switch#exit/返回命令
交换机VLAN设置:
switch#vlandatabase/进入VLAN设置
switch(vlan)#vlan2/建VLAN
2switch(vlan)#novlan2/删vlan
2switch(config)#intf0/1/进入端口1
switch(config-if)#switchportaccessvlan2/当前端口加入
vlan2switch(config-if)#switchportmodetrunk/设置为干线
switch(config-if)#switchporttrunkallowedvlan1,2/设置允许的
vlanswitch(config-if)#switchporttrunkencapdot1q/设置vlan中继
switch(config)#vtpdomain/设置发vtp域名
switch(config)#vtppassword/设置发vtp密码
switch(config)#vtpmodeserver/设置发vtp模式
switch(config)#vtpmodeclient/设置发vtp模式
交换机设置IP地址:
switch(config)#interfacevlan1;进入vlan1
switch(config-if)#ipaddress;设置IP地址
switch(config)#ipdefault-gateway;设置默认网关
switch#dirflash:;查看闪存
交换机显示命令:
switch#write/保存配置信息
switch#showvtp/查看vtp配置信息
switch#showrun/查看当前配置信息
switch#showvlan/查看vlan配置信息
switch#showinterface/查看端口信息
switch#showintf0/0/查看指定端口信息
补充:3层交换机多出的就是路由能力,体现在vlan的互相通信功能和端口的路由能力
下面介绍:
开启路由功能:iprouting进入vlan配置网段网关与路由配置接口相同
interfacevlan1ip192.168.1.1255.255.255.0
路由配置与路由器配置相同只是把接口换为VLAN+VLAN号,开启接口路由功能,进入接口配置:noswichport
1:配置VLAN
理解VLAN: 一个VLAN就是一个交换网,其逻辑上按功能、项目、应用来分而不必考虑用户的物理位置,任何交换口都可以属于某一VLAN, IP包、广播包及组播包均可以发送或广播给在此VLAN内的最终用户。每一个VLAN均可看成是一个逻辑网络,发往另一VLAN的数据包必须由路由器或网桥转发,由于VLAN被看成是一个逻辑网络,其具有自己的网桥管理信息库 (MIB) 并可支持自己的生成树
在Cisco交换机里面有两种配置Vlan的方法:
Switch#configure terminal
Switch(config)#vlan 20
Switch(config-vlan)#name test20
Switch(config-vlan)#end
也可以在enable状态下,进行VLAN配置:
Switch#vlan database
Switch(vlan)#vlan 20 name test20
Switch(vlan)#exit
删除VLAN
当删除一个处于VTP服务器的交换机上删除VLAN时,则此VLAN将在所有相同VTP的交换机上删除。当在透明模式下删除时,只在当前交换机上删除,用vlan database进入VLAN配置状态,用no vlanvlan-id来删除。
Switch#vlan database
Switch(vlan)# novlan 20
Switch(vlan)#exit
将端口分配给一个VLAN
Switch#configure terminal
Switch(config)#interface fastethernet0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 2
Switch(config-if)#end
2:配置VLAN Trunks
所谓的TRUNK是用来在不同的交换机之间进行连接,以保证在跨越多个交换机上建立的同一个VLAN的成员能够相互通讯,如果是不同台的交换机上相同id的vlan要相互通信,那么可以通过共享的trunk端口就可以实现,如果是不同台不同id的vlan它们之间要相互通信,需要通过第三方的路由来实现.
Switch#configure terminal
Switch(config)#interface fastetherne2/4
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#end
定义trunk允许的VLAN
缺省情况下trunk允许所有的VLAN通过,可以使用 switchport trunk allowed vlan removevlan-list来去掉某一VLAN
Switch(config)#interface fastethernet2/4
Switch(config-if)#switchport trunk allowed vlan remove 2
Switch(config-if)#end
3:使用STP实现负载均衡
负载均衡可以使用流量分流到其它平行的trunks上去. 交换机为了避免环路,STP通常是阻断所有端口交换机之间只留一条链路,使用负载均衡后, 可以把不同VLAN的流量分配到不同的trunk上,
可以通过配置STP端口权值STP路径值来实现负载均衡,如果使用STP端口权值来配置那么二条负载均衡的trunk必须联同一交换机上;使用路径值则即可以联相同的交换机与可以联不同的交换机。
使用STP端口权值的负载均衡当同一台交换机的二个口形成环路时, STP端口权值用来决定那个口是enable的,那个口是阻断的。 可以通过配置端口权值来决定二对trunk各走那些VLAN, 有较高权值的端口(数字较小的)vlan, 将处于转发状态,同一个VLAN在另一个trunk有较低的权值(数字较大)则将处在阻断状态,即同一VLAN只在一个trunk上发送接受。
SW1:
添加VLAN
SW1#vlan database
SW1(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
SW1(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
SW1(vlan)#vlan 30
VLAN 30 added:
Name: VLAN0030
SW1(vlan)#vlan 40
VLAN 40 added:
Name: VLAN0040
SW1(vlan)#vlan 50
VLAN 50 added:
Name: VLAN0050
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#show vlan-sw brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, 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
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active
40 VLAN0040 active
50 VLAN0050 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
设置中继并配置以太通道捆绑
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#interface range fastethernet0/1 - 4
SW1(config-if-range)#switchport mode trunk
*Mar 1 01:12:29.463: %DTP-5-TRUNKPORTON: Port Fa0/1-4 has become dot1q trunk
SW1(config-if-range)#switchport trunk encapsulation dot1q
SW1(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel1
SW1(config-if-range)#
*Mar 1 01:12:45.775: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1
*Mar 1 01:12:45.991: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po1
*Mar 1 01:12:46.159: %EC-5-BUNDLE: Interface Fa0/3 joined port-channel Po1
*Mar 1 01:12:46.339: %EC-5-BUNDLE: Interface Fa0/4 joined port-channel Po1
*Mar 1 01:12:48.487: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
SW1(config-if-range)#int range f0/5 - 8
SW1(config-if-range)#switchport mode trunk
*Mar 1 01:13:15.699: %DTP-5-TRUNKPORTON: Port Fa0/5-8 has become dot1q trunk
SW1(config-if-range)#switchport trunk encapsulation dot1q
SW1(config-if-range)#channel-group 2 mode on
Creating a port-channel interface Port-channel2
SW1(config-if-range)#
*Mar 1 01:13:22.123: %EC-5-BUNDLE: Interface Fa0/5 joined port-channel Po2
*Mar 1 01:13:22.411: %EC-5-BUNDLE: Interface Fa0/6 joined port-channel Po2
*Mar 1 01:13:22.591: %EC-5-BUNDLE: Interface Fa0/7 joined port-channel Po2
*Mar 1 01:13:22.795: %EC-5-BUNDLE: Interface Fa0/8 joined port-channel Po2
SW1(config-if-range)#
*Mar 1 01:13:24.831: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel2, changed state to up
SW1(config-if-range)#end
SW1#show etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
R - Layer3 S - Layer2
U - in use
Group Port-channel Ports
-----+------------+-----------------------------------------------------------
1 Po1(SU) Fa0/1(P) Fa0/2(P) Fa0/3(P) Fa0/4(P)
2 Po2(SU) Fa0/5(P) Fa0/6(P) Fa0/7(P) Fa0/8(P)
配置VTP域:
SW1#vlan database
SW1(vlan)#vtp server
Device mode already VTP SERVER.
SW1(vlan)#vtp domain TK
Changing VTP domain name from NULL to TK
SW1(vlan)#vtp password cisco
Setting device VLAN database password to cisco.
SW1(vlan)#vtp pruning
Pruning switched ON
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 256
Number of existing VLANs : 10
VTP Operating Mode : Server
VTP Domain Name : TK
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xAA 0x90 0x65 0x7A 0x72 0x0C 0x31 0x6A
Configuration last modified by 0.0.0.0 at 3-1-02 01:15:38
Local updater ID is 0.0.0.0 (no valid interface found)
配置以太通道不承载vlan 40和vlan50的流量:
SW1(config)#int range f0/1 - 4
SW1(config-if-range)#switchport trunk allowed vlan remove 40
SW1(config-if-range)#switchport trunk allowed vlan remove 50
SW1#show int f0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: down (suspended member of bundle Po1)
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: 1-39,41-49,51-1005
Trunking VLANs Active: none
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#int range f0/5 - 8
SW1(config-if-range)#switchport trunk allowed vlan remove 40
SW1(config-if-range)#switchport trunk allowed vlan remove 50
SW1(config-if-range)#end
SW1#show int f0/5 switchport
Name: Fa0/5
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: down (suspended member of bundle Po2)
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: 1-39,41-49,51-1005
Trunking VLANs Active: none
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
SW2:
设置中继并配置以太通道捆绑:
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#int range f0/1 - 4
SW2(config-if-range)#switchport mode trunk
*Mar 1 01:16:14.267: %DTP-5-TRUNKPORTON: Port Fa0/1-4 has become dot1q trunk
SW2(config-if-range)#switchport trunk encapsulation dot1q
SW2(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel1
SW2(config-if-range)#
*Mar 1 01:16:20.703: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1
*Mar 1 01:16:20.847: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po1
*Mar 1 01:16:20.991: %EC-5-BUNDLE: Interface Fa0/3 joined port-channel Po1
*Mar 1 01:16:21.111: %EC-5-BUNDLE: Interface Fa0/4 joined port-channel Po1
(1). 名为Switch1的交换机的VLAN端口号配置如下:
Switch1(config)#int e0/2Switch1(config-if)#vlan-membership static 2Switch1(config-if)#int e0/3Switch1(config-if)#vlan-membership static 2Switch1(config-if)#int e0/4Switch1(config-if)#vlan-membership static 2……Switch1(config-if)#int e0/20Switch(config-if)#vlan-membership static 3Switch1(config-if)#int e0/21Switch1(config-if)#vlan-membership static 3Switch1(config-if)#
【注】int是nterface命令缩写,是接口的意思,e0/3是ethernet 0/2的缩写,代表交换机的0号模块2号端口。
(2). 名为Switch2的交换机的VLAN端口号配置如下:
Switch2(config)#int e0/2Switch2(config-if)#vlan-membership static 3Switch2(config-if)#int e0/3Switch2(config-if)#vlan-membership static 3Switch2(config-if)#int e0/4Switch2(config-if)#vlan-membership static 3……Switch2(config-if)#int e0/15Switch2(config-if)#vlan-membership static 3Switch2(config-if)#int e0/16Switch2(config-if)#vlan-membership static 3Switch2(config-if)#
(3). 名为Switch3的交换机的VLAN端口号配置如下(它包括两个VLAN组的配置),先看VLAN 4(Huma)的配置代码:
Switch3(config)#int e0/2Switch3(config-if)#vlan-membership static 4Switch3(config-if)#int e0/3Switch3(config-if)#vlan-membership static 4Switch3(config-if)#int e0/4Switch3(config-if)#vlan-membership static 4……Switch3(config-if)#int e0/8Switch3(config-if)#vlan-membership static 4Switch3(config-if)#int e0/9Switch3(config-if)#vlan-membership static 4Switch3(config-if)#下面是VLAN5(Info)的配置代码:Switch3(config)#int e0/10Switch3(config-if)#vlan-membership static 5Switch3(config-if)#int e0/11Switch3(config-if)#vlan-membership static 5Switch3(config-if)#int e0/12Switch3(config-if)#vlan-membership static 5……Switch3(config-if)#int e0/20Switch3(config-if)#vlan-membership static 5Switch3(config-if)#int e0/21Switch3(config-if)#vlan-membership static 5Switch3(config-if)#
我们已经按表1要求把VLAN都定义到了相应交换机的端口上了,
为了验证我们的配置,可以在特权模式使用show vlan命令显示出刚才所做的配置,检查一下是否正确。
以上是就Cisco Catalyst 1900交换机的VLAN配置进行介绍了,其它交换机的VLAN配置方法基本类似,参照有关交换机说明书即可。
之所以把交换机的VLAN号从2号开始,那是因为交换机有一个默认的VLAN,那就是1号VLAN,它包括所有连在该交换机上的用户,
VLAN的配置过程其实非常简单,只需两步:(1)为各VLAN组命名;(2)把相应的VLAN对应到相应的交换机端口。
下面是具体的配置过程:
第1步:设置好超级终端,连接上1900交换机,通过超级终端配置交换机的VLAN,连接成功后出现如下所示的主配置界面(交换机在此之前已完成了基本信息的配置):
1 user(s) now active on Management Console.
User Interface Menu
Menus
Command Line
IP Configuration
Enter Selection:
【注】超级终端是利用Windows系统自带的超级终端(Hypertrm)程序进行的,具体参见有关资料。
第2步:单击K按键,选择主界面菜单中 Command Line选项 ,进入如下命令行配置界面:
CLI session with the switch is open.
To end the CLI session,enter .
此时我们进入了交换机的普通用户模式,就象路由器一样,这种模式只能查看现在的配置,不能更改配置,并且能够使用的命令很有限。所以我们必须进入特权模式。
第3步:在上一步>提示符下输入进入特权模式命令enable,进入特权模式,命令格式为>enable,此时就进入了交换机配置的特权模式提示符:
#config t
Enter configuration commands,one per line.End with CNTL/Z
(config)#
第4步:为了安全和方便起见,我们分别给这3个Catalyst 1900交换机起个名字,并且设置特权模式的登陆密码,
下面仅以Switch1为例进行介绍。配置代码如下:
(config)#hostname Switch1
Switch1(config)# enable password level 15 XXXXXX
Switch1(config)#
【注】特权模式密码必须是4~8位字符这,要注意,这里所输入的密码是以明文形式直接显示的,要注意保密。交换机用 level 级别的大小来决定密码的权限。Level 1 是进入命令行界面的密码,也就是说,设置了 level 1 的密码后,你下次连上交换机,并输入 K 后,就会让你输入密码,这个密码就是 level 1 设置的密码。而 level 15 是你输入了enable命令后让你输入的特权模式密码。
第5步:设置VLAN名称。因四个VLAN分属于不同的交换机,VLAN命名的命令为 vlan 'vlan号'name 'vlan名称',在Switch1、Switch2、Switch3、交换机上配置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所规定的交换机端口号。对应端口号的命令是vlan-membership static/ dynamic' VLAN号'。在这个命令中static(静态)和dynamic(动态)分配方式两者必须选择一个,不过通常都是选择static(静态)方式。VLAN端口号应用配置如下:
交换机串口(Trunk)的作用:
在以太网上通过交换机的串口实现中继可以使用如下两种封装类型:
—IEEE 802.1Q
—ISL(Inter Switch Link, Cisco私有)
配置步骤
第一步:在交换机上添加VLAN
Switch1#vlan database
Switch1(vlan)#vlan 2
Switch1(vlan)#vlan 3
Switch1(vlan)#exit
第二步:将接口添加到相应的VLAN中
Switch1#config terminal
Switch1(config)#interface fastEthernet 0/1
Switch1(config-if-range)#switchport access vlan 2
Switch1(config)#interface fastEthernet 0/2
Switch1(config-if-range)#switchport access vlan 3
第三步:配置交换机之间互联的端口为串口(Trunk)
Switch1(config)#interface f0/15
Switch1(config-if-range)#switchport mode trunk
相关其他命令www.dnzg.cn
去除VLAN:
Switch(config-if)#switchport trunk allowed vlan removevlan-list
添加VLAN:
Switch(config-if)#switchport trunk allowed vlan add vlan-list
查看端口状态:
Switch#show interface f0/15switchport
检查中继端口允许VLAN的列表:
Switch#show interface interface-id switchport
查看VLAN信息:
Switch#show vlan brief