VTP协议:
VLAN中继协议,VTP,VLAN TRUNKING PROTOCOL,是CISCO专用协议,大多数交换机都支持该协议。VTP负责在VTP域内同步VLAN信息,
这样就不必在每个交换上配置相同的VLAN信息。VTP还提供一种映射方案,以便通信流能跨越混合介质的骨干。VTP最重要的作用是,将进行
变动时可能会出现在的配置不一致性降至最低。不过,VTP也有一些缺点,这些缺点通常都与生成树协议有关.
知识点:
VLAN中继协议(VTP)利用第2层中继帧,在一组交换机之间进行VLAN通信.VTP从一个中心控制点开始,维护整个企业网上VLAN的添加和重命名工作,确保配置的一致性。
设计思路:
1、 Cisco C3560配置成为VTP server并设置VTP管理域名称CCTV
2、 Cisco C3560创建三个VLAN(VLAN10 VLAN20 VLAN 30)并配置每个VLAN动态获取IP
3、 Cisco C3650 分配三个端口fa 0/1-3 设置为trunk
4、 三台Cisco C2960配置成为 VTP client
5、 C2960_01 分配fa 0/1-5给VLAN 10 ,并设置fa0/24端口为trunk
6、 C2960_02 分配fa 0/1-5给VLAN 20 ,并设置fa0/24端口为trunk
7、 C2960_03 分配fa 0/1-5给VLAN 30 ,并设置fa0/24端口为trunk
网络拓扑图:
Cisco C3560配置如下:
##设置VTP 域名名称及VTP Server
C3560>enable
C3560#vlan database
C3560(vlan)#vtp domain CCTV
C3560(vlan)#vtp server
##创建VLAN 10 VLAN 20 VLAN 30
C3560(vlan)#vlan 10 name VLAN10
C3560(vlan)#vlan 20 name VLAN20
C3560(vlan)#vlan 30 name VLAN30
C3560(vlan)#exit
##VLAN配置IP地址
3560#configure terminal
C3560(config)#interface vlan 10
C3560(config-if)#ip address 192.168.10.1 255.255.255.0
C3560(config-if)#exit
C3560(config)#interface vlan 20
C3560(config-if)#ip address 192.168.20.1 255.255.255.0
C3560(config-if)#exit
C3560(config)#interface vlan 30
C3560(config-if)#ip address 192.168.30.1 255.255.255.0
C3560(config-if)#exit
##配置DCHP
C3560(config)#service dhcp
C3560(config)#ip dhcp pool vlan10_dhcp
C3560(dhcp-config)#network 192.168.10.0 255.255.255.0
C3560(dhcp-config)#default-router 192.168.10.1
C3560(dhcp-config)#dns-server 114.114.114.114
C3560(dhcp-config)#exit
C3560(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.10
C3560(config)#ip dhcp pool vlan20_dhcp
C3560(dhcp-config)#network 192.168.20.0 255.255.255.0
C3560(dhcp-config)#default-router 192.168.20.1
C3560(dhcp-config)#dns-server 114.114.114.114
C3560(dhcp-config)#exit
C3560(config)#ip dhcp excluded-address 192.168.20.1 192.168.20.10
C3560(config)#ip dhcp pool vlan30_dhcp
C3560(dhcp-config)#network 192.168.30.0 255.255.255.0
C3560(dhcp-config)#default-router 192.168.30.1
C3560(dhcp-config)#dns-server 114.114.114.114
C3560(dhcp-config)#exit
C3560(config)#ip dhcp excluded-address 192.168.30.1 192.168.30.10
##设置三个端口fastEthernet 0/1-3为trunk
知识点:VLAN的封装类型,目前有ISL和802.1q(dot1q)两种协议,ISL是思科私有的VLAN封装协议,思科部分交换机支持ISL协议,使用该协议能提高VLAN传输性能。
C3560(config)#interface range fastEthernet 0/1-3
C3560(config-if-range)#switchport trunk encapsulation ?
dot1q Interface uses only 802.1q trunking encapsulation when trunking
C3560(config-if-range)#switchport trunk encapsulation dot1q
C3560(config-if-range)#switchport mode trunk
C3560(config-if-range)#exit
##开启三层路由功能
C3560>enable
C3560#configure terminal
C3560(config)#ip routing
##显示与维护
C3560#show running-config
C3560#show vtp status
Cisco C2960_01配置如下:
##设置VTP 域名名称及VTP Client
C2960_01>enable
C2960_01#vlan database
C2960_01(vlan)#vtp domain CCTV
C2960_01(vlan)#vtp client
C2960_01(vlan)#exit
##分配fa0/1-5端口给VLAN 10
C2960_01#configure terminal
C2960_01(config)#interface range fastEthernet 0/1-5
C2960_01(config-if-range)#switchport access vlan 10
C2960_01(config-if-range)#switchport mode access
C2960_01(config-if-range)#no shutdown
C2960_01(config-if-range)#exit
##设置fa0/24端口为trunk
C2960_01(config)#interface fastEthernet 0/24
C2960_01(config-if)#switchport mode trunk
C2960_01(config-if)#no shutdown
C2960_01(config-if)#exit
##显示与维护
C2960_01#show vlan
C2960_01#show running-config
C2960_01#show vtp status
Cisco C2960_02配置如下:
##设置VTP 域名名称及VTP Client
C2960_02>enable
C2960_02#vlan database
C2960_02(vlan)#vtp domain CCTV
C2960_02(vlan)#vtp client
C2960_02(vlan)#exit
##分配fa0/1-5端口给VLAN 10
C2960_02#configure terminal
C2960_02(config)#interface range fastEthernet 0/1-5
C2960_02(config-if-range)#switchport access vlan 10
C2960_02(config-if-range)#switchport mode access
C2960_02(config-if-range)#no shutdown
C2960_02(config-if-range)#exit
##设置fa0/24端口为trunk
C2960_02(config)#interface fastEthernet 0/24
C2960_02(config-if)#switchport mode trunk
C2960_02(config-if)#no shutdown
C2960_02(config-if)#exit
##显示与维护
C2960_02#show vlan
C2960_02#show running-config
C2960_01#show vtp status
Cisco C2960_03配置如下:
##设置VTP 域名名称及VTP Client
C2960_03>enable
C2960_03#vlan database
C2960_03(vlan)#vtp domain CCTV
C2960_03(vlan)#vtp client
C2960_03(vlan)#exit
##分配fa0/1-5端口给VLAN 10
C2960_03#configure terminal
C2960_03(config)#interface range fastEthernet 0/1-5
C2960_03(config-if-range)#switchport access vlan 10
C2960_03(config-if-range)#switchport mode access
C2960_03(config-if-range)#no shutdown
C2960_03(config-if-range)#exit
##设置fa0/24端口为trunk
C2960_03(config)#interface fastEthernet 0/24
C2960_03(config-if)#switchport mode trunk
C2960_03(config-if)#no shutdown
C2960_03(config-if)#exit
##显示与维护
C2960_03#show vlan
C2960_03#show running-config
C2960_03#show vtp status