【实验名称】
跨交换机实现VLAN。 【实验目的】
理解VLAN如何跨交换机实现。 【背景描述】
假设某企业有2个主要部门:销售部和技术部,其中销售部门的个人计算机系统分散连接在2台交换机上,他们之间需要相互进行通信,但为了数据安全起见,销售部和技术部需要进行相互隔离,现要在交换机上做适当配置来实现这一目标。 【实现功能】
使在同一VLAN里的计算机系统能跨交换机进行相互通信,而在不同VLAN里的计算机系统不能进行相互通信。 【实验拓扑】
【实验设备】
S2126G (2台)。 【实验步骤】
1. 在交换机SwitchA上创建Vlan 10,并将0/5端口划分到Vlan 10中。
SwitchA # configure terminal !进入全局配置模式。 SwitchA(config)# vlan 10 !创建Vlan 10。
SwitchA(config-vlan)# name sales !将Vlan 10命名为sales。 SwitchA(config-vlan)#exit
SwitchA(config)#interface fastethernet 0/5 !进入接口配置模式。
SwitchA(config-if)#switchport access vlan 10 !将0/5端口划分到Vlan 10。 验证测试:验证已创建了Vlan 10,并将0/5端口已划分到Vlan 10中。
SwitchA#show vlan id 10
VLAN Name Status Ports
---- ------------------------ --------- ------------------------------- 10 sales active Fa0/5
2. 在交换机SwitchA上创建Vlan 20,并将0/15端口划分到Vlan 20中。
SwitchA(config)# vlan 20 !创建Vlan 20。
SwitchA(config-vlan)# name technical !将Vlan 20命名为technical。 SwitchA(config-vlan)#exit
SwitchA(config)#interface fastethernet 0/15 !进入接口配置模式。
SwitchA(config-if)#switchport access vlan 20 !将0/15端口划分到Vlan 20。 验证测试:验证已创建了Vlan 20,并将0/15端口已划分到Vlan 20中。 SwitchA#show vlan id 20
VLAN Name Status Ports
---- ------------------------ --------- ------------------------------- 20 technical active Fa0/15
3. 在交换机SwitchA上将与SwitchB相连的端口(假设为0/24端口)定义为tag vlan模式。
SwitchA(config)#interface fastethernet 0/24 !进入接口配置模式。
SwitchA(config-if)#switchport mode trunk !将fastethernet 0/24端口设为tag vlan模式。
验证测试:验证fastethernet 0/24端口已被设置为tag vlan模式。 SwitchA#show interfaces fastEthernet 0/24 switchport
Interface Switchport Mode Access Native Protected VLAN lists
---------- ------------- ------- -------- --------- -------------------- Fa0/24 Enabled Trunk 1 1 Disabled All
4. 在交换机SwitchB上创建Vlan 10,并将0/5端口划分到Vlan 10中。
SwitchB # configure terminal !进入全局配置模式。 SwitchB(config)# vlan 10 !创建Vlan 10。
SwitchB(config-vlan)# name sales !将Vlan 10命名为sales。 SwitchB(config-vlan)#exit
SwitchB(config)#interface fastethernet 0/5 !进入接口配置模式。
SwitchB(config-if)#switchport access vlan 10 !将0/5端口划分到Vlan 10。 验证测试:验证已在SwitchB上创建了Vlan 10,并将0/5端口已划分到Vlan 10中。 SwitchB#show vlan id 10
VLAN Name Status Ports
---- ------------------------ --------- ------------------------------- 10 sales active Fa0/5
5. 在交换机SwitchB上将与SwitchA相连的端口(假设为0/24端口)定义为tag vlan模式。
SwitchB(config)#interface fastethernet 0/24 !进入接口配置模式。
SwitchB(config-if)#switchport mode trunk !将fastethernet 0/24端口设为tag vlan模式。
验证测试:验证fastethernet 0/24端口已被设置为tag vlan模式。
SwitchB#show interfaces fastEthernet 0/24 switchport
Interface Switchport Mode Access Native Protected VLAN lists ---------- ---------- ---------- -------- --------- -------------------- Fa0/24 Enabled Trunk 1 1 Disabled All
6. 验证PC1与PC3能互相通信,但PC2与PC3不能互相通信。
C:\\>ping 192.168.10.30 !在PC1的命令行方式下验证能Ping通PC3 。 Pinging 192.168.10.30 with 32 bytes of data:
Reply from 192.168.10.30: bytes=32 time<10ms TTL=128 Reply from 192.168.10.30: bytes=32 time<10ms TTL=128
Reply from 192.168.10.30: bytes=32 time<10ms TTL=128 Reply from 192.168.10.30: bytes=32 time<10ms TTL=128
Ping statistics for 192.168.10.30:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\\>ping 192.168.10.30 !在PC2的命令行方式下验证不能Ping通PC3 。 Pinging 192.168.10.30 with 32 bytes of data:
Request timed out. Request timed out. Request timed out. Request timed out.
Ping statistics for 192.168.10.30:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
【注意事项】
两台交换机之间相连的端口应该设置为tag vlan模式。 【思考问题】
1、 二层交换网络的特点?
2、 划分VLAN 得好处有哪些?
3、 静态VLAN和动态VLAN的特点?
书写实验报告
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- 69lv.com 版权所有 湘ICP备2023021910号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务