实验目的

在交换机上连接有pc0、pc1、pc2和pc3四台计算机,如何让连接在交换机上的pc0和pc1相互之间可以通信,pc2和pc3相互之间可以通信,而pc0、pc1和pc2、pc3却不能通信?实现上述功能后,删除pc0所在的vlan。

实验拓扑

  • 按照“实验目的”进行拓扑连接,截取模拟软件中的实验拓扑图

实验数据:

  • 填写实验过程中各计算机具体使用的ip地址和子网掩码
Pc0:
ip地址:192.168.1.101

子网掩码:255.255.255.0

Pc1:
ip地址:192.168.1.102

子网掩码:255.255.255.0

Pc2:
ip地址:192.168.1.103

子网掩码:255.255.255.0

Pc3:
ip地址:192.168.1.104

子网掩码:255.255.255.0

实验步骤:

  1. 创建四台PC一台交换机,将所有PC连接到交换机并分配IP

  2. 创建Vlan 10 和 Vlan 20 ,涉及的命令如下:

enable

conf term

vlan 10

vlan 20
  1. 分别进入四台PC所在的四个交换机端口,设置其所在的Vlan,PC 1、2同在Vlan10,PC 3、4同在Vlan20,涉及的命令如下:
conf term 

interface fastethernet0/1

switchport access vlan 10

no shutdown

exit

interface fastethernet0/2

switchport access vlan 10

no shutdown

exit

interface fastethernet0/3

switchport access vlan 20

no shutdown

exit

interface fastethernet0/4

switchport access vlan 20

no shutdown

exit
  1. 删除pc0所在的vlan
interface fastethernet0/1

no switch access vlan 10

exit

no vlan 10

实验验证:

给出验证截图(ping命令及结果截图)

  1. 进入pc0,打开cmd,分别尝试ping pc1、pc2和pc3
ping 192.168.1.102 可以ping通

ping 192.168.1.103 ping不通

ping 192.168.1.104 ping不通
  1. 进入pc2,打开cmd,分别尝试ping pc0、pc1和pc3
ping 192.168.1.103 可以ping通

ping 192.168.1.101 ping不通

ping 192.168.1.102 ping不通