VLAN configured on eNSP Trunk port

1. Experiment: switch in different people in different departments can communicate with each other, we need to configure links between switches, cross switches for inter-VLAN communication

2. Experimental topology

 

 

 3. Experimental configuration

Configure the IP addresses of all the PC according to experiments addressing table editor

Addressing the table below:

 

 

 

 

 

 Experimental Procedure

1) Basic Configuration

The addressing table after the experiment configured, ping command to check the connectivity of each of the direct link. (A word of caution for interconnection between PC until no division VLAN) as shown below: (PC1 and PC2ping pass, the remaining operations are omitted)

 

 

 2) Create a VLAN, configure the Access Interface

In an example where S1 division VLAN, Configuration Access Interface

<Huawei>sys
[Huwei]sysname S1                                      //更改交换机名称
 
[S1]vlan batch 10 20                                   //创建vlan10 和 vlan20
[S1]interface Ethernet0/0/2
[S1-Ethernet0/0/2]port link-type access
[S1-Ethernet0/0/2]port default vlan 10
[S1-Ethernet0/0/2]quit

[S1]interface Ethernet0/0/3                        //进入接口0/0/3
[S1-Ethernet0/0/3]port link-type access       //设置接口类型
[S1-Ethernet0/0/3]port default vlan 20        //划分到vlan 20 
[S1-Ethernet0/0/3]quit

[S1]display vlan                                   //查看vlan 

创建完成之后如下图:

 

 

 S2、S3如上步骤同样配置

之后我们在PC1上ping命令PC2发现ping不通,因为他们不被划分在同一个vlan下

 

 

但是我们再继续测试一下划分在相同VLAN的PC1和PC3,如下图所示:

 

 

 发现也不能ping通

 这是因为目前在该跨交换机实现不同VLAN通信的二层组网拓扑中,虽然与PC端相连的交换机接口上创建并划分了VLAN信息,但是在交换机与交换机之间相连的接口上并没有相应的VLAN信息,不能够识别和发送跨越交换机的VLAN报文,此时VLAN只具有在每台交换机上的本地意义,无法实现相同VLAN的跨交换机通信。

       为了让交换机之间能够识别和发送跨交换机的VLAN报文,需要将交换机之间相连的接口配置成Trunk接口。配置时要明确被允许的VLAN,实现对VLAN流量传输的控制。

配置Trunk接口

在S1上配置E0/0/1为 Trunk接口,允许VLAN10 和VLAN 20通过

[S1]interface Ethernet 0/0/1
[S1-Ethernet0/0/1]port link-type trunk
[S1-Ethernet0/0/1]port trunk allow-pass vlan 10 20

S2交换机配置同上,然后查看vlan如下图:

 

 接下来在S3上配置GE0/0/1 和GE0/0/2 为Trunk接口,并且允许所有VLAN通过

[S3]interface GigabitEthernet 0/0/1
[S3-GigabitEthernet0/0/1]port link-type trunk
[S3-GigabitEthernet0/0/1]port trunk allow-pass vlan all

[S3]interface GigabitEthernet 0/0/2
[S3-GigabitEthernet0/0/2]port link-type trunk
[S3-GigabitEthernet0/0/2]port trunk allow-pass vlan all

查看VLAN如下图所示:

 

 

 下面我们来测试一下PC1和PC3之间能不能ping通,测试结果如下图所示;

 

 发现能够ping通了!

 以上就是实验全部内容了,赶紧试一下吧~

Guess you like

Origin www.cnblogs.com/Ghost-m/p/11960318.html