1.进入特权模式:
Switch>enable  进入特权模式
Switch# 
2.进入全配置模式:
Switch#configure terminal   
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#
3.  修改交换机的名称为s2:
Switch(config)#hostname s2  
s2(config)#
s2(config)#exit  退出此模式
4. 设置交换机enable密码:
s2(config)#enable password 123456    设置明文密码为:123456
s2(config)#enable secret 123                  设置密文密码为:123
注:密文密码的优先级高于明文密码,同时设定密文生效
 5.进入line的配置 模式:
s2(config)#line console 0     进入console口的配置  
s2(config-line)#  
s2(config)#exit  退出此模式
6.设置交换机console密码:
s2(config-line)#password 123  给console口设置密码为:123
s2(config-line)#login         激活设置的密码
s2(config)#exit  退出此模式
7.进入接口配置模式:
s2(config)#interface f0/24                         进入端口(f0/24)
s2(config-if)#
s2(config)#exit  退出此模式
8.创建vlan:
1).在vlan数据库模式下创建:
s2#vlan database        进入vlan数据库
s2(vlan)#vlan 40 name jishu   创建名为:技术的vlan
VLAN 40 modified:
    Name: jishu               表示成功创建vlan 40名为jishu
s2(vlan)#no vlan 40 name jishu   删除名为:技术的vlan 40
s2(vlan)#exit               保存并退出vlan数据库模式
2).在全局配置模式下创建:
Switch(config)# vlan 10   创建vlan 10
Switch(config)# no vlan 10   删除vlan 10
9.配置trunk接口:
s2(config)#interface f0/24                         进入要设置的端口(f0/24)
s2(config-if)#switchport mode trunk                将端口进行trunk设置
s2(config-if)#no shutdown          激活此端口
switchport mode trunk                将端口进行trunk设置
注:trunk为了实现不同交换机的同一vlan相互通信
10.为交换机设置网关:
s2(config)#ip default-gateway 192.168.1.1  设置网关(注:网关的ip必须和路由器的内接口一致)
11. 保存配置
s2#copy running-config startup-config    将配置保存与wr效果一样!
Destination filename [startup-config]?
Building configuration...
[OK]  表示已经保存