H3C S5024P交换机 vlan实验

H3C S5024P交换机第二次vlan实验

实验1

与交换机端口G0/1和G0/2相连的PC1与PC2属于VLAN 1,与G0/3和G0/4相连的PC3和PC4属于VLAN 2,PC1、PC2、PC3、PC4在相同的网段。要求PC1、PC2之间能够互相通信,PC3、PC4之间能够互相通信,PC1、PC2和PC3、PC4之间不能通信

接线图

H3C S5024P交换机 vlan实验_第1张图片

所谓在相同的网段,就是ip地址的网络部分是一样的,这是由子网掩码决定的,由子网掩码和ip地址计算出网络部分,一样的话就叫相同的网段。

1.清除交换机的配置并重新配置交换机的基本信息

Quidway>reboot

[Quidway] sysname Switch2

 

Sw1-Vlan1]display vlan 1

VLAN State: 802.1q VLAN

VLAN ID: 1

VLAN Type: static

Route Interface: configured

IP Address: 10.0.0.2

Subnet Mask: 255.0.0.0

Tagged Ports: none

Untagged Ports:

GigabitEthernet0/1 GigabitEthernet0/2 GigabitEthernet0/3

GigabitEthernet0/4 GigabitEthernet0/5 GigabitEthernet0/6

GigabitEthernet0/7 GigabitEthernet0/8 GigabitEthernet0/9

GigabitEthernet0/10 GigabitEthernet0/11 GigabitEthernet0/12

GigabitEthernet0/13 GigabitEthernet0/14 GigabitEthernet0/15

GigabitEthernet0/16 GigabitEthernet0/17 GigabitEthernet0/18

GigabitEthernet0/19 GigabitEthernet0/20 GigabitEthernet0/21

GigabitEthernet0/22 GigabitEthernet0/23 GigabitEthernet0/24

 

<Quidway> sys            

[Quidway] sysname Switch1

[Switch1] interface Vlan-interface 1

[Switch1-Vlan-interface] ip addr 192.168.10.1 255.255.255.0

 

2.配置vlan

[switch2-Vlan1]vlan 2

[switch2-Vlan2]port g0/3

[switch2-Vlan2]port g0/4

[switch2-Vlan2]display vlan 2

 

VLAN State: 802.1q VLAN

VLAN ID: 2

VLAN Type: static

Route Interface: not configured

Tagged Ports: none

Untagged Ports:

GigabitEthernet0/3 GigabitEthernet0/4

 

3.开始ping啦

我在 192.168.10.3里

ping vlan2 同一个网能通 ping 192.168.10.5就不通

H3C S5024P交换机 vlan实验_第2张图片

 

 

实验2

PC1,PC2分别与交换机Switch1的g0/10和g0/20端口( g0/10属于VLAN3, g0/20属于VLAN2)相连,PC3和PC4与Switch2的g0/11和g0/21端口(g0/11属于VLAN2, g0/21属于VLAN3)相连,PC1、PC2 、PC3 、PC4都在相同的网段。要求PC1和PC4之间能够互相通信, PC3和PC2之间能够互相通信,请设计2种连线方法和配置.

 

方法1 trunk方法

接线图

H3C S5024P交换机 vlan实验_第3张图片

 

1.把实验1的端口从vlan2中删去 重新加入正确的端口

<switch2>vlan 2

^

% Unrecognized command found at '^' position.

<switch2>sys

Enter system view, return to user view with Ctrl+Z.

[switch2]vlan 2

[switch2-Vlan2]undo port g0/3

[switch2-Vlan2]undo port g0/4

[switch2-Vlan2]port g0/11

[switch2-Vlan2]vlan 3

[switch2-Vlan3]port g0/21

 

[switch2-Vlan3]display vlan 3

VLAN State: 802.1q VLAN

VLAN ID: 3

VLAN Type: static

Route Interface: not configured

Tagged Ports: none

Untagged Ports:

GigabitEthernet0/21

 

[switch2-Vlan3]display vlan 2

VLAN State: 802.1q VLAN

VLAN ID: 2

VLAN Type: static

Route Interface: not configured

Tagged Ports: none

Untagged Ports:

GigabitEthernet0/11

 

2.把端口配置成trunk型端口

首先要进入以太网端口视图

[switch2-Vlan3]interface g0/22

[switch2-GigabitEthernet0/22]port link-type trunk

[switch2-GigabitEthernet0/22]port trunk pvid vlan 100

[switch2-GigabitEthernet0/22]port trunk permit vlan 2 to 3 允许2和3vlan的帧通过

[switch2-GigabitEthernet0/22]

 

<switch2>sys

Enter system view, return to user view with Ctrl+Z.

[switch2]display vlan 2

VLAN State: 802.1q VLAN

VLAN ID: 2

VLAN Type: static

Route Interface: not configured

Tagged Ports:

GigabitEthernet0/22

Untagged Ports:

GigabitEthernet0/11

[switch2]display vlan 3

VLAN State: 802.1q VLAN

VLAN ID: 3

VLAN Type: static

Route Interface: not configured

Tagged Ports:

GigabitEthernet0/22

Untagged Ports:

GigabitEthernet0/21

 

可以发现配置成trunk端口 同时属于两个vlan

 

对于switch1也进行同样的配置

3.开始ping啦

可以发现同一个vlan里的电脑能互相ping同,而不同vlan里的不能ping通

 

方法2 两根网线法

接线图

H3C S5024P交换机 vlan实验_第4张图片

 

1.重新添加vlan2 和 3 的计算机

[switch2]vlan 2

[switch2-Vlan2]port g0/14

[switch2-Vlan2]vlan 3

[switch2-Vlan3]port g0/24

 

[switch2-Vlan3]display vlan 3

VLAN State: 802.1q VLAN

VLAN ID: 3

VLAN Type: static

Route Interface: not configured

Tagged Ports:

GigabitEthernet0/22

Untagged Ports:

GigabitEthernet0/21 GigabitEthernet0/24

 

[switch2-Vlan3]display vlan 2

VLAN State: 802.1q VLAN

VLAN ID: 2

VLAN Type: static

Route Interface: not configured

Tagged Ports:

GigabitEthernet0/22

Untagged Ports:

GigabitEthernet0/11 GigabitEthernet0/14

 

对switch1也做同样的配置

2.开始ping啦

我在192.168.10.3里ping

H3C S5024P交换机 vlan实验_第5张图片

7和我在vlan3里可以ping通,6和我不在一个vlan里ping不通。

 

 

你可能感兴趣的:(H3C S5024P交换机 vlan实验)