#交换机的常用技术#
#任务二交换机的VTP技术#
虚拟局域网干道协议(vlan trunk protocol,VTP)及vlan的中继协议。VTP通过网络保持vlan配置的统一性。VTP是实现了系统化管理,方便管理员增加、删除和调整的vlan操作。
#1配置计算机的IP地址、子网掩码和网关
#2配置核心交换机C的主机名称,将其设置为VTP服务器,设置VTP的域名与密码
Switch>enable
Switch#conf t
Switch(config)#hostname Switch-C
Switch-C(config)#vtp domain mydomain
Switch-C(config)#vtp mode server
Switch-C(config)#vtp password fjfj
#3配置接入交换机A的主机名称,将其设置为VTP客户端,域名和密码与VTP服务器相同
Switch>enable
Switch#conf t
Switch(config)#hostname Switch-A
Switch-A(config)#vtp domain mydomain
Switch-A(config)#vtp password fjfj
Switch-A(config)#vtp mode client
#4配置接入交换机B的主机名称,将其设置为VTP客户端,域名和密码与VTP服务器相同
Switch>enable
Switch#conf t
Switch(config)#hostname Switch-B
Switch-B(config)#vtp domain mydomain
Switch-B(config)#vtp password fjfj
Switch-B(config)#vtp mode client
#5在核心交换机C上规划vlan并配置网关,启动路由功能
Switch-C(config)#vlan 10
Switch-C(config-vlan)#exit
Switch-C(config)#vlan 20
Switch-C(config-vlan)#exit
Switch-C(config)#int vlan 10
Switch-C(config-if)#ip add 192.168.10.254 255.255.255.0
Switch-C(config-if)#no shutdown
Switch-C(config)#int vlan 20
Switch-C(config-if)#ip add 192.168.20.254 255.255.255.0
Switch-C(config-if)#no shutdown
Switch-C(config-if)#exit
Switch-C(config)#ip routing
#6配置各交换机上的中继链路
Switch-A(config)#int f0/24
Switch-A(config-if)#sw mode trunk
Switch-B(config)#int f0/24
Switch-B(config-if)#sw mode trunk
Switch-C(config)#int f0/1
Switch-C(config-if)#switchport trunk encapsulation dot1q
Switch-C(config-if)#sw mode trunk
Switch-C(config-if)#exit
Switch-C(config)#int f0/2
Switch-C(config-if)#switchport trunk encapsulation dot1q
Switch-C(config-if)#sw mode trunk
#7在接入交换机A上把相应端口加入vlan
Switch-A(config)#int range f0/1-5
Switch-A(config-if-range)#sw acc vlan 10
Switch-A(config-if-range)#exit
Switch-A(config)#int range f0/6-10
Switch-A(config-if-range)#sw acc vlan 20
Switch-A(config-if-range)#exit
#8在接入交换机B上把相应端口加入vlan
Switch-B(config)#int range f0/1-5
Switch-B(config-if-range)#sw acc vlan 10
Switch-B(config-if-range)#exit
Switch-B(config)#int range f0/6-10
Switch-B(config-if-range)#sw acc vlan 20
Switch-B(config-if-range)#exit
#9验证PC的连通性。在任意一台PC上测试与其他PC的连通性,应该都是互通的
小贴士:
所有交换机的VTP 域名一致、密码相同才能传输VTP消息
VTP中的交换机有三种工作模式:服务器模式、客户端模式和透明模式