< Home

vlan

Function

The vlan command creates a VLAN and displays the VLAN view. If the VLAN already exists, you can enter its view directly.

The undo vlan command deletes a VLAN.

Format

vlan vlan-id

vlan batch { vlan-id1 [ to vlan-id2 ] } &<1-10>

undo vlan vlan-id

undo vlan batch { vlan-id1 [ to vlan-id2 ] } &<1-10>

Parameters

Parameter Description Value
vlan-id Specifies the VLAN ID. The value is an integer ranging from 1 to 4094.
batch Configures VLANs in batch. -
vlan-id1 [ to vlan-id2 ] Specifies a VLAN range to be created in batch, including:
  • vlan-id1 specifies the start VLAN ID.

  • vlan-id2 specifies the end VLAN ID.

    vlan-id2 must be greater than vlan-id1. vlan-id2 and vlan-id1 specify a VLAN range.

  • If to vlan-id2 is not specified, only the VLAN specified by vlan-id1 can be configured.

  • If the vlan-id1 [ to vlan-id2 ] parameters are run more than once, all configurations take effect.

In one vlan batch command, a maximum of 10 VLAN ranges can be specified by using to.

The value is an integer ranging from 1 to 4094.

Views

System view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

Create a VLAN to isolate multiple hosts that are not required to communicate with each other. This configuration reduces broadcast domains and improves security of user information in the complex network environment. If multiple VLANs are required to be created, run the vlan batch command to create VLANs in batch, simplifying the configuration process.

Follow-up Procedure

Assign VLANs according to network requirements.

Precautions

Run the vlan command to create a VLAN. If the command is run for several times, all the created VLANs are valid. An existing VLAN cannot be created. The existing VLAN and its related configuration will keep unchanged.

Run the vlan batch command to create multiple VLANs in batch. An existing VLAN cannot be created. The existing VLAN and its related configuration will keep unchanged. Run the vlan batch command to create a VLAN. If the command is run for several times, all the created VLANs are valid.

Before deleting a VLAN, run the undo interface vlanif command to delete the corresponding VLANIF interface for the VLAN.

Example

# Create a VLAN 2. If it already exists, enter the VLAN2 view.

<sysname> system-view
[sysname] vlan 2
[sysname-vlan2]

# Create VLAN6, VLAN7, and VLAN16 to VLAN20 in batch.

<sysname> system-view
[sysname] vlan batch 6 7 16 to 20
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >