基于eNSP的相关计算机网络实验

折柳 · 2019-9-21 · 次阅读


基于eNSP的相关计算机网络实验

   这个实验记录随着学习进度的进行不断进行更新,主要为基于华为eNSP环境下进行的熟悉计算机网络的相关实验,这个实验主要为熟悉掌握计算机网络的结构和工作原理,深入理解交换机、路由器、无限网络的工作原理,目前这个实验包括下面几个内容:

  • 单台PC机联通交换机的实验配置
  • 单台交换机上使用VLAN来隔离PC
  • 跨交换机实现不同VLAN的通信与隔离
  • 不同VLAN间实现通信

实操图如下 (#^_^#)
f
f

单台PC机联通交换机的实验配置

相关操作如下所示:

  1. 进入系统视图
  2. 交换机接口配置
  3. 添加交换机虚拟ip
  4. 尝试ping

a

   在eNSP上交换机的设置脚本如下所示:

The device is running!

<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]
May 14 2019 10:26:17-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]
May 14 2019 10:27:07-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/1]interface vlanif1
[sw1-Vlanif1]ip address 10.10.10.6 255.255.255.0
[sw1-Vlanif1]
May 14 2019 10:28:58-08:00 sw1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface Vlanif1 has entered the UP state.
[sw1-Vlanif1]display currn
May 14 2019 10:29:07-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 409
#
sysname sw1
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
 ip address 10.10.10.6 255.255.255.0

[sw1-Vlanif1] User interface con0 is available

a

a


单台交换机上使用VLAN来隔离PC

相关操作如下所示:

  1. 在单台交换机上使用不同的vlan域来对进行PC隔离
  2. 交换机端口配置
  3. 配置PC的ip地址
  4. 划分vlan区域

b
   在eNSP上交换机的设置脚本如下所示:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]
May 14 2019 10:33:37-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 10
[sw1-Ethernet0/0/1]
May 14 2019 10:34:07-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 20
[sw1-Ethernet0/0/2]
May 14 2019 10:34:27-08:00 sw1 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 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/2]int e0/0/3
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]
May 14 2019 10:34:47-08:00 sw1 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 10, the 
change loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/3]port default vlan 10
[sw1-Ethernet0/0/3]
May 14 2019 10:34:53-08:00 sw1 %%01IFNET/4/IF_STATE(l)[0]:Interface Vlanif1 has 
turned into DOWN state.
May 14 2019 10:34:57-08:00 sw1 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 11, the 
change loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/3] User interface con0 is available

b
b
b

实现效果图如下所示:

b


跨交换机实现不同VLAN的通信与隔离

相关操作如下所示:

  1. 配置两台交换机的接口VLAN
  2. 配置交换机与PC的端口连接
  3. 配置交换机端口间的连接方式
  4. 配置PC的ip地址
  5. 验证PC机两两之间的连通性

c

  在这里解释一下两台交换机之间进行的trunk,trunk是端口进行汇聚的意思,它允许交换机与交换机、交换机与路由器、主机与交换机或路由器之间通过两个或多个端口并行进行连接,同时传输来提供更高的带宽、更大的吞吐量,大幅度提高整个网络能力。VLAN trunk是指设置了多个VLAN之后,想通过一个端口来传输我们设置的多个VLAN,我们就需要在交换机这里设置这个端口为trunk。trunk技术使得一条物理线路可以传送多个VLAN的数据,更加具体的细节你想了解的话可以去查查资料。

   在eNSP上交换机的设置脚本如下所示:

<Huawei>sys 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]
May 14 2019 10:38:37-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default v
May 14 2019 10:39:17-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
                                  ^
Error:Incomplete command found at '^' position.
[sw1-Ethernet0/0/1]q
[sw1]
[sw1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]
May 14 2019 10:39:37-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/1]port default vlan 10
[sw1-Ethernet0/0/1]
May 14 2019 10:39:47-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port defa
May 14 2019 10:40:07-08:00 sw1 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 8, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-port-group-defa]port default vlan 20
[sw1-port-group-defa]q
[sw1]
May 14 2019 10:40:17-08:00 sw1 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 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port default vlan 20
[sw1-Ethernet0/0/2]int e
May 14 2019 10:40:37-08:00 sw1 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 10, the 
change loop count is 0, and the maximum number of records is 4095.
                   ^
Error: Unrecognized command found at '^' position.
[sw1-Ethernet0/0/2]int e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk
[sw1-Ethernet0/0/3]port trunk
May 14 2019 10:43:57-08:00 sw1 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 11, the 
change loop count is 0, and the maximum number of records is 4095.
[sw1-port-group-trunk]port trunk allow-pass 
May 14 2019 10:44:07-08:00 sw1 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 12, the 
change loop count is 0, and the maximum number of records is 4095.
                                            ^
Error:Incomplete command found at '^' position.
[sw1-port-group-trunk]q
[sw1]int e0/0/3
[sw1-Ethernet0/0/3]port trunk allow-pass vlan 10 20
[sw1-Ethernet0/0/3]
May 14 2019 10:44:37-08:00 sw1 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 13, the 
change loop count is 0, and the maximum number of records is 4095.

另一个交换机的设置也是差不多的,这里就不展示了

c
c
c


不同VLAN间实现通信

相关操作如下所示:

  1. 交换机接口配置
  2. 创建多个VLAN域
  3. 设置PC的ip地址、网关配置

d

   在eNSP上交换机的设置脚本如下所示:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]
May 14 2019 10:50:47-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]
May 14 2019 10:50:57-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]
May 14 2019 10:51:17-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/1]port default vlan 10
[sw1-Ethernet0/0/1]int
May 14 2019 10:51:37-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
                   ^
Error: Unrecognized command found at '^' position.
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port 
May 14 2019 10:51:57-08:00 sw1 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 8, the c
hange loop count is 0, and the maximum number of records is 4095.
                        ^
Error:Incomplete command found at '^' position.
[sw1-Ethernet0/0/2]port default vlan 20
[sw1-Ethernet0/0/2]
May 14 2019 10:52:06-08:00 sw1 %%01IFNET/4/IF_STATE(l)[0]:Interface Vlanif1 has 
turned into DOWN state.
May 14 2019 10:52:07-08:00 sw1 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 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/2]int vlanif10
[sw1-Vlanif10]
May 14 2019 10:52:21-08:00 sw1 %%01IFNET/4/IF_STATE(l)[1]:Interface Vlanif10 has
 turned into UP state.
[sw1-Vlanif10]ip address 192.168.1.254 24
[sw1-Vlanif10]
May 14 2019 10:53:16-08:00 sw1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
 on the interface Vlanif10 has entered the UP state.
May 14 2019 10:53:17-08:00 sw1 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 10, the 
change loop count is 0, and the maximum number of records is 4095.
[sw1-Vlanif10]int  vlanif20
[sw1-Vlanif20]
May 14 2019 10:53:28-08:00 sw1 %%01IFNET/4/IF_STATE(l)[3]:Interface Vlanif20 has
 turned into UP state.
[sw1-Vlanif20]ip address 192.168.2.254 24
[sw1-Vlanif20]
May 14 2019 10:53:57-08:00 sw1 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
 on the interface Vlanif20 has entered the UP state.
May 14 2019 10:53:57-08:00 sw1 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 11, the 
change loop count is 0, and the maximum number of records is 4095.
[sw1-Vlanif20]q
[sw1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           unassigned           down       down      
Vlanif10                          192.168.1.254/24     up         up        
Vlanif20                          192.168.2.254/24     up         up        
[sw1]

d
d
d


以太网链路聚合

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1
[sw1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]
May 15 2019 13:18:09-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 1
May 15 2019 13:18:39-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.0
[sw1-Ethernet0/0/1]port default vlan 10
[sw1-Ethernet0/0/1]
May 15 2019 13:18:49-08:00 sw1 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 20
[sw1-Ethernet0/0/2]q
[sw1]
May 15 2019 13:19:09-08:00 sw1 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 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]port link-type trunk
[sw1-Eth-Trunk1]port trunk allow-pas
May 15 2019 13:19:49-08:00 sw1 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 10, the 
change loop count is 0, and the maximum number of records is 4095.
                                     ^
Error:Incomplete command found at '^' position.
[sw1-Eth-Trunk1]port trunk allow-pass vlan 10 20
[sw1-Eth-Trunk1]
May 15 2019 13:19:59-08:00 sw1 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 11, the 
change loop count is 0, and the maximum number of records is 4095.
[sw1-Eth-Trunk1]q
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1-GigabitEthernet0/0/1]
May 15 2019 13:20:20-08:00 sw1 %%01IFNET/4/IF_STATE(l)[0]:Interface Eth-Trunk1 h
as turned into UP state.
[sw1-GigabitEthernet0/0/1]int g0/0/
May 15 2019 13:20:29-08:00 sw1 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 12, the 
change loop count is 0, and the maximum number of records is 4095.
                          ^
Error: Unrecognized command found at '^' position.
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1-GigabitEthernet0/0/2]
The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw2
[sw2]
May 15 2019 13:21:39-08:00 sw2 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]
May 15 2019 13:21:49-08:00 sw2 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, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 10
[sw2-Ethernet0/0/1]int
May 15 2019 13:22:19-08:00 sw2 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, the c
hange loop count is 0, and the maximum number of records is 4095.
                   ^
Error: Unrecognized command found at '^' position.
[sw2-Ethernet0/0/1]int e0/0/2
[sw2-Ethernet0/0/2]port link-type access
[sw2-Ethernet0/0/2]int
May 15 2019 13:22:29-08:00 sw2 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 8, the c
hange loop count is 0, and the maximum number of records is 4095.
                   ^
Error: Unrecognized command found at '^' position.
[sw2-Ethernet0/0/2]port default vlan 20
[sw2-Ethernet0/0/2]
May 15 2019 13:22:39-08:00 sw2 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 9, the c
hange loop count is 0, and the maximum number of records is 4095.q
[sw2]int Eth-trunk 1
[sw2-Eth-Trunk1]port trunk allow-pass vlan 10 20
                     ^
Error: Unrecognized command found at '^' position.
[sw2-Eth-Trunk1]port link-type trunl
                               ^
Error: Unrecognized command found at '^' position.
[sw2-Eth-Trunk1]port link-type trunk
[sw2-Eth-Trunk1]port trunk allow-pass vlan 10 20
[sw2-Eth-Trunk1]q
[sw2]int g0/0/
May 15 2019 13:25:19-08:00 sw2 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 11, the 
change loop count is 0, and the maximum number of records is 4095.
         ^
Error: Wrong parameter found at '^' position.
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2-GigabitEthernet0/0/1]
May 15 2019 13:25:34-08:00 sw2 %%01IFNET/4/IF_STATE(l)[0]:Interface Eth-Trunk1 h
as turned into UP state.
[sw2-GigabitEthernet0/0/1]
May 15 2019 13:25:39-08:00 sw2 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 12, the 
change loop count is 0, and the maximum number of records is 4095.
[sw2-GigabitEthernet0/0/1]int g0/0/2
[sw2-GigabitEthernet0/0/2]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2-GigabitEthernet0/0/2]
May 15 2019 13:25:59-08:00 sw2 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 13, the 
change loop count is 0, and the maximum number of records is 4095.
[sw2-GigabitEthernet0/0/2]display eth-trunk 1
Eth-Trunk1 s state information is:
WorkingMode: NORMAL         Hash arithmetic: According to SIP-XOR-DIP         
Least Active-linknumber: 1  Max Bandwidth-affected-linknumber: 8              
Operate status: up          Number Of Up Port In Trunk: 2                     
--------------------------------------------------------------------------------
PortName                      Status      Weight 
GigabitEthernet0/0/1          Up          1      
GigabitEthernet0/0/2          Up          1      

[sw2-GigabitEthernet0/0/2] User interface con0 is available
Please Press ENTER.

利用hybrid来实现

实验步骤
[sw1]vlan batch 5 10
[sw1]interface GigabitEthernet 0/0/1
[sw1-GigabitEthernet0/0/1]port hybrid pvid vlan 5 //确保该端口的入向数据打标签 valn5
[sw1-GigabitEthernet0/0/1]port hybrid untagged vlan 5 //确保交换机之间的链路转发数据出去时 携带标签vlan 5 为了让sw2识别

[sw1]interface GigabitEthernet 0/0/24

[sw1-GigabitEthernet0/0/24]port hybrid tagged vlan 5

[sw1]interface GigabitEthernet 0/0/2
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 10
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 10

[sw1]interface GigabitEthernet 0/0/24

[sw1-GigabitEthernet0/0/24]port hybrid tagged vlan 10

[sw2]vlan batch 5 10
[sw2]interface GigabitEthernet 0/0/3
[sw2-GigabitEthernet0/0/3]port hybrid pvid vlan 5
[sw2-GigabitEthernet0/0/3]port hybrid untagged vlan 5 //sw2收到后携带标签vlan 5 的数据后 将其拆除 在g0/0/3发出去

[sw2]interface GigabitEthernet 0/0/24

[sw2-GigabitEthernet0/0/24]port hybrid tagged vlan 5

[sw2]interface GigabitEthernet 0/0/4
[sw2-GigabitEthernet0/0/4]port hybrid pvid vlan 10
[sw2-GigabitEthernet0/0/4]port hybrid untagged vlan 10

[sw2]interface GigabitEthernet 0/0/24
[sw2-GigabitEthernet0/0/24]port hybrid tagged vlan 10

实验结果:
PC1–PC3互通 PC2–PC4互通

总结

之后做完实验再写 Orz


一个好奇的人