Article Overview

Huawei switch fiber ports can operate in either Layer 2 mode for VLAN-based switching or Layer 3 mode for routing, with mode switching supported on specific high-end models.

Layer 2 Mode

In Layer 2 mode, a Huawei fiber port functions as a standard Ethernet interface that forwards frames based on MAC addresses. By default, all Ethernet interfaces belong to VLAN 1 and can be assigned to other VLANs for traffic segmentation. Layer 2 ports are ideal for connecting endpoints like PCs, servers, or access points within the same VLAN. Key points include:

  • VLAN membership controls broadcast domains and isolates traffic between VLANs.
  • Layer 2 ports can be configured as access ports (single VLAN) or trunk ports (multiple VLANs) for inter-switch connections.
  • Commands to configure Layer 2 mode typically include entering the interface view and setting the port link type to access or trunk ( ).

Layer 3 Mode

In Layer 3 mode, the fiber port acts as a routable interface, capable of forwarding packets based on IP addresses. This mode is used for inter-VLAN routing or connecting different network segments. Key aspects include:

  • Assign an IP address to the interface to serve as a gateway for connected devices.
  • The interface is removed from VLAN 1 only after Layer 3 protocols are active.
  • Layer 3 mode is supported on specific Huawei switch models such as S5731-H, S5732-H, S6735-S, S6720-EI, and S6730-H ( ).
  • Commands include undo portswitch to enable Layer 3 mode, followed by ip address <IP> <mask> to assign the interface IP ( ).

Switching Between Layer 2 and Layer 3

Huawei switches allow certain interfaces to switch between Layer 2 and Layer 3 modes:

  1. Enter system view: system-view
  2. Select the interface: interface gigabitethernet 0/0/20
  3. Switch to Layer 3: undo portswitch (for supported interfaces)
  4. Switch back to Layer 2: portswitch or configure as access/trunk
  5. Clear any service configurations (like trunk settings) before switching modes to avoid conflicts ( ).

Inter-VLAN Routing

For Layer 3 switches, VLANIF interfaces are created to enable routing between VLANs:

  • Each VLAN requires a VLANIF interface with an assigned IP address.
  • Devices in different VLANs use the VLANIF IP as their default gateway.
  • This allows Layer 3 switches to perform inter-VLAN routing without relying on external routers ( ).

Summary

  • Layer 2 ports: MAC-based switching, VLAN segmentation, access/trunk configuration.
  • Layer 3 ports: IP-based routing, gateway assignment, inter-VLAN communication.
  • Mode switching: Supported on high-end Huawei switches; requires clearing service configurations and using system/interface commands.
  • Use case: Layer 2 for local LAN traffic, Layer 3 for routing between VLANs or network segments. By understanding these modes and commands, network engineers can configure Huawei fiber ports to optimize both switching efficiency and routing capabilities in enterprise networks.

Huawei Technical Support

Huawei Technical Support

Layer 2 vs Layer 3 Huawei Switches Deep Dive: Internal ASIC

To objectively evaluate the capabilities of Huawei Layer 2 and Layer 3 switches, we must analyze specific hardware metrics. The

Layer 3 Switching

Layer 3 switches divide a Layer 2 network into multiple VLANs. They implement Layer 2 switching within the VLANs and Layer 3 IP

Difference between layer-2 and layer-3 switches

Layer 2 switches operate at the data link layer, forwarding data based on MAC addresses, while layer 3 switches route

Switching an Interface Between Layer 2 and Layer 3 Modes

An Ethernet interface works as a Layer 2 interface in Layer 2 mode and a Layer 3 interface in Layer 3 mode. To switch between

Example for Switching an Interface to Layer 3 Mode

Example for Switching an Interface to Layer 3 Mode Networking Requirements In Figure 2-12, PC1, PC2, and PC3 are

Huawei eNSP-Layer 3 switching configuration

Because Huawei switch ports work in Layer 2 mode by default, when we need to use Layer 3 functions, we need to switch the

Example for Configuring a Layer 3 Switch to Work with a Router for

Layer 3 Switch Layer 3 switches provide the routing function, which indicates a network-layer function in the OSI

Configuring Layer 2/Layer 3 Mode Switching on an Ethernet Interface

The mode switching function takes effect when the interface only has attribute configurations, such as shutdown and description

Layer 2 Switching

Layer 2 Switching A Layer 2 device works at the second layer of the OSI model and forwards data packets based on media access

Layer 2 vs Layer 3 Huawei Switches Deep Dive: Internal ASIC

This deep technical review dissects the internal ASIC forwarding logic, packet processing pipelines, and specific performance metrics

Example for Switching an Interface to Layer 3 Mode

To enable SwitchA and SwitchB to communicate with each other and provide high link bandwidth, Layer 3 Eth-Trunk

Huawei Layer 3 Switch Layer 2 and Layer 3 Port Switching

Because Huawei switch ports work in Layer 2 mode by default, when we need to use Layer 3 functions, we need to switch the

Switching an Ethernet Interface to Layer 3 Mode

Switching an Ethernet Interface to Layer 3 Mode Context Due to hardware restrictions of interface cards, some Ethernet interfaces

Configuring Layer 2/Layer 3 Mode Switching on an Ethernet Interface

Determine whether to switch the working mode of an interface between Layer 2 and Layer 3 based on the interface type. Eth-Trunk

Example for Switching an Interface Between Layer 2 and Layer 3

If service configurations (such as the port link-type trunk configuration) exist on an interface, clear all service configurations before

Huawei router and switch connection configuration plan, two

Today, Linknewnet engineers teach you 2 ways. If the switch under the router is a Layer 2 device, there are two ways

Layer 3 Switching

Layer 3 Switching Background of Layer 3 Switches In early stage of network deployment, most local area networks (LANs) were

L1 vs L2 vs L3 Switches: Key Differences Explained Simply

Confused between L1, L2, and L3 switches? Learn the key differences, features, and use cases to pick the right one

How to switch layer 2 and layer 3 ports of Huawei layer 3

Based on the hardware structure of the interface board, the interface on some forms of equipment can only be used

Example for Configuring a Layer 3 Switch to Work with a Router for

Example for Configuring a Layer 3 Switch to Work with a Router for Internet Access Layer 3 Switch Layer 3 switches provide the

Example for Configuring a Layer 2 Switch to Work with a Router for

Configure interface-based VLAN assignment on the switch for Layer 2 forwarding. Configure the router as the gateway of users to

How to switch layer 2 and layer 3 ports of Huawei layer 3

After entering the interface mode, the interface is in layer 2 status by default, use the command undo portswitch to

Method of Configuring both Layer 2 and Layer 3 Multicast on S Series

This document uses Huawei S7700 series switches as an example to describe how to configure both Layer 2 and Layer 3 multicast

Huawei Layer 3 Switch Guide: How to Choose the Right One

A Huawei Layer 3 switch combines switching (Layer 2 forwarding by MAC address) and routing (Layer 3 forwarding

Layer 2/3 Port

Layer 2/3 Port In the navigation tree on the left, choose Advanced > LAN > Layer 2/3 Port. In the pane on the right, check whether

Switching an Interface Between Layer 2 and Layer 3 Modes

To switch between Layer 2 and Layer 3 modes on multiple interfaces, run the portswitch batch command in the system view. IP

Example for Configuring a Layer 2 Switch to Work with a Router for

This guide provides steps to configure a Layer 2 switch with a router for seamless internet access.

VLAN Routing with Layer 3 Switch on Huawei

In this lesson we will learn Layer 3 VLAN Routing with VLAN Routing Huawei Configuration Example. We do not need any other

Related Resources

Ready to Deploy Your Modular Data Center?

Request a free quote for micro‑module pods, containerized edge shelters, cold/hot aisle containment, 19″ racks, intelligent PDUs, environment monitoring, or complete modular systems. EU‑owned Polish facility – reliable, scalable, and cost‑effective infrastructure for your IT equipment.