【无标题】

发布时间:2024-01-18 08:54:23

一,实验目的

实现同一 Vlan 内的主机互通,不同 Vlan 间的主机隔离。

二,配置交换机1

step1

创建vlan10,并将接口一配置为access模式,然后将接口放入vlan10

Switch#config t ?????进入配置模式

Switch(config)#vlan 10???创建vlan10

Switch(config-vlan)#end??返回全局模式

Switch#show ip int br????查看接口编号,我的是2/0/X

Switch#config t???????????????进入配置模式

Switch(config)#interface f2/0/1 ?进入1接口

Switch(config-if)#switchport mode access ??设置为access模式

Switch(config-if)#switchport access vlan 10??将1接口放入vlan10

Switch(config-if)#exit

step2

创建vlan20,并将接口一配置为access模式,然后将接口放入vlan20

Switch(config)#vlan 20????????创建vlan20

Switch(config-vlan)#int f2/0/2??进入2接口

Switch(config-if)#switchport mode access???设置为access模式

Switch(config-if)#switchport access vlan 20??将2接口放入vlan20

Switch(config)#end

Switch#show int f2/0/1 switchport ??显式1接口详细信息

Mode显式为access表示成功,查看2接口同理

step3

将11接口设置为trunk模式

选择交换机1

Switch#config t???????????进入配置模式

Switch(config)#int f2/0/11 ?进入11接口

Switch(config-if)#switch trunk encapsulation dot1q???配置封装协议为802.1Q

Switch(config-if)#switchport mode trunk ??????????设置接口模式为trunk

Switch(config-if)#switchport trunk allowed vlan all 允许所有vlan可通过

Switch(config-if)#end

Switch#show int f2/0/11 switchport??查看11接口详细信息

Mode显式trunk表示设置成功

三,配置交换机2

步骤与上述配置交换机1相同,不再赘述

四,注意点

确保四台PC处于同一网段192.168.1.X

这里四台PC的IP分别为

192.168.1.1(PC1) 192.168.1.2(PC2)

192.168.1.3(PC3) 192.168.1.4(PC4)

五,实验结果

PC1通过1接口ping ?PC2不通,因为属于不同vlan且采用access模式连接

PC1通过11接口ping ?PC3能通,因为同属vlan10且采用trunk模式连接

文章来源:https://blog.csdn.net/qq_65150735/article/details/135634401
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。