<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type hybrid Warning: This command will delete VLANs on this port. Continue?[Y/N]:y Info: This operation may take a few seconds. Please wait for a moment...done.
Change the link type of the interface to access.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type access [HUAWEI-GigabitEthernet0/0/1] port default vlan 10 //Set the PVID of the interface to VLAN 10.
Change the link type of the interface to trunk.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type trunk [HUAWEI-GigabitEthernet0/0/1] port trunk pvid vlan 10 //Set the PVID of the interface to VLAN 10. [HUAWEI-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 10 20 //Add the interface to VLAN 2, VLAN 10, and VLAN 20.
Change the link type of the interface to hybrid.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type hybrid [HUAWEI-GigabitEthernet0/0/1] port hybrid pvid vlan 10 //Set the PVID of the interface to VLAN 10. [HUAWEI-GigabitEthernet0/0/1] port hybrid untagged vlan 2 10 //Add the interface to VLAN 2 and VLAN 10 in untagged mode. [HUAWEI-GigabitEthernet0/0/1] port hybrid tagged vlan 20 //Add the interface to VLAN 20 in tagged mode.
Change the link type of the interface to Dot1q-tunnel.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type dot1q-tunnel [HUAWEI-GigabitEthernet0/0/1] port default vlan 10 //Set the PVID of the interface to VLAN 10. The interface adds VLAN 10 to all received data packets.
When you change the link type of an interface that does not use the default VLAN configuration, the system displays the message "Error: Please renew the default configurations."
You need to restore the default configuration of the interface, and then change the link type of the interface.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] undo port default vlan
<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] undo port trunk pvid vlan [HUAWEI-GigabitEthernet0/0/1] undo port trunk allow-pass vlan all [HUAWEI-GigabitEthernet0/0/1] port trunk allow-pass vlan 1
<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] undo port hybrid pvid vlan [HUAWEI-GigabitEthernet0/0/1] undo port hybrid vlan all [HUAWEI-GigabitEthernet0/0/1] port hybrid untagged vlan 1