vlan 配置思路 (access 、Trunk)
(1)创建Vlan
在基于IOS的交换机上配置静态VLAN:
复制
switch# vlan database switch(vlan)# vlan vlan-num name vlan-name switch(vlan)# exit switch# configure teriminal switch(config)# interface interface module/number switch(config-if)# switchport mode access // 设置端口模式为access模式 switch(config-if)# switchport access vlan vlan-num // 设置端口所属的VLAN switch(config-if)# end
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
核验配置:show vlan
(2)配置干道链路
干道是在两台catalyst交换机端口或catalyst交换机与路由器间的一条点对点链路。 干道链路可以承载多个vlan。
在基于IOS的交换机上配置干道链路
复制
switch(config)# interface interface mod/port switch(config-if)# switchport mode trunk // 设置端口模式为trunk模式 switch(config-if)# switchport trunk encapsulation {isl|dotlq} // 设置trunk所封装的帧 switch(config-if)# switchport trunk allowed vlan remove vlan-list // 允许那些VLAN通过干路 ( 附:switchport trunk allowed vlan {add | all | except | remove} vlan-list )
1.
2.
3.
4.
5.
6.
7.
8.
9.
no switchport
no switchport // 把物理端口变成三层口,即把三层口当成路由器上的口,当将一个端口配置成三层端口之后,就可以在此端口上分配IP地址了,当然还是可以连接PC机的,。 路由口:路由口是指某一物理端口在端口配置状态下用no switchport命令生成的端口,所有的三层都需要IP地址以实现路由交换。
配置举例如下:
复制
Switch# configure terminal Switch(config)# interface gigabitethernet0/2 Switch(config-if)# no switchport Switch(config-if)# ip address 192.20.135.21 255.255.255.0 Switch(config-if)# no shutdown Switch(config-if)# end
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
附:show interfaces [interface-id] switchport // 显示二层端口的状态,可以用来决定此口是否为二层或三层口。 Eg:Switch# show interfaces fastethernet 0/1 switchport
VLAN的配置还有很多内容,本文只是介绍了一部分,希望大家多多掌握。
【编辑推荐】