STP;VTP交换机配置实例

 

VTP(VLAN Trunking Protocol):虚拟局域网干道协议
  VTP通过网络(ISL帧或cisco私有DTP帧)保持VLAN配置统一性。VTP在系统级管理增加,删除,调整的VLAN,自动地将信息向网络中其它的交换机广播。此外,VTP减小了那些可能导致安全问题的配置。便于管理,只要在vtp server做相应设置,vtp client会自动学习vtp server上的vlan信息
  * 当使用多重名字VLAN能变成交叉--连接。
  * 当它们是错误地映射在一个和其它局域网,VLAN能变成内部断开。
  VTP模式
  当交换机是在VTP Server或透明的模式,能在交换机配置VLAN。当交换机配置在VTP Server或透明的模式,使用CLI、控制台菜单、MIB(当使用SNMP简单网络管理协议管理工作站)修改VLAN配置。
  一个配置为VTP Server模式的交换机向邻近的交换机广播VLAN配置,通过它的Trunk从邻近的交换机学习新的VLAN配置。在Server模式下可以通过MIB,CLI,或者控制台模式添加、删除和修改VLAN。
  例如:增加了一个VLAN,VTP将广播这个新的VLAN,Server和Client机的Trunk网络端口准备接收信息。
  在交换机自动转到VTP的Client模式后,它会传送广播信息并从广播中学习新的信息。但是,不能通过MIB、CLI、或者控制台来增加、删除、修改VLAN。VTP Client端不能保持VLAN信息在非易失存储器中。当启动时,它会通过Trunk网络端口接受广播信息,学习配置信息。
  在VTP透明的模式,交换不做广播或从网络学习VLAN配置。当一个交换机是在VTP透明的模式,能通过控制台、CLI、MIB来修改、增加、删除VLAN。
  为使每一个VLAN能够使用,必须使VTP知道。并且包含在Trunk port 的准许列表中,一个快速以太网ISL Trunk自动为VLAN传输数据,并且从一个交换机到另一个交换机。
  需要注意的是如果交换在VTP Server模式接收广播包含128多个VLAN,交换自动地转换向VTP Client模式。
  更改交换机从VTP Client模式向VTP透明的模式,交换机保持初始、唯一128VLAN并删除剩余的VLAN。
  传送VTP信息
  每个交换机用VTP广播Trunk端口的管理域,定义特定的VLAN边界,它的配置修订号,已知VLAN和特定参数。在一个VTP管理域登记后交换机才能工作。
  通过Trunk,VTP Server向其它交换机传输信息和接收更新。VTP Server也在NVRAM中保存本VTP管理域信息中 VLAN的列表。 VTP能通过统一的名字和内部的列表动态显示出管理域中的VLAN。
  VTP信息在全部Trunk连接上传输,包括ISL、IEEE802.10、LANE。VTP MIB为VTP提供SNMP工具,并允许浏览VTP参数配置。
  VTP建立共用的配置值和分布下列的共用的配置信息:
  * VLAN IDs(ISL)
  * 仿效LAN的名字(ATM LANE)
  * IEEE802.10 SAID值(FDDI)
  * VLAN中最大的传输单元(MTU)大小
  * 帧格式
  VTP协议用来确保配置的一致性,VTP的具体优点如下:
  。保持了VLAN的一致性
  。提供从一个交换机到另一个交换机在整个管理域中增加虚拟局域网的方法
  VTP协议是思科的专用协议,大多数的Catalys交换机都支持该协议,VTP可以减少VLAN的相关管理任务。
  在VTP域中有两个重要的概念:
  。VTP域:也称VLAN管理域,由一个以上共享VTP域名的相互连接的交换机组成的。也就是说VTP域是一组域名相同并通过中继链路相互连接的交换机
  。VTP通告:在交换机之间用来传递VLAN信息的数据包被成为VTP数据包。
  创建VTP域命令
  switch(config)#vtp domain DOMAIN_NAME
  配置交换机的VTP模式
  三种模式server client transparent(透明模式)
  switch(config)# vtp mode server | client | transparent
  配置VTP口令
  switch (config) # vtp password PASSWORD


步骤一、交换机和PC机的基本配置

  



 

步骤二、关闭交换机的所有端口,然后启用接入端口

S1(config)#int range f0/1 - 24

S1(config-if-range)#shutdown

S1(config-if-range)#int range g1/1 - 2

S1(config-if-range)#shutdown

S1(config-if-range)#int f0/6

S1(config-if)#switchport mode access

S1(config-if)#no shut

S1(config-if)#int f0/11

S1(config-if)#switchport mode access

S1(config-if)#no shut

S1(config-if)#int f0/18

S1(config-if)#switchport mode access

S1(config-if)#no shut

(交换机S2、S3配置参考S1)

步骤三、配置中继链路和本征VLAN

S1(config)#int range f0/1 – 4

S1(config-if-range)#switchport mode trunk

S1(config-if-range)#switchport trunk native vlan 99

S1(config-if-range)#no shut

(交换机S2、S3配置参考S1)

步骤四、配置VTP

S1(config)#vtp mode server

Device mode already VTP SERVER.

S1(config)#vtp domain cisco

Changing VTP domain name from NULL to cisco

S1(config)#vtp password cisco

Setting device VLAN database password to cisco

S2(config)#vtp mode client

Device mode already VTP CLIENT.

S2(config)#vtp domain cisco

Changing VTP domain name from NULL to cisco

S2(config)#vtp password cisco

Setting device VLAN database password to cisco

S3(config)#vtp mode client

Device mode already VTP CLIENT.

S3(config)#vtp domain cisco

Changing VTP domain name from NULL to cisco

S3(config)#vtp password cisco

Setting device VLAN database password to cisco

步骤五、在S1(VTP Server)上配置VLAN

S1(config)#vlan 10

S1(config-vlan)#name staff

S1(config-vlan)#exit

S1(config)#vlan 20

S1(config-vlan)#name students

S1(config-vlan)#exit

S1(config)#vlan 30

S1(config-vlan)#name guest

S1(config-vlan)#exit

S1(config)#vlan 99

S1(config-vlan)#name management

S1(config-vlan)#exit

(配置至此,用#sh vlan brief命令查看S2S3交换机的vlan配置,会看到VTP Server已经将VLAN信息传播至两个交换机)

步骤六、为各个VLAN分配接口

S1(config)#interface range fa0/6 - 10

S1(config-if-range)#switchport access vlan 10

S1(config-if-range)#interface range fa0/11-17

S1(config-if-range)#switchport access vlan 20

S1(config-if-range)#interface range fa0/18-24

S1(config-if-range)#switchport access vlan 30

S1(config-if-range)#exit

(交换机S2、S3配置参考S1)

步骤七、接入层交换机上配置端口安全功能

S1(config)#interface fa0/6

S1(config-if)#switchport port-security

S1(config-if)#switchport port-security maximum 1

S1(config-if)#switchport port-security mac-address sticky

S1(config-if)#interface fa0/11

S1(config-if)#switchport port-security

S1(config-if)#switchport port-security maximum 1

S1(config-if)#switchport port-security mac-address sticky

S1(config-if)#interface fa0/18

S1(config-if)#switchport port-security

S1(config-if)#switchport port-security maximum 1

S1(config-if)#switchport port-security mac-address sticky

S1(config-if)#end

(交换机S2、S3配置参考S1)

注:

interface FastEthernet0/1

switchport mode access

switchport port-security maximum 1 //设置最多只允许一个MAC地址通过

switchport port-security //启用端口安全

switchport port-security violation protect //设定破坏规则的动作为端口保护

switchport port-security mac-address sticky //设定端口的行为是MAC地址粘贴

switchport port-security mac-address sticky 0012.3f12.cfd6 //指定具体的粘贴MAC地址


说明:其实端口安全的默认设置的maximum是1,如果需要限定几个MAC,设为几就OK了。

步骤八、为各交换机配置管理VLAN地址和默认网关

S1(config)#ip default-gateway 192.168.1.1

S1(config)#interface vlan99

S1(config-if)#ip address 192.168.99.11 255.255.255.0

S1(config-if)#no shutdown

S2(config)#ip default-gateway 192.168.1.1

S2(config)#interface vlan99

S2(config-if)#ip address 192.168.99.12 255.255.255.0

S2(config-if)#no shutdown

S3(config)#ip default-gateway 192.168.1.1

S3(config)#interface vlan99

S3(config-if)#ip address 192.168.99.13 255.255.255.0

S3(config-if)#no shutdown

步骤九、按下列要求配置并改良STP

S1 成为 VLAN 10 的根桥(优先级 4096)、VLAN 20 的备用根桥(优先级 16384

S2 成为 VLAN 20 的根桥(优先级 4096)、VLAN 30 的备用根桥(优先级 16384

S3 成为 VLAN 30 的根桥(优先级 4096)、VLAN 10 的备用根桥(优先级 16384

S1(config)#spanning-tree vlan 10 priority 4096

S1(config)#spanning-tree vlan 20 priority 16384

S2(config)#spanning-tree vlan 20 priority 4096

S2(config)#spanning-tree vlan 30 priority 16384

S3(config)#spanning-tree vlan 30 priority 4096

S3(config)#spanning-tree vlan 10 priority 16384

1、查看MAC地址       Switch#show mac-address-table

2、查看配置命令         Switch#show running-config

3、查看CDP邻居信息命令

1)查看CDP全局配置信息      Swintch#show cdp

2)查看某借口配置信息         Swintch#show cdp interface f0/19

3)显示有关CDP包的统计信息 Swintch#show cdp traffic

4)列出与本设备相邻的设备     Swintch#show cdp neighbors

5)显示详细的邻居信息         Swintch#show cdp neighbors detail

6)显示所有入口项的细节       Swintch#show cdp entry *

4、查看VLAN信息命令          Swintch#show vlan brief

5、查看某个VLAN的信息        Swintch#show vlan 2

6、查看端口的VLAN号           Swintch#show running-config interface f0/2

7、查端口的管理模式和VLAN的情况Swintch#show interfaces f0/2 switchport

8、查看历史命令                 Swintch#show history

9、查看闪存                     Swintch#dir flash

10、查看VTP配置信息           Swithc#show vtp status  

11、查看生成树配置              Swithc#show spanning-tree

12、查看VLAN的生成树详细信息Swithc#show spanning-tree vlan 2 detail

13、查看FIB表                  Swithc#show ip cef

14、查看邻居关系表              Swithc#show adjacency detail

15、查看二层以太通道信息        Swithc#show etherchannel 1 summary

注:如果在其它模式查看前面加上 “do”就可以了

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章