< Home

port (vlan view)

Function

The port command sets a default VLAN for an interface and adds the interface to the VLAN.

The undo port command deletes the interface from the set default VLAN and restores the default VLAN of the interface to the default value.

Format

port interface-type { interface-number1 [ to interface-number2 ] } &<1-10>

undo port interface-type { interface-number1 [ to interface-number2 ] } &<1-10>

Parameters

Parameter Description Value
interface-type { interface-number1 [ to interface-number2 ] } Specifies a default VLAN interface, including:
  • interface-type: specifies the type of the interface.
  • interface-number1: specifies the start interface number in the interface range.
  • interface-number2: specifies the end interface number in the interface range.

    The value of interface-number2 must be larger than that of interface-number1, and these two values together specify an interface range.

  • If to interface-number2 is not specified, only the interface specified by interface-number1 can be configured.

In one port command, a maximum of 10 groups of ports can be specified by using to.

The interface type can be: Ethernet interface, GE interface, and Eth-Trunk interface.

Views

VLAN view

Default Level

2: Configuration level

Usage Guidelines

Prerequisites

The port command can be run only when the Layer 2 interface type is Access.

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.

Precautions

The VLAN ID of all interfaces is 1 by default.

When you specify the interface range, note that:

  • The types of the interfaces are the same.

  • The interfaces in the range must exist.

  • If the port command is run more than once, all configurations take effect.
For USG6000E:
  • When running the port command to add Layer 2 sub-interfaces in batches to a VLAN, note that:
    • Layer 2 sub-interfaces and main interfaces cannot be simultaneously added to the same VLAN.
    • The Layer 2 sub-interfaces to be added must belong to the same main interface.
  • After a main interface is added to a VLAN, the VLAN configuration does not apply to the Layer 2 sub-interfaces on the main interface. To add the Layer 2 sub-interfaces to the VLAN, run the port or port default vlan command.

Example

# Add GE 0/0/0 to 0/0/3 to the VLAN 3.

<sysname> system-view
[sysname] vlan 3
[sysname-vlan3] port GigabitEthernet 0/0/0 to 0/0/3
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >