拓扑图
地址分配表
设备 | 接口 | IP 地址 | 子网掩码 |
PC0 | NIC | 192.168.10.1 | 255.255.255.0 |
PC1 | NIC | 192.168.20.1 | 255.255.255.0 |
PC2 | NIC | 192.168.30.1 | 255.255.255.0 |
PC3 | NIC | 192.168.30.2 | 255.255.255.0 |
PC4 | NIC | 192.168.20.2 | 255.255.255.0 |
PC5 | NIC | 192.168.10.2 | 255.255.255.0 |
S1 | VLAN 99 | 192.168.99.1 | 255.255.255.0 |
S2 | VLAN 99 | 192.168.99.2 | 255.255.255.0 |
S3 | VLAN 99 | 192.168.99.3 | 255.255.255.0 |
目标
第 1 部分:配置并验证 DTP
第 2 部分:配置并验证 VTP
背景/场景
随着网络中的交换机数量增加,管理 VLAN 和中继所需执行的管理工作可能越来越具有挑战性。为了减少一些 VLAN 和中继配置,网络管理员可以通过 VLAN 中继协议 (VTP) 实现 VLAN 管理自动化。网络设备之间的中继协商由动态中继协议 (DTP) 进行管理,并在 Catalyst 2960 和 Catalyst 3560 交换机上自动启用。
在此练习中,您将配置交换机之间的中继链路。您将在同一 VTP 域中配置 VTP 服务器和 VTP 客户端。当交换机处于 VTP 透明模式时,您还将观察 VTP 行为。您将向 VLAN 分配端口并验证与同一个 VLAN 的端到端连接。
第 1 部分:配置并验证 DTP
在第 1 部分,您将配置交换机之间的中继链路,并将 VLAN 999 配置为本地 VLAN。
第 1 步:验证 VLAN 配置。
验证交换机上配置的 VLAN。
a. 在 S1 上,点击 CLI 选项卡。在提示符后依次输入 enable 和 show vlan brief 命令,验证 S1 上配置的 VLAN。
S1# show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7,Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15,Fa0/16
Fa0/17, Fa0/18, Fa0/19,Fa0/20
Fa0/21, Fa0/22, Fa0/23,Fa0/24
Gig0/1, Gig0/2
99 Management active
999 VLAN0999 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
b. 对 S2 和 S3 重复第 a 步。交换机上配置了哪些 VLAN?
第 2 步:在 S1、S2 和 S3 上配置中继。
动态中继协议 (DTP) 管理思科交换机之间的中继链路。目前,所有交换机端口都处于默认中继模式,即“动态自动”中继模式。在此步骤中,您将为交换机 S1 与 S2 之间的链路将中继模式改为“动态期望”模式。对于交换机 S1 与 S3 之间的链路,链路将被设置为静态中继。在此拓扑中,使用 VLAN 999 作为本地 VLAN。
a. 在交换机 S1 和 S2 的 GigabitEthernet 0/1 接口上,将中继链路配置为“动态期望”模式。S1 的配置如下所示。
S1(config)# interface g0/1
S1(config-if)# switchport mode dynamic desirable
S2(config)# interface g0/1
S2(config-if)# switchport mode dynamic desirable
S2(config-if)# switchport trunk native vlan 999
b. 对于 S1 与 S3 之间的中继链路,在千兆以太网 0/2 接口上配置静态中继链路。
S1(config)# interface g0/2
S1(config-if)# switchport mode trunk
S3(config)# interface g0/2
S3(config-if)# switchport mode trunk
S3(config-if)# switchport trunk native vlan 999
c. 使用 show interfaces trunk 命令验证所有交换机是否均已启用中继。
S1# show interfaces trunk
Port Mode Encapsulation Status Native vlan
Gig0/1 desirable n-802.1q trunking 1
Gig0/2 on 802.1q trunking 1
Port Vlans allowed on trunk
Gig0/1 1-1005
Gig0/2 1-1005
Port Vlans allowed and active in management domain
Gig0/1 1,99,999
Gig0/2 1,99,999
Port Vlans in spanning tree forwarding state and not pruned
Gig0/1 none
Gig0/2 none
目前这些中继的本地 VLAN 是什么?
d. 将 VLAN 999 配置为 S1 上的中继链路的本地 VLAN。
S1(config)# interface range g0/1 - 2
S1(config-if-range)# switchport trunk native vlan 999
您在 S1 上收到什么消息?您将如何纠正?
e. 在 S2 和 S3 上,将 VLAN 999 配置为本地 VLAN。
f. 验证是否已在所有交换机上成功配置中继。您应该能够使用 SVI 上配置的 IP 地址从拓扑中的其他交换机对一台交换机执行 ping 操作。
第 2 部分:配置并验证 VTP
S1 将被配置为 VTP 服务器,S2 将被配置为 VTP 客户端。所有交换机都将配置到 VTP 域 CCNA 中,并使用 VTP 密码 cisco。
可以在 VTP 服务器上创建 VLAN,然后将这些 VLAN 分发给 VTP 域中的其它交换机。在本部分,您将在 VTP 服务器 S1 上创建 3 个新的 VLAN。这些 VLAN 将使用 VTP 分发到 S2。观察透明 VTP 模式的行为。
第 1 步:将 S1 配置为 VTP 服务器。
将 S1 配置为 CCNA 域中的 VTP 服务器,密码为 cisco。
a. 将 S1 配置为 VTP 服务器。
S1(config)# vtp mode server
将设备设置为 VTP SERVER 模式。
b. 将 CCNA 配置为 VTP 域名。
S1(config)# vtp domain CCNA
Changing VTP domain name from NULL to CCNA
c. 将 cisco 配置为 VTP 密码。
S1(config)# vtp password cisco
Setting device VLAN database password to cisco
第 2 步:验证 S1 上的配置。
a. 在交换机上使用 show vtp status 命令确认 VTP 模式和域是否已配置正确。
S1# show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 255
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : CCNA
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x8C 0x29 0x40 0xDD 0x7F 0x7A 0x63 0x17
Configuration last modified by 0.0.0.0 at 0-0-00 0:00:00
Local updater ID is 192.168.99.1 on interface Vl99 (lowest numbered VLAN interface found)
b. 要验证 VTP 密码,请使用 show vtp password 命令。
S1# show vtp password
VTP Password: cisco
第 3 步:将 S2 和 S3 添加到 VTP 域。
必须将 S2 和 S3 设置到与 S1 相同的 VTP 域中,S2 和 S3 才能接受来自 S1 的通告。将 S2 配置为 VTP 客户端,以 CCNA 作为 VTP 域名,并且以 cisco 作为 VTP 密码。请记住,VTP 域名区分大小写。
a. 将 S2 配置为 CCNA VTP 域中的 VTP 客户端,VTP 密码为 cisco。
S2(config)# vtp mode client
Setting device to VTP CLIENT mode.
S2(config)# vtp domain CCNA
Changing VTP domain name from NULL to CCNA
S2(config)# vtp password cisco
Setting device VLAN database password to cisco
b. 要验证 VTP 密码,请使用 show vtp password 命令。
S2# show vtp password
VTP Password: cisco
c. 将 S3 配置到 CCNA VTP 域中,VTP 密码为 cisco。交换机 S3 将设置为 VTP 透明模式。
S3(config)# vtp mode Transparent
S3(config)# vtp domain CCNA
Changing VTP domain name from NULL to CCNA
S3(config)# vtp password cisco
Setting device VLAN database password to cisco
d. 在所有交换机上输入 show vtp status 命令,以回答以下问题。
注意,这三台交换机上的配置修订版本号都为 0。说明原因。
第 4 步:在 S1 上创建更多 VLAN。
a. 在 S1 上,创建 VLAN 10,并将其命名为“红色”。
S1(config)# vlan 10
S1(config-vlan)# name Red
b. 根据下表创建 VLAN 20 和 30。
VLAN 编号 | VLAN 名称 |
10 | 红色 |
20 | 蓝色 |
30 | 黄色 |
c. 验证新 VLAN 的添加。在特权 EXEC 模式下输入 show vlan brief。
S1 上配置了哪些 VLAN?
S1(config)#vlan 10
S1(config-vlan)#name Red
S1(config-vlan)#vlan 20
S1(config-vlan)#name Blue
S1(config-vlan)#vlan 30
S1(config-vlan)#name Yellow
d. 确认配置更改,在 S1 和 S2 上使用 show vtp status 命令确认 VTP 模式和域是否已正确配置。S2 的输出如下所示:
S2# show vtp status
VTP Version : 2
Configuration Revision : 6
Maximum VLANs supported locally : 255
Number of existing VLANs : 10
VTP Operating Mode : Client
VTP Domain Name : CCNA
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xE6 0x56 0x05 0xE0 0x7A 0x63 0xFB 0x33
Configuration last modified by 192.168.99.1 at 3-1-93 0:21:07
S2 上配置了多少 VLAN?S2 是否具有与 S1 相同的 VLAN?说明原因。
第 5 步:观察 VTP 透明模式。
S3 目前配置为 VTP 透明模式。
a. 使用 show vtp status 命令,回答以下问题。
目前 S3 上配置了多少 VLAN?配置修订版本号是多少?请给出您的解释。
您将如何更改 S3 上的 VLAN 数量?
b. 在 S3 上将 VTP 模式更改为客户端。
使用 show 命令验证对 VTP 模式的更改。现在 S3 上有多少 VLAN?
注:每隔五分钟或者每当发生 VLAN 配置变更时,VTP 通告就会泛洪到整个管理域。为了加速这一过程,您可以在 Realtime(实时)模式和 Simulation(模拟)模式之间切换,直至下一轮更新开始。但是,您可能需要执行多次切换,因为此操作每次只能让 Packet Tracer 快进 10 秒。或者,您也可以将某一台客户端交换机更改为透明模式,然后再改回客户端模式。
第 6 步:将 VLAN 分配给端口
使用 switchport mode access 命令对每条接入链路设置接入模式。使用 switchport access vlan vlan-id 命令将 VLAN 分配给接入端口。
端口 | 作业 | 网络 |
S2 F0/1 – 8 S3 F0/1 – 8 | VLAN 10(红色) | 192.168.10.0 /24 |
S2 F0/9 – 16 S3 F0/9 – 16 | VLAN 20(蓝色) | 192.168.20.0 /24 |
S2 F0/17 – 24 S3 F0/17 – 24 | VLAN 30(黄色) | 192.168.30.0 /24 |
a. 使用上表中的分配,将 VLAN 分配给 S2 上的端口。
S2(config-if)# interface range f0/1 - 8
S2(config-if-range)# switchport mode access
S2(config-if-range)# switchport access vlan 10
S2(config-if-range)# interface range f0/9 -16
S2(config-if-range)# switchport mode access
S2(config-if-range)# switchport access vlan 20
S2(config-if-range)# interface range f0/17 - 24
S2(config-if-range)# switchport mode access
S2(config-if-range)# switchport access vlan 30
b. 使用上表中的分配,将 VLAN 分配给 S3 上的端口。
S3(config-if)# interface range f0/1 - 8
S3(config-if-range)# switchport mode access
S3(config-if-range)# switchport access vlan 10
S3(config-if-range)# interface range f0/9 -16
S3(config-if-range)# switchport mode access
S3(config-if-range)# switchport access vlan 20
S3(config-if-range)# interface range f0/17 - 24
S3(config-if-range)# switchport mode access
S3(config-if-range)# switchport access vlan 30
第 7 步:验证端到端连接。
a. 从 PC0 ping PC5。
b. 从 PC1 ping PC4。
c. 从 PC2 ping PC3。