练习题
步骤1. 配置基本命令;先配ip,掩码,网关
步骤 2. 在 S1、S2 和 S3 上配置管理 VLAN 接口。
在每台交换机上创建并启用接口 VLAN 5。 从 VLAN 5 的下一个可用 IP 地址开始,将地址依次指定给 S1、S2、S3。
Switch>enable
Switch#conf t
Switch(config)#hostname s1
S1(config)#interface vlan 5//可以直接配地址,这个时候vlan显示空白状态
S1(config)#ip address 10.1.1.226 255.255.255.224//配置ip网关
S1(config-if)#
Switch(config)#hostname s2
S2(config)#interface vlan 5
S2(config-if)#ip address 10.1.1.227 255.255.255.24
S2(config-if)#
S3(config)#interface vlan 5
S3(config-if)#ip address 10.1.1.128 255.255.255.240
S3(config-if)#
Exit
S1(config-if)#ip defauit-gateway 10.1.1.225//配置掩码
s2(config-if)#ip defauit-gateway 10.1.1.225//掩码
S3(config-if)#ip defauit-gateway 10.1.1.225//掩码
任务 3:配置 VTP
步骤 1. 在所有三台交换机上配置 VTP 模式。
将 S1 配置为服务器。将 S2 和 S3 配置为客户端。
S2(config)#vtp mode client(客户端模式)
S1(config)#vtp mode server(服务器模式)
步骤 2. 在所有三台交换机上配置 VTP 域名。
将 XYZCORP 用作 VTP 域名。
S1(config)#vtp domain XYZCORP
步骤 3. 在所有三台交换机上配置 VTP 域口令。
将 westbranch 用作 VTP 域口令。
S1(config)#vtp password westbranch
步骤 1. 在 S1、S2 和 S3 上配置中继。(转换为创客模式)
将适当的接口配置为中继模式,并将 VLAN 5 指定为本征 VLAN。
S1(config)#interface range fastEthernet 0/1-4
S1(config-if-range)#switchport trunk native vlan 5//改为创客模式
步骤 1. 在 S1 上创建 VLAN。
仅在 S1 上创建以下 VLAN 并为其命名。VTP 会将新的 VLAN 通告给 S1 和 S2。
- VLAN 15 Production
- VLAN 25 Staff
- VLAN 35 Guest(Default)
- VLAN 5 Management&Native
S1(config)#vlan 15
S1(config-vlan)#name Production
S1(config)#vlan 25
S1(config-vlan)#name Staff
S1(config)#vlan 35
S1(config-vlan)#name Guest(Default)
S1(config)#vlan 5
S1(config-vlan)#name Management&Native
步骤 2. 检查这些 VLAN 是否已发送到 S2 和 S3。
使用适当的命令检查 S2 和 S3 是否已具有您在 S1 上创建的 VLAN。
(划分接口)
S2(config)#do show vlan
步骤 1. 为 S2 上的接入端口指定 VLAN。
将 PC 接入指定的 VLAN:
- VLAN 15: PC1 连接到 Fa0/11
- VLAN 25: PC2 连接到 Fa0/18
- VLAN 35: PC3 连接到 Fa0/6
S2(config)#interface fastEther 0/11
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 15
S2(config-if)#int f 0/18
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 25
S2(config-if)#int f 0/6
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 35
配置 STP
步骤 1. 确保 S1 是根桥。
设置 S1 的优先级,使之始终成为所有 VLAN 的根桥。
S1(config)#spanning-tree vlan 5,15,25,35 priority 4096
附加:
S1(config)#interface gigabitEthernet 0/1
S1(config-if)#switchport mode trunk
S1(config-if)#switchport trunk native vlan 5
进三层交换器
Switch(config)#hostname SR
SR(config-if)#switchport mode trunk
SR(config-if)#switchport trunk active vlan 5
Exit
创建vlan
SR(config)#vtp domin XYZCORP
SR(config)#vtp password westbranch
SR(config)#do show vlan//检查创建的vlan
SR(config-if)#ip address 10.1.1.1 255.255.255.128
SR(config-if)#int vlan 25
SR(config-if)#ip addres 10.1.1.129 255.255.255.129
SR(config)#ip routing