< Home

port default vlan

Function

The port default vlan command adds a Layer 2 port to the specified VLAN in the untagged mode.

The undo port default vlan command deletes a Layer 2 port from the specified VLAN.

Format

port default vlan vlan-id

undo port default vlan

Parameters

Parameter Description Value

vlan-id

Specifies the VLAN ID defined in IEEE802.1Q.

The value is an integer that ranges from 1 to 4094.

Views

Layer-2 Ethernet interface view, Layer-2 Ethernet sub-interface view, Layer-2 Eth-Trunk interface view, Layer-2 Eth-Trunk sub-interface view

Default Level

2: Configuration level

Usage Guidelines

A port on a device may belong to more than one VLAN. You can use the default VLAN ID of the port when configuring this command or its undo form.
  • If an untagged packet is received, a Layer 2 port tags this packet and sets the VID in the VLAN tag to the default VLAN ID of the port.

  • If a tagged packet is received, a Layer 2 port performs either of the following actions:

    • The Layer 2 port forwards this packet if it determines that the VLAN ID carried by the packet is the same as the default VLAN ID of the port.

    • The Layer 2 port discards this packet if it determines that the VLAN ID carried by the packet is different from the default VLAN ID of the port.

  • When a Layer 2 port forwards a tagged packet whose VLAN ID is the same as the default VLAN ID of the port, the system removes the tag carried by the packet before sending it.

The binding of a Layer-2 subinterface and a VLAN and the unbinding of a Layer-2 subinterface from a VLAN is subject to the security zone to which the Layer-2 subinterface is assigned. Before binding a Layer-2 subinterface and a VLAN or unbinding a Layer-2 subinterface from a VLAN, delete the security zone to which the Layer-2 subinterface is assigned. Then add the Layer-2 subinterface to a security zone.

When using the command, note the following:

  • The specified VLAN must be an existing one.

  • The ports to be added to VLANs must be Layer 2 ports. If you want to add Layer 3 ports to VLANs, you need to run the portswitch command to convert the Layer 3 ports to Layer 2 ports first.

  • This command can be configured only when link-type of the Layer 2 Ethernet interface is set to access.

The port default vlan command is equivalent to the port command in terms of the effect.

Example

# Add GE 1/0/1 into the VLAN 3.

<sysname> system-view
[sysname] interface GigabitEthernet 0/0/1
[sysname-GigabitEthernet 0/0/1] portswitch
[sysname-GigabitEthernet 0/0/1] port link-type access
[sysname-GigabitEthernet 0/0/1] port default vlan 3
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >