VTP交换机配置实例.docx
《VTP交换机配置实例.docx》由会员分享,可在线阅读,更多相关《VTP交换机配置实例.docx(7页珍藏版)》请在冰豆网上搜索。
![VTP交换机配置实例.docx](https://file1.bdocx.com/fileroot1/2023-1/24/5faf92c7-ccee-4132-a8f1-1d86ca08eb00/5faf92c7-ccee-4132-a8f1-1d86ca08eb001.gif)
VTP交换机配置实例
STP;VTP交换机配置实例
VTP(VLANTrunkingProtocol):
虚拟局域网干道协议
VTP通过网络(ISL帧或cisco私有DTP帧)保持VLAN配置统一性。
VTP在系统级管理增加,删除,调整的VLAN,自动地将信息向网络中其它的交换机广播。
此外,VTP减小了那些可能导致安全问题的配置。
便于管理,只要在vtpserver做相应设置,vtpclient会自动学习vtpserver上的vlan信息
*当使用多重名字VLAN能变成交叉--连接。
*当它们是错误地映射在一个和其它局域网,VLAN能变成内部断开。
VTP模式
当交换机是在VTPServer或透明的模式,能在交换机配置VLAN。
当交换机配置在VTPServer或透明的模式,使用CLI、控制台菜单、MIB(当使用SNMP简单网络管理协议管理工作站)修改VLAN配置。
一个配置为VTPServer模式的交换机向邻近的交换机广播VLAN配置,通过它的Trunk从邻近的交换机学习新的VLAN配置。
在Server模式下可以通过MIB,CLI,或者控制台模式添加、删除和修改VLAN。
例如:
增加了一个VLAN,VTP将广播这个新的VLAN,Server和Client机的Trunk网络端口准备接收信息。
在交换机自动转到VTP的Client模式后,它会传送广播信息并从广播中学习新的信息。
但是,不能通过MIB、CLI、或者控制台来增加、删除、修改VLAN。
VTPClient端不能保持VLAN信息在非易失存储器中。
当启动时,它会通过Trunk网络端口接受广播信息,学习配置信息。
在VTP透明的模式,交换不做广播或从网络学习VLAN配置。
当一个交换机是在VTP透明的模式,能通过控制台、CLI、MIB来修改、增加、删除VLAN。
为使每一个VLAN能够使用,必须使VTP知道。
并且包含在Trunkport的准许列表中,一个快速以太网ISLTrunk自动为VLAN传输数据,并且从一个交换机到另一个交换机。
需要注意的是如果交换在VTPServer模式接收广播包含128多个VLAN,交换自动地转换向VTPClient模式。
更改交换机从VTPClient模式向VTP透明的模式,交换机保持初始、唯一128VLAN并删除剩余的VLAN。
传送VTP信息
每个交换机用VTP广播Trunk端口的管理域,定义特定的VLAN边界,它的配置修订号,已知VLAN和特定参数。
在一个VTP管理域登记后交换机才能工作。
通过Trunk,VTPServer向其它交换机传输信息和接收更新。
VTPServer也在NVRAM中保存本VTP管理域信息中VLAN的列表。
VTP能通过统一的名字和内部的列表动态显示出管理域中的VLAN。
VTP信息在全部Trunk连接上传输,包括ISL、IEEE802.10、LANE。
VTPMIB为VTP提供SNMP工具,并允许浏览VTP参数配置。
VTP建立共用的配置值和分布下列的共用的配置信息:
*VLANIDs(ISL)
*仿效LAN的名字(ATMLANE)
*IEEE802.10SAID值(FDDI)
*VLAN中最大的传输单元(MTU)大小
*帧格式
VTP协议用来确保配置的一致性,VTP的具体优点如下:
。
保持了VLAN的一致性
。
提供从一个交换机到另一个交换机在整个管理域中增加虚拟局域网的方法
VTP协议是思科的专用协议,大多数的Catalys交换机都支持该协议,VTP可以减少VLAN的相关管理任务。
在VTP域中有两个重要的概念:
。
VTP域:
也称VLAN管理域,由一个以上共享VTP域名的相互连接的交换机组成的。
也就是说VTP域是一组域名相同并通过中继链路相互连接的交换机
。
VTP通告:
在交换机之间用来传递VLAN信息的数据包被成为VTP数据包。
创建VTP域命令
switch(config)#vtpdomainDOMAIN_NAME
配置交换机的VTP模式
三种模式serverclienttransparent(透明模式)
switch(config)#vtpmodeserver|client|transparent
配置VTP口令
switch(config)#vtppasswordPASSWORD
步骤一、交换机和PC机的基本配置
步骤二、关闭交换机的所有端口,然后启用接入端口
S1(config)#intrangef0/1-24
S1(config-if-range)#shutdown
S1(config-if-range)#intrangeg1/1-2
S1(config-if-range)#shutdown
S1(config-if-range)#intf0/6
S1(config-if)#switchportmodeaccess
S1(config-if)#noshut
S1(config-if)#intf0/11
S1(config-if)#switchportmodeaccess
S1(config-if)#noshut
S1(config-if)#intf0/18
S1(config-if)#switchportmodeaccess
S1(config-if)#noshut
(交换机S2、S3配置参考S1)
步骤三、配置中继链路和本征VLAN
S1(config)#intrangef0/1–4
S1(config-if-range)#switchportmodetrunk
S1(config-if-range)#switchporttrunknativevlan99
S1(config-if-range)#noshut
(交换机S2、S3配置参考S1)
步骤四、配置VTP
S1(config)#vtpmodeserver
DevicemodealreadyVTPSERVER.
S1(config)#vtpdomaincisco
ChangingVTPdomainnamefromNULLtocisco
S1(config)#vtppasswordcisco
SettingdeviceVLANdatabasepasswordtocisco
S2(config)#vtpmodeclient
DevicemodealreadyVTPCLIENT.
S2(config)#vtpdomaincisco
ChangingVTPdomainnamefromNULLtocisco
S2(config)#vtppasswordcisco
SettingdeviceVLANdatabasepasswordtocisco
S3(config)#vtpmodeclient
DevicemodealreadyVTPCLIENT.
S3(config)#vtpdomaincisco
ChangingVTPdomainnamefromNULLtocisco
S3(config)#vtppasswordcisco
SettingdeviceVLANdatabasepasswordtocisco
步骤五、在S1(VTPServer)上配置VLAN
S1(config)#vlan10
S1(config-vlan)#namestaff
S1(config-vlan)#exit
S1(config)#vlan20
S1(config-vlan)#namestudents
S1(config-vlan)#exit
S1(config)#vlan30
S1(config-vlan)#nameguest
S1(config-vlan)#exit
S1(config)#vlan99
S1(config-vlan)#namemanagement
S1(config-vlan)#exit
(配置至此,用#shvlanbrief命令查看S2、S3交换机的vlan配置,会看到VTPServer已经将VLAN信息传播至两个交换机)
步骤六、为各个VLAN分配接口
S1(config)#interfacerangefa0/6-10
S1(config-if-range)#switchportaccessvlan10
S1(config-if-range)#interfacerangefa0/11-17
S1(config-if-range)#switchportaccessvlan20
S1(config-if-range)#interfacerangefa0/18-24
S1(config-if-range)#switchportaccessvlan30
S1(config-if-range)#exit
(交换机S2、S3配置参考S1)
步骤七、接入层交换机上配置端口安全功能
S1(config)#interfacefa0/6
S1(config-if)#switchportport-security
S1(config-if)#switchportport-securitymaximum1
S1(config-if)#switchportport-securitymac-addresssticky
S1(config-if)#interfacefa0/11
S1(config-if)#switchportport-security
S1(config-if)#switchportport-securitymaximum1
S1(config-if)#switchportport-securitymac-addresssticky
S1(config-if)#interfacefa0/18
S1(config-if)#switchportport-security
S1(config-if)#switchportport-securitymaximum1
S1(config-if)#switchportport-securitymac-addresssticky
S1(config-if)#end
(交换机S2、S3配置参考S1)
注:
interfaceFastEthernet0/1
switchportmodeaccess
switchportport-securitymaximum1//设置最多只允许一个MAC地址通过
switchportport-security//启用端口安全
switchportport-securityviolationprotect//设定破坏规则的动作为端口保护
switchportport-securitymac-addresssticky//设定端口的行为是MAC地址粘贴
switchportport-securitymac-addresssticky0012.3f12.cfd6//指定具体的粘贴MAC地址
说明:
其实端口安全的默认设置的maximum是1,如果需要限定几个MAC,设为几就OK了。
步骤八、为各交换机配置管理VLAN地址和默认网关
S1(config)#ipdefault-gateway192.168.1.1
S1(config)#interfacevlan99
S1(config-if)#ipaddress192.168.99.11255.255.255.0
S1(config-if)#noshutdown
S2(config)#ipdefault-gateway192.168.1.1
S2(config)#interfacevlan99
S2(config-if)#ipaddress192.168.99.12255.255.255.0
S2(config-if)#noshutdown
S3(config)#ipdefault-gateway192.168.1.1
S3(config)#interfacevlan99
S3(config-if)#ipaddress192.168.99.13255.255.255.0
S3(config-if)#noshutdown
步骤九、按下列要求配置并改良STP
S1成为VLAN10的根桥(优先级4096)、VLAN20的备用根桥(优先级16384)
S2成为VLAN20的根桥(优先级4096)、VLAN30的备用根桥(优先级16384)
S3成为VLAN30的根桥(优先级4096)、VLAN10的备用根桥(优先级16384)
S1(config)#spanning-treevlan10priority4096
S1(config)#spanning-treevlan20priority16384
S2(config)#spanning-treevlan20priority4096
S2(config)#spanning-treevlan30priority16384
S3(config)#spanning-treevlan30priority4096
S3(config)#spanning-treevlan10priority16384
听雷