实施配置VLAN

1、新建VLAN
switch#configure terminal
switch(config)#vlan  vlan-id
switch(config-vlan)#name  vlan-name
switch(config)#exit
2、将接口划入VLAN
switch(config)#interface fast 1/1
switch(config-if)#switchport  access vlan 500
switch(config-if)#description dxt
switch(config-if)#no  shutdown
注释:使用switchport,不带任何参数可以将端口设置为二层端口。
排错:检查VLAN故障时,主要有三点。1、物理连接。2、交换机配置。3、VLAN配置。
排错:VLAN内部不能通信时,使用show interface查看交换机端口是否正确配置了成员身份,确认端口是否处于UP状态。
3私用VLAN
3.1 主VLAN是PVLAN中的高级VLAN主VLAN由多个辅助VLAN组成,辅助VLAN属于主VLAN的相同子网。
3.2、辅助VLAN是主VLAN的子代,并且映射到一个主VLAN,每台设备都连接到辅助PVLAN。
3.3、PVLAN的混杂模式,它能够与PVLAN中的全部设备进行通信。混杂端口只是主VLAN的一部分,每个混杂端口可以映射到多个辅助VLAN,混杂端口通常是路由器。
3.4、团体VLAN如果端口属于团体VLAN,,可以和团体VLAN之内的其他成员通信,也可以和混杂端口通信。
3.5、隔离VLAN只能和混杂端口通信,不能和团体之内的其他成员通信。
4.配置PVLAN
switch(config)#vlan  100
switch(config-vlan)#private-vlan primary
switch(config)#vlan 200
switch(config-vlan)#private-vlan  community
switch(config)#vlan 300
switch(config-vlan)#private-vlan  isolated
switch(config)#vlan  100
switch(config-vlan)#private-vlan mapping add 200 300
switch(config)#interface  fast 5/1
switch(config-if)#switchport  mode  private-vlan host
switch(config-if)#switchport   private-vlan host -association 100 200
switch(config)#interface  fast 5/2
switch(config-if)#switchport  mode   private-vlan host
switch(config-if)#switchport   private-vlan host -association 100 300
5、ISL封装
ISL帧封装,在原有的数据包头部增加26个字节,尾部是4个字节的循环冗余校验。开销为30个字节。
6、IEEE802.1Q
为了能承载多个VLAN的帧,IEEE802.1Q对每个帧都进行标记,进而识别帧所属的VLAN。802.1Q开销为4个字节。802.1Q支持QOS的802.1P字段。
802.1Q帧介绍:在源地址和以太网长度之间插入四个字节(2字节TPID ether type 设为0x8100, PRI802.1P优先级字段,3个BIT,CFI占用一个BIT设置为0或1以太网设为0令牌环设为1,VLAN ID 占用12个BIT)
小巨帧大于1500字节小于2000字节,采用ISL封装的帧是1548字节,采用802.1Q封装的帧是1522字节。
7、native vlan
CISCO交换机定义了将VLAN1设为native vlan 将没有打标记的帧发送到native vlan,对于两台设备之间802.1Q干道端口,要求配置相同的native vlan,两边的干道端口native vlan不一致有可能导致二层环路,交换机每一个端口都有一个PVID(端口ID)交换机将未分配VLANID的端口都分配为native vlanID也就是vlan1,将没有标记的帧默认转发到VLAN1.(trunk端口默认的native vlan为vlan1,也可以通过 switch(config-if)#switchport  trunk   native  vlan   vlan-id来修改,两边交换机trunk之间native vlan最好一致,否则可能会导致环路。
8、配置trunk
switch(config)#interface fast 1/1
switch(config-if)#switchport  trunk  encapsulation  dot1Q
switch(config-if)#switchport  mode  trunk
switch(config-if)#switchport  trunk   native  vlan   vlan-id(指定native vlan)
switch(config-if)#switchport  trunk   allowed  vlan  1-100
9、链路聚集排错
接口模式、native vlan  、封装类型。
10、vtp
VTP有三种模式:客户端模式,服务器模式、透明模式。默认情况下VTP工作在服务器模式下,
客户端模式:创建,更改、删除VLAN,向其他交换机转发通告。能够配置从其他交换机学到的信息,不能将VLAN保存到nvrom中。
服务器模式:和客户端一样,能将配置保存到nvrom中。
透明模式:能在本地创建,更改、删除VLAN,能将从其他交换机学到的信息转发出去,不能将其他交换机学到的信息进行同步,能保存在NVROM中,透明模式的版本号总是0.
交换机需要加入到VTP域,否则不能进行学习VLAN。交换在在干道端口上扩散整个管理域VTP通告,交换机每隔5分钟发送一个通告消息,或者在VLAN发生更改的时候发送通告消息,VTP是以版本号为信息是否最新,每当服务器修改VLAN信息的时候版本号就加1,版本号越高证明信息最新,
11、VLAN修剪
为了在交换机中减少流量,增加带宽,vlan只在有需要的地方出现,将多余的流量修剪掉。
12、vtp配置
switch(config)#VTP server
switch(config)#VTP domain XXX
switch(config)#VTP  version  2
switch(config)#VTP  password  xxxxxx
switch(config)#VTP  pruning