赞
踩
创建由一个交换机和四个PC构成的拓扑图:其中交换机选择S5700。给四个PC命名,使用调色板划分VLAN,分为两个VLAN(VLAN10和VLAN30),给每一个PC设置IP地址:
其中PC的IP地址如下图所示:
相同VLAN下的网关相同,每一个PC的IP地址可以参照下图:
设置好每一个PC的IP地址后,区域选中刚刚配置好的拓扑图,点击开启设备,待拓扑图中每根连线的红灯变成绿灯,可进行下一步操作。
将拓扑图中属于VLAN10的两台PC连接到VLAN10的区域中,双击打开交换机(LSW1),打开命令行,代码如下:
1.进入编写模式
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]
2.划分VLAN10和VLAN30 :
[Huawei]vlan 10
[Huawei-vlan10]
Oct 22 2021 23:05:08-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 4, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-vlan10]q
[Huawei]vlan 30
[Huawei-vlan30]
Oct 22 2021 23:05:18-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 5, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-vlan30]q
3.将10-1加入到VLAN10中
[Huawei]int g 0/0/09
[Huawei-GigabitEthernet0/0/9]port link-type acc
[Huawei-GigabitEthernet0/0/9]port link-type access
[Huawei-GigabitEthernet0/0/9]
Oct 22 2021 22:40:20-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 6, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/9]port def vlan 10
[Huawei-GigabitEthernet0/0/9]
Oct 22 2021 22:40:30-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 7, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/9]q
输入dis vlan 可以查看结果:
在拓扑图中双击PC-10-1打开命令行,输入ping 192.168.10.12查看是否能ping通
不同vlan中的PC不能彼此ping通。
通过上述代码可以将交换机2(LSW2)连接成一个整体,通过下面的代码,将LSW1和LSW2连接起来,分别在LSW1和LSW2中输入下面的代码,可以实现连接。
[Huawei]int g 0/0/24
[Huawei-GigabitEthernet0/0/24]port link-type trunk
[Huawei-GigabitEthernet0/0/24]
Oct 22 2021 23:15:28-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 14, t
he change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/24]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/24]
Oct 22 2021 23:15:58-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 15, t
he change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/24]q
[Huawei]
完成上述操作后,整个拓扑图成为一个整体,选中整个拓扑图,点击开启设备,可以将整个设备启动。等待每条线上的绿灯亮起来,就可以后续实验。
鼠标右键单击LSW1数据抓包选中0/0/9端口和0/0/24端口,使用VLAN 10下的10-1 ping 10-3 通过软件我们可以看到数据的传输过程:
选中带有标记的以太网帧,我们可以看到VLAN ID(刚才我们选中0/0/9和0/0/24两个端口,我们会发现数据抓包也是两幅图):
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。