< Home

portswitch

Function

The portswitch command switches an Ethernet interface from the Layer-3 mode to the Layer-2 mode.

The undo portswitch command switches an Ethernet interface from the Layer-2 mode to the Layer-3 mode.

Format

portswitch

undo portswitch

Parameters

None

Views

Ethernet interface view, Eth-Trunk interface view, Ethernet subinterface view, Eth-Trunk subinterface view

Default Level

2: Configuration level

Usage Guidelines

WAN interface and MEth interface does not support this command.

If a Layer-3 interface needs to be added to a VLAN or used for Layer-2 forwarding, switch the interface to the Layer-2 mode. After the switchover, the link type of the interface is Hybrid.

A Layer-3 subinterface can be switched to the Layer-2 mode only after the main interface has been switched to the Layer-2 mode using the portswitch command.

When a Layer-3 interface is configured to work in Layer-2 mode, the device automatically clears specific configurations, such as, DHCP, DDNS, and route configurations of the interface and retains specific configurations, such as HRP heartbeat interface configurations of the interface. If the interface is specified as a heartbeat interface, the interface cannot be configured to work in Layer-2 mode. Therefore, before you configure a Layer-3 Ethernet interface to work in Layer-2 mode, ensure that the interface has no configuration.

Example

# Switch GigabitEthernet 0/0/1 to the Layer-2 mode.

<sysname> system-view
[sysname] interface GigabitEthernet 0/0/1
[sysname-GigabitEthernet0/0/1] portswitch

# Create subinterface GigabitEthernet 0/0/1.1 and switch it to the Layer-2 mode.

<sysname> system-view
[sysname] interface GigabitEthernet 0/0/1.1
[sysname-GigabitEthernet0/0/1.1] vlan-type dot1q 60
[sysname-GigabitEthernet0/0/1.1] portswitch
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >