Port Vlan是实现VLAN的方式之一,Port Vlan是利用交换机的端口进行VLAN的划分,一个端口只能属于一个VLAN。
Tag Vlan是基于交换机端口的另外一种类型,主要用于实现跨交换机的相同VLAN内主机之间可以直接访问,同时对于不同VLAN的主机进行隔离。Tag Vlan遵循了IEEE802.1q协议的标准。在利用配置了Tag vlan的接口进行数据传输时,需要在数据帧内添加4个字节的802.1q标签信息,用于标识该数据帧属于哪个VLAN,以便于对端交换机接收到数据帧后进行准确的过滤。 【实验步骤】
步骤1:配置两台交换机的主机名 配置第一台交换机
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Switch (config)#host s1 SwitchA (config)# 配置第二台交换机
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#host s2 SwitchB (config)#
步骤2:在SwitchA交换机上划分VLAN 添加端口
SwitchA (config)#vlan 10
SwitchA (config-vlan)#name xiaoshou !划分销售部的VLAN 10 SwitchA (config-vlan)#vlan 20
SwitchA (config-vlan)#name jishu !划分技术部的VLAN 20 SwitchA (config-vlan)#exit SwitchA (config)#
SwitchA (config)#interface range fastEthernet 0/6-10 SwitchA (config-if-range)#switchport mode access SwitchA (config-if-range)#switchport access vlan 10 SwitchA (config-if-range)#exit
SwitchA (config)#interface range fastEthernet 0/11-15 SwitchA (config-if-range)#switchport mode access SwitchA (config-if-range)#switchport access vlan 20 SwitchA (config-if-range)#exit SwitchA (config)#
!将端口Fa0/11至Fa0/15划分到VLAN 20 !将端口Fa0/6至Fa0/10划分到VLAN 10
步骤3:在SwitchB交换机上划分VLAN添加端口
SwitchB(config)#vlan 10
SwitchB (config-vlan)#name xiaoshou SwitchB (config-vlan)#vlan 20 SwitchB (config-vlan)#name jishu SwitchB (config-vlan)#exit SwitchB (config)#
SwitchB (config)#interface range fastEthernet 0/6-10 SwitchB (config-if-range)#switchport mode access SwitchB (config-if-range)#switchport access vlan 10 SwitchB (config-if-range)#exit
SwitchB (config)#interface range fastEthernet 0/11-15 SwitchB (config-if-range)#switchport mode access SwitchB (config-if-range)#switchport access vlan 20 SwitchB (config-if-range)#exit SwitchB config)#
!将端口Fa0/11至Fa0/15划分到VLAN 20 !将端口Fa0/6至Fa0/10划分到VLAN 10
!划分技术部的VLAN 20
!划分销售部的VLAN 10
步骤4:设置交换机之间的链路为Trunk SwitchA(config)#interface fastEthernet 0/24 SwitchA (config-if)#switchport mode trunk SwitchA (config-if)#exit SwitchA (config)#
SwitchB (config)#interface fastEthernet 0/24 SwitchB (config-if)#switchport mode trunk SwitchB (config-if)#exit SwitchB (config)#
步骤5:查看VLAN和Trunk的配置 SwitchB #show vlan
将显示结果粘贴或以截图的形式附在下面 SwitchB #
SwitchB #show interfaces fastEthernet 0/1 switchport 将显示结果粘贴或以截图的形式附在下面 PC>ipconfig
IP Address......................: 192.168.1.20 Subnet Mask.....................: 255.255.255.0 Default Gateway.................: 0.0.0.0
PC>ping 192.168.1.40
Pinging 192.168.1.40 with 32 bytes of data:
Reply from 192.168.1.40: bytes=32 time=93ms TTL=128 Reply from 192.168.1.40: bytes=32 time=94ms TTL=128 Reply from 192.168.1.40: bytes=32 time=94ms TTL=128 Reply from 192.168.1.40: bytes=32 time=78ms TTL=128
Ping statistics for 192.168.1.40:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 78ms, Maximum = 94ms, Average = ms PC>ping 192.168.30
Ping request could not find host 192.168.30. Please check the name and try again. PC>ping 192.168.1.30
Pinging 192.168.1.30 with 32 bytes of data:
Request timed out. Request timed out. Request timed out. Request timed out.
Ping statistics for 192.168.1.30:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), PC>
SwitchA #show vlan
将显示结果粘贴或以截图的形式附在下面 SwitchA #
SwitchA #show interfaces fastEthernet 0/1 switchport 将显示结果粘贴或以截图的形式附在下面
PC>ping 192.168.1.40
Pinging 192.168.1.40 with 32 bytes of data:
Reply from 192.168.1.40: bytes=32 time=187ms TTL=128 Reply from 192.168.1.40: bytes=32 time=62ms TTL=128 Reply from 192.168.1.40: bytes=32 time=93ms TTL=128 Reply from 192.168.1.40: bytes=32 time=94ms TTL=128
Ping statistics for 192.168.1.40:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 62ms, Maximum = 187ms, Average = 109ms
PC>ping 192.168.1.40
Pinging 192.168.1.40 with 32 bytes of data:
Reply from 192.168.1.40: bytes=32 time=94ms TTL=128 Reply from 192.168.1.40: bytes=32 time=94ms TTL=128 Reply from 192.168.1.40: bytes=32 time=93ms TTL=128 Reply from 192.168.1.40: bytes=32 time=78ms TTL=128
Ping statistics for 192.168.1.40:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 78ms, Maximum = 94ms, Average = ms
PC>ping 192.168.1.30
Pinging 192.168.1.30 with 32 bytes of data:
Request timed out. Request timed out. Request timed out. Request timed out.
Ping statistics for 192.168.1.30:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), PC> 步骤6:验证配置 测试相应PC机的连通性 PC1 PC2 PC3 PC4 【注意事项】 1.交换机所有的端口在默认情况下属于ACCESS端口,可直接将端口加入某一VLAN。利用switchport mode access/trunk命令可以更改端口的VLAN模式。 2.VLAN1属于系统的默认VLAN,不可以被删除 3.删除某个VLAN,使用no命令。例如:switch(config)#no vlan 10 4.删除当前某个VLAN时,注意先将属于该VLAN的端口加入别的VLAN,再删除VLAN。 5.两台交换机之间相连的端口应该设置为tag vlan模式。 6.Trunk接口在默认情况下支持所有VLAN的传输。 【拓展训练】 PC1 / PC2 / PC3 / PC4 / 要求: 1、在三个交换机分别划分两个VLAN,分别为VLAN10和VLAN20 2、将三个交换机上的Fa0/6至Fa0/10端口划分到VLAN10中,将Fa0/11到Fa0/15端口划分到VLAN20中。 3、实现效果为PC1、PC3和PC5之间可以互通,PC2和PC4之间可以互通。但PC1、PC3、PC5与PC2、PC4之间不能互通。
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- 69lv.com 版权所有 湘ICP备2023021910号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务