< Home

Switching an Interface Between Layer 2 and Layer 3 Modes

Context

Due to hardware restrictions of switches, some Ethernet interfaces work in only Layer 2 or Layer 3 mode, whereas other Ethernet interfaces can work in both 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 Layer 2 and Layer 3 modes on multiple interfaces, run the portswitch batch command in the system view.

Only interfaces on the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support switching between Layer 2 and Layer 3 modes.

IP addresses can be assigned to Ethernet interfaces in Layer 3 mode.

By default, an Ethernet interface works at Layer 2 and belongs to VLAN 1. An interface is not removed from VLAN 1 immediately after being switched to Layer 3 mode. It is removed from VLAN 1 only when Layer 3 protocols are Up.

You can configure Layer 2 and Layer 3 modes of an Ethernet interface in the Ethernet interface view or system view. When the configurations in the two views differ, the latest configuration takes effect.

Procedure

  • Switch an Ethernet interface to Layer 3 mode in the Ethernet interface view.
    1. Run system-view

      The system view is displayed.

    2. Run interface interface-type interface-number

      The Ethernet interface view is displayed.

    3. Run undo portswitch

      The interface is switched to Layer 3 mode.

      By default, an Ethernet interface works in Layer 2 mode.

      When you run this command on an interface, the mode switching configuration takes effect when only attribute configurations (such as shutdown and description configurations) exist on the interface. If service configurations (such as the port link-type trunk configuration) exist on the interface, you need to clear all service configurations before running this command.

  • Switch an Ethernet interface to Layer 2 mode in the Ethernet interface view.
    1. Run system-view

      The system view is displayed.

    2. Run interface interface-type interface-number

      The Ethernet interface view is displayed.

    3. Run portswitch

      The interface is switched to Layer 2 mode.

      By default, an Ethernet interface works in Layer 2 mode.

      When you run this command on an interface, the mode switching configuration takes effect when only attribute configurations (such as shutdown and description configurations) exist on the interface. If service configurations (such as the port link-type trunk configuration) exist on the interface, you need to clear all service configurations before running this command.

  • Switch Ethernet interfaces to Layer 3 mode in a batch in the system view.
    1. Run system-view

      The system view is displayed.

    2. Run undo portswitch batch interface-type { interface-number1 [ to interface-number2 ] } &<1-10>

      The interfaces are switched to Layer 3 mode in a batch.

      By default, an Ethernet interface works in Layer 2 mode.

  • Switch Ethernet interfaces to Layer 2 mode in a batch in the system view.
    1. Run system-view

      The system view is displayed.

    2. Run portswitch batch interface-type { interface-number1 [ to interface-number2 ] } &<1-10>

      The interfaces are switched to Layer 2 mode in a batch.

      By default, an Ethernet interface works in Layer 2 mode.

Verifying the Configuration

Run the display interface [ interface-type [ interface-number ] ] command in any view or the display this interface command in the interface view to check the current interface status. The interface is a Layer 2 interface if the Switch Port field is displayed in the command output and is a Layer 3 interface if the Route Port field is displayed.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic