laitimes

Don't go wrong! How do I configure access, trunk, and hybird ports on Huawei switches?

author:Network Engineer - Director Guo

In the daily work of network engineers, the proficient operation of switches is commonplace, and the configuration of Huawei switches is an important criterion to test our professional standards.

Today, let's talk about the port configuration of Huawei switches. Do you sometimes feel confused when configuring switches? Or in a complex network environment, you want to manage VLANs more effectively, but you don't have the right method?

Don't go wrong! How do I configure access, trunk, and hybird ports on Huawei switches?

Don't worry, I'll help you.

Each port type of Huawei switches, such as access, trunk, and hybrid, has its own characteristics and configuration methods.

The following content will take you to understand the working principles and configuration skills of the three ports of access, trunk, and hybrid, so that you can easily cope with various challenges in your actual work.

Without further ado, let's get straight to the point. Let's take a look at how to accurately and efficiently configure Huawei switches to make your network O&M smoother.

01. Basic configuration of Huawei switches

01 Create a VLAN:

<Quidway> // User view, i.e. running commands in Quidway mode.

<Quidway>system-view //进入配置视图

[Quidway] vlan 10 // Create vlan 10 and enter the vlan10 configuration view, if vlan10 exists, go directly to the vlan10 configuration view

[Quidway-vlan10] quit //回到配置视图

[Quidway] vlan 100 /创建vlan 100,并进入vlan100配置视图,如果vlan10存在就直接进入vlan100配置视图[Quidway-vlan100] quit quit quit /回到配置视图

02 Add a port to a VLAN:

[Quidway] interface GigabitEthernet2/0/1 (10G光口)

[Quidway- GigabitEthernet2/0/1] port link-type access //定义端口传输模式

[Quidway- GigabitEthernet2/0/1] port default vlan 100 //将端口加入vlan100

[Quidway- GigabitEthernet2/0/1] quit 回到配置视图 [Quidway] interface GigabitEthernet1/0/0 //进入1号插槽上的第一个千兆网口配置视图中。 0代表1号口

[Quidway- GigabitEthernet1/0/0] port link-type access //定义端口传输模式

[Quidway- GigabitEthernet2/0/1] port default vlan 10 //将这个端口加入到vlan10中

[Quidway- GigabitEthernet2/0/1] quit

03 Add multiple ports to a VLAN

<Quidway>system-view

[Quidway]vlan 10

[Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29 //将0到29号口加入到vlan10中

[Quidway-vlan10]quit

04 Configure the IP address of the switch

[Quidway] interface Vlanif100 //进入vlan100接口视图与vlan 100命令进入的地方不同

[Quidway-Vlanif100] ip address 119.167.200.90 255.255.255.252 //定义vlan100管理IP三层 交换网关路由

[Quidway-Vlanif100] quit 返回视图

[Quidway] interface Vlanif10 //进入vlan10接口视图与vlan 10命令进入的地方不同

[Quidway-Vlanif10] ip address 119.167.206.129 255.255.255.128 //定义vlan10管理IP三层交换网关路由[Quidway-Vlanif10] quit配置默认网关:[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默认网关。

05 Switch Save Settings and Reset Commands

<Quidway>save //Save configuration information

<Quidway>reset saved-configuration /重置交换机的配置

<Quidway>reboot //Reboot the switch

06 Commonly used display commands for switches in user view mode:

<Quidway>display current-configuration //显示现在交换机正在运行的配置明细

<Quidway>display device //显示S9303各设备状态

<Quidway>display interface ? Displays the status of ports, with ? You can see the options on the heel

<Quidway>display version //查看交换机固件版本信息

<Quidway>display vlan ?//查看vlan的配置信息

07 Restore the switch to factory settings

<Quidway>reset saved-configuration /重置交换机的配置

02. VLAN division method based on port

In order to facilitate everyone's understanding, it is more clear to explain it directly with examples.

01 Networking requirements

As shown in the figure, a switch in an enterprise has many users connected to the switch, and the same service users access the enterprise network through different devices. To ensure communication security and avoid the flooding of broadcast packets, enterprises want users of the same service to access each other, but users of different services cannot access each other directly.

You can configure port-based VLAN division on the switch to assign ports connected to users with the same service to the same VLAN. In other words, users in different VLANs cannot communicate directly with each other, but users in the same VLAN can communicate with each other directly.

Don't go wrong! How do I configure access, trunk, and hybird ports on Huawei switches?

02 Configuration Procedure

Step 1

Create VLAN2 and VLAN 3 on SwitchA and add the ports connecting to the user to the VLAN. The configuration of SwitchB is similar to that of SwitchA.

[Quidway] system-view //进入配置视图

[Quidway] sysname SwitchA //给交换机命名

[SwitchA] vlan batch 2 3 /同时创建vlan2与vlan3

[SwitchA] interface ethernet 0/0/1 //进入端口0/0/1

[SwitchA-Ethernet0/0/1] port link-type access //设置端口模式为access

[SwitchA-Ethernet0/0/1] port default vlan 2 //将端口加入vlan2中

[SwitchA-Ethernet0/0/1] quit //退出

[SwitchA] interface ethernet 0/0/2 //进入端口0/0/2

[SwitchA-Ethernet0/0/2] port link-type access //端口模式为access

[SwitchA-Ethernet0/0/2] port default vlan 3 //将端口加入vlan3中

[SwitchA-Ethernet0/0/2] quit //退出

Step 2

配置SwitchA上与SwitchB连接的端口类型及通过的VLAN。 SwitchB配置与SwitchA类似,不再赘述。 [SwitchA] interface ethernet 0/0/3 //进入端口0/0/3

[SwitchA-Ethernet0/0/3] port link-type trunk //设置端口模式为trunk

[SwitchA-Ethernet0/0/3] port trunk allow-pass vlan 2 3 //trunk口允许通过vlan2与vlan3的数据包

Step 3

Verify that User1 and User2 are configured on the same CIDR block, for example, 192.168.100.0/24, and User3 and User4 are configured on the same CIDR block, for example, 192.168.200.0/24.

User1和User2能够互相ping通,但是均不能ping通User3和User4。 User3和User4能够互相ping通,但是均不能ping通User1和User2。

03. Three types of links for Ethernet

以太网端口有3种链路类型:access、trunk、hybird。

Access port: can belong to only one VLAN and is generally used to connect to computer ports.

Trunk port: allows multiple VLANs to pass through and can receive and send multiple VLAN packets, which is generally used for switches and switch-related interfaces.

Hybrid port: allows multiple VLANs to pass through, receives and sends multiple VLAN packets, and can be used to connect switches or user computers.

01 What is a link type?

VLAN link types can be divided into access links and trunk links.

1. Access link refers to the link from the switch to the user's equipment, that is, the access to the home, which can be understood as the link from the switch to the user. Since most computers cannot send frames with VLAN tags, this link can be understood as a link without VLAN tags.

2. Trunk link refers to the link from the switch to the upper-layer equipment such as the router, which can be understood as the link to the WAN. This link usually has a VLAN tag because it relies on VLANs to distinguish users or services.

02 What is a port type?

In the past, there were two main types of ports, and access and trunk ports were basically used.

1. Access port: It is a port used to connect to the user's computer on the switch, and is only used for access links.

For example, when a port belongs to VLAN 10, the data frame with VLAN 10 will be sent to the switch port, and when the data frame passes through this port, the VLAN 10 tag will be stripped off and will reach the user's computer, which is an Ethernet frame. When the user's computer sends an Ethernet frame, it goes up through this port, then this port will add a VLAN 10 tag to this frame. Frames from other VLAN tags cannot be sent to the computer from this port.

2. Trunk port: This port is the communication port between switches or between switches and upper-layer devices, and is used for trunk links.

A trunk port can have one primary VLAN and multiple secondary VLANs, which can be understood as an example.

For example, if a trunk port has primary VLAN 10 and multiple secondary VLAN 11, 12, and 30, data frames with VLAN 30 can pass through this port and VLAN 30 will not be stripped when passing through. It can also be passed when a data frame with VLAN 10 passes through this port. If a dataframe without a VLAN passes through, it will be tagged with a VLAN 10 tag on the port. This type of port exists to be used to pass multiple VLANs across switches.

It can also be seen that these two link modes correspond to two port modes, and it is not difficult to understand. The principle is understood, and when you see the switch, the configuration is completely understood after a few times.

Access and truck ports are used to distinguish the port types of switches in VLANs: truck ports are VLAN aggregation ports that are connected to other switch ports, and access ports are ports where switches are connected to hosts in VLAN domains.

Generally, trunks are tagged, and only tagged VLANs are allowed to pass through, so the port can allow multiple tagged VLANs to pass through. Access ports are generally untagged ports, and only one Access VLAN port is allowed to pass through.

03 access,trunk,hybid是三种端口属性

A port with access can belong to only one VLAN and the port can be tagged.

A trunk port can belong to multiple VLANs, and all ports are tagged.

A port with the nature of HYBID can belong to multiple VLANs, and whether the port is tagged in the VLAN depends on the specific situation.

04 Understand the three port modes of the switch: Access, Hybrid, and Trunk

There are three modes for ports: access, hybrid, and trunk. An access port can belong to only one VLAN, and the port can not be tagged, and the trunk can belong to multiple VLANs and receive and send packets from multiple VLANs, which is generally used for connections between switches. Hybrids can also belong to multiple VLANs and can receive and send packets from multiple VLANs for connections between switches or between switches and user computers.

The main difference between trunk and hybrid is that a hybrid port allows packets from multiple VLANs to be untagged, while a trunk port allows packets from default VLANs to be untagged.

05 How is this port configured on the switch?

To add a port to a VLAN:

[Quidway] interface GigabitEthernet2/0/1 (10G光口)

[Quidway- GigabitEthernet2/0/1] port link-type access //定义端口传输模式

[Quidway- GigabitEthernet2/0/1] port default vlan 100 //将端口加入vlan100

[Quidway- GigabitEthernet2/0/1] quit 回到配置视图

Pay attention to the good of the industry: IT operation and maintenance base camp, get the 60 G "Network Engineering System Gift Package", and leave a message to listen to HCIA+CCNA for free

Redirected from: https://mp.weixin.qq.com/s/TWY2TgPAyl305ExKRtixkQ

Read on