Switching an Interface Between Layer 2 and Layer 3 Modes
Context
To switch between Layer 2 and Layer 3 modes on multiple interfaces, run the portswitch batch command in the system view.
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.
- Switch an Ethernet interface to Layer 2 mode in the Ethernet interface view.
- Switch Ethernet interfaces to Layer 3 mode in a batch in the system view.
If an Ethernet interface works in Layer 2 mode, the interface uses the system MAC address as its MAC address. If you run the undo portswitch command to switch the interface to Layer 3 mode, the system automatically allocates a MAC address to the interface. For X1E series cards, if the allocated MAC address is the same as an existing MAC address on the network, resulting in a MAC address conflict. To solve this problem, you can run the mac-address mac-address command to manually configure a MAC address for the interface. After running this command, run the reset slot slot-id command to reset the card on which the interface is located to make the configured MAC address take effect.
- Switch Ethernet interfaces to Layer 2 mode in a batch in the system view.
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. The Hardware address field in the command output indicates the MAC address of the interface.