拓扑是我官方下载的,内容是我亲手试验的记录,希望大家可以参考----cisco2960交换机
一执行交换机上的基本配置任务 ___重点理解本征vlan,管理vlan
-----创建 VLAN
-----分配交换机端口到 VLAN switchport access vlan number
-----添加、移动和更改端口
-----检验 VLAN 配置 s2#show vlan id 20
-----对交换机间连接启用中继
1 switchport mode trunk
2 switchport trunk native vlan 99
-----检验中继配置 show inter trunk
-----保存 VLAN 配置配置vlan
1 在三个交换机上类似设置
S1(config)#vlan 10
S1(config-vlan)#name staff
S1(config-vlan)#vlan 20
S1(config-vlan)#name students
S1(config-vlan)#vlan 30
S1(config-vlan)#name guest
S1(config-vlan)#vlan 99
S1(config-vlan)#name management
S1(config-vlan)#end
2 给端口分配vlan------注意range命令的端口之间应该有破折号
Switch(config)#inter range f0/6 - 10
Switch(config-if-range)# switchport access vlan 30
Switch(config-if-range)#inter range f0/11 - 17
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)#inter range f0/18 - 24
Switch(config-if-range)# switchport access vlan 20
Switch(config-if-range)#end
3 检查是否已经分配成功
Switch#show vlan id 10
4 管理VLAN
管理VLAN配置用于访问vlan功能的vlan
S1(config)#interface vlan 99
S1(config-if)#ip address 172.17.99.11 255.255.255.0
S1(config-if)#no shutdown
S2(config)#interface vlan 99
S2(config-if)#ip address 172.17.99.12 255.255.255.0
S2(config-if)#no shutdown
S3(config)#interface vlan 99
S3(config-if)#ip address 172.17.99.13 255.255.255.0
S3(config-if)#no shutdown
二 为中继端口配置中继和本征vlan。默认情况下中继端口属于所有vlan,接入端口仅属于一个vlan。注意native vlan 是用于trunk 口. 在access口没有native vlan的概念.
------ s1(config)#inter range f0/1 - 5
s1(config-if-range)#switchport mode trunk
s1(config-if-range)#switchport trunk native vlan 99
s1(config-if-range)#no shut
-------s1#show inter trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 99
Fa0/2 on 802.1q trunking 99
Port Vlans allowed on trunk
Fa0/1 1-1005
Fa0/2 1-1005
Port Vlans allowed and active in management domain
Fa0/1 1,10,20,30,99,1002,1003,1004,1005
Fa0/2 1,10,20,30,99,1002,1003,1004,1005
Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 1,10,20,30,99,1002,1003,1004,1005
Fa0/2 1,10,20,30,99,1002,1003,1004,1005
三 检验
----1 在三个交换机上ping管理地址均能成功
----2 仅有属于同一vlan的pc才能ping通
s2# show inter trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 99
Port Vlans allowed on trunk
Fa0/1 1-1005
Port Vlans allowed and active in management domain
Fa0/1 1,10,20,30,99,1002,1003,1004,1005
Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 1,10,20,30,99,1002,1003,1004,1005