---
title: VLAN
slug: aidc/vlan
createdAt: 2025-12-01T11:11:07.000Z
---

## <font color="#1d50a2">VLAN View</font>

<font color="#1d05a2">Table 1 VLAN View</font>

| **Command**                     | **Purpose**                                          |
| ------------------------------- | ---------------------------------------------------- |
| **show vlan summary**           | Display summary information about VLANs.             |
| **show vlan summary** *vlan-id* | Display specific VLAN summary information            |
| **show vlan** *vlan-id*         | Display specific information about the VLAN.         |
| **show vlan all**               | Display detailed information about all VLANs.        |
| **show \{ip\|ipv6} interfaces** | Display IP address configuration of VLAN interfaces. |
| **show counters vlan**          | Display VLAN interfaces statistics.                  |

### <font color="#1d50a2">show vlan summary</font>

**\[Command]**
**show vlan summary**

**\[Purpose]**
Display summary information about VLANs.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show vlan summary
+-----------+----------------+-----------+----------------+-----------------------+
|   VLAN ID | IP Address     | Ports     | Port Tagging   | DHCP Helper Address   |
+===========+================+===========+================+=======================+
|      1000 | 192.168.0.1/21 | Ethernet0 | untagged       | 192.0.0.1             |
|           |                | Ethernet1 | untagged       | 192.0.0.2             |
|           |                | Ethernet2 | untagged       | 192.0.0.3             |
|           |                | Ethernet3 | untagged       | 192.0.0.4             |
+-----------+----------------+-----------+----------------+-----------------------+
|      1200 |                |           |                |                       |
+-----------+----------------+-----------+----------------+-----------------------+
```

### <font color="#1d50a2">show vlan summary *vlan-id*</font>

**\[Command]**
**show vlan summary** *vlan-id*

**\[Purpose]**
Display specific VLAN summary information.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *vlan-id*     | VLAN ID         |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show vlan summary 1000
+-----------+----------------+-----------+----------------+-----------------------+
|   VLAN ID | IP Address     | Ports     | Port Tagging   | DHCP Helper Address   |
+===========+================+===========+================+=======================+
|      1000 | 192.168.0.1/21 | Ethernet0 | untagged       | 192.0.0.1             |
|           |                | Ethernet1 | untagged       | 192.0.0.2             |
|           |                | Ethernet2 | untagged       | 192.0.0.3             |
|           |                | Ethernet3 | untagged       | 192.0.0.4             |
+-----------+----------------+-----------+----------------+-----------------------+
```

### <font color="#1d50a2">show vlan *vlan-id*</font>

**\[Command]**
**show vlan** *vlan-id*

**\[Purpose]**
Display specific information about the VLAN.

**\[Parameters]**

| **Parameter** | **Description**                  |
| ------------- | -------------------------------- |
| *vlan-id*     | VLAN ID, the range is \[1,4094]. |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic(config)# show vlan 300
VLAN ID: 300
Route interface:
Name: VLAN 300
Tagged ports:
Untagged ports:
    0/0
MAC-learning: enable
```

### <font color="#1d50a2">show vlan all</font>

**\[Command]**
**show vlan all**

**\[Purpose]**
Display detailed information about all VLANs.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic(config)# show vlan all
VLAN ID: 300
Route interface:
Name: VLAN 300
Tagged ports:
Untagged ports:
    0/0
MAC-learning: enable
```

### <font color="#1d50a2">show \{ip|ipv6\} interfaces</font>

**\[Command]**
**show** \{**ip**|**ipv6**} **interfaces**

**\[Purpose]**
Display IP address configuration of VLAN interfaces.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ip interfaces
Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP
-----------  --------  -------------------  ------------  --------------  -------------
0/48                   199.0.3.1/24         up/up         N/A             N/A
loopback0              10.1.0.34/32         up/up         N/A             N/A
vlan100      Vrf123    100.100.0.1/24       up/up         N/A             N/A
vlan200      Vrf123    200.200.0.1/24       up/up         N/A             N/A
vlan300      Vrf123    200.230.0.1/24       up/down       N/A             N/A
vlan400                200.240.0.1/24       up/down       N/A             N/A
vlan4094               99.0.0.1/24          up/up         N/A             N/A
mgmt                   10.250.0.138/24      up/up         N/A             N/A
```

### <font color="#1d50a2">show counters vlan</font>

**\[Command]**
**show counters vlan**

**\[Purpose]**
Display VLAN interfaces statistics.

**\[View]**
Privileged User View

**\[Notes]**
Only supported on CX308P-48Y-N-V2 and CX532P-N-V2 (support two VLANIFs at most), other models are not supported yet.
Run command **clear counters vlan** to clear VLANIFs statistics.

**\[Use Cases]**

```plaintext
sonic# show counters vlan
VLAN NAME      PACKETS IN    PACKETS OUT
-----------  ------------  -------------
vlan1011              100            100
vlan1012                0              0
```

## VLAN Config

<font color="#1d05a2">Table 2 VLAN Config</font>

| **Command**                                                           | **Purpose**                                      |
| --------------------------------------------------------------------- | ------------------------------------------------ |
| **vlan** *vlan-id*                                                    | Create a VLAN and enter VLAN Configuration View. |
| **description** *description*                                         | Specify the description for the VLAN.            |
| **mac-address learning**                                              | Enable MAC learning for the VLAN.                |
| *\{broadcast\|unknown-multicast\|unknown-unicast}* \{drop\|**flood}** | Set BUM suppression.                             |
| **counter enable**                                                    | Enable VLAN interfaces statistics.               |
| **interface vlan** *vlan-id*                                          | Enter VLANIF Configuration View.                 |
| **ip address** \{*A.B.C.D/M\|A\::B/M*} \[**secondary**]               | Configure IP address for the VLAN interface.     |
| **mtu** *mtu*                                                         | Configure the MTU value on a VLAN interface.     |
| **shutdown**                                                          | Bring the VLANIF down administratively.          |
| **mac\_address** *HH\:HH\:HH\:HH\:HH\:HH*                             | Specify a MAC address to the VLAN interface.     |
| **switchport** \{*trunk\|access*} **vlan** *vlan-id*                  | Add member port to the VLAN.                     |
| **vlan range** *vlan-list*                                            | Create a bulk of VLANs.                          |
| **switchport trunk range vlan** *vlan-list*                           | Add member port to a bulk of VLANs.              |

### <font color="#1d50a2">vlan *vlan-id*</font>

**\[Command]**
**vlan** *vlan-id*

**\[Purpose]**
Create a VLAN and enter VLAN Configuration View.

**\[Parameters]**

| **Parameter** | **Description**                  |
| ------------- | -------------------------------- |
| *vlan-id*     | VLAN ID, the range is \[1,4094]. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no vlan** *vlan-id* to delete the VLAN

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vlan 300
sonic(config-vlan-300)# show this
!
vlan 300
```

### <font color="#1d50a2">description description</font>

**\[Command]**
**description** *description*

**\[Purpose]**
Specify the description for the VLAN.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *description* | In string form. |

**\[View]**
VLAN Configuration View

**\[Notes]**
Run command **no description** to delete description.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vlan 200
sonic(config-vlan-200)# description vlan-200
sonic(config-vlan-200)# do show vlan 200
VLAN ID: 200
Description: vlan-200
Route interface:
Name: VLAN 200
Tagged ports:
Untagged ports:
MAC-learning: enable
```

### <font color="#1d50a2">mac-address learning</font>

**\[Command]**
**mac-address learning**

**\[Purpose]**
Enable MAC learning for the VLAN.

**\[View]**
VLAN Configuration View

**\[Notes]**
MAC learning is enabled by default.
Run command **no mac-address learning** to disable MAC learning for the VLAN.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vlan 300
sonic(config-vlan-300)# no mac-address learning
sonic(config-vlan-300)# show this
!
vlan 300
 no mac-address learning
```

### <font color="#1d50a2">\{broadcast|unknown-multicast|unknown-unicast\} \{drop|flood\}</font>

**\[Command]**
\{**broadcast**|**unknown-multicast**|**unknown-unicast**} \{**drop**|**flood**}

**\[Purpose]**
Set BUM suppression.

**\[View]**
VLAN Configuration View

**\[Notes]**
By default, the policy for BUM messages is flooding.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vlan 10
sonic(config-vlan-10)# broadcast drop
```

### <font color="#1d50a2">counter enable</font>

**\[Command]**
**counter enable**

**\[Purpose]**
Enable VLAN interfaces statistics.

**\[View]**
VLAN Configuration View

**\[Notes]**
Only supported on CX308P-48Y-N-V2 and CX532P-N-V2 (support two VLANIFs at most), other models are not supported yet.
Run command **no counter enable** to disable VLAN interfaces statistics.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vlan 10
sonic(config-vlan-10)# counter enable
```

### <font color="#1d50a2">interface vlan *vlan-id*</font>

**\[Command]**
**interface vlan** *vlan-id*

**\[Purpose]**
Enter VLANIF Configuration View

**\[Parameters]**

| **Parameter** | **Description**                  |
| ------------- | -------------------------------- |
| *vlan-id*     | VLAN ID, the range is \[1,4094]. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no interface vlan** *vlan-id* to delete VLAN interface. You should remove the member ports from it before deleting.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface vlan 300
sonic(config-vlanif-300)#
```

### <font color="#1d50a2">ip address \{*A.B.C.D/M*|*A\:\:B/M*\} \[secondary\]</font>

**\[Command]**
**ip address** \{*A.B.C.D/M|A\::B/M*} \[secondary]

**\[Purpose]**
Configure IP address for the VLAN interface.

**\[Parameters]**

| **Parameter** | **Description**                                                                                                                                                          |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| *A.B.C.D/M*   | IPv4 address with prefix length.                                                                                                                                         |
| *A\::B/M*     | IPv6 address with prefix length.                                                                                                                                         |
| **secondary** | The default is Primary IP, specifying this option means configuring as Secondary IP, which requires that the Secondary IP and Primary IP be in the same network segment. |

**\[View]**
VLANIF Configuration View

**\[Notes]**
IPv4 address with subnet mask /32 is not allowed to be configured. Addresses with subnet mask /31 is allowed. In other subnet masks, addresses with the host portion all-zeros or all-ones are not allowed. IPv6 address with subnet mask /127 or /128 is not allowed to be configured. In other subnet masks, addresses with the host portion all-zeros are not allowed, but all-ones are allowed.
Run command **no ip address** \{*A.B.C.D/M|A\::B/M*} \[**secondary**] to delete IP address configuration of the VLAN interface.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface vlan 300
sonic(config-vlanif-300)# ip address 3.3.3.6/24
sonic(config-vlanif-300)# show this
!
vlan 300
ip address 3.3.3.6/24
```

### <font color="#1d50a2">mtu *mtu*</font>

**\[Command]**
**mtu** *mtu*

**\[Purpose]**
Configure the MTU value on a VLAN interface.

**\[Parameters]**

| **Parameter** | **Description**                                                                       |
| ------------- | ------------------------------------------------------------------------------------- |
| *mtu*         | Maximum Transmission Unit, the range is from 1312 to 9216. The default is 9216 Bytes. |

**\[View]**
VLANIF Configuration View

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface vlan 300
sonic(config-vlanif-300)# mtu 2000
sonic(config-vlanif-300)# show this
!
vlan 300
 mtu 2000
```

### <font color="#1d50a2">shutdown</font>

**\[Command]**
**shutdown**

**\[Purpose]**
Bring the VLANIF down administratively.

**\[View]**
VLANIF Configuration View

**\[Notes]**
Run command **no shutdown** to bring the VLANIF up administratively.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface vlan 300
sonic (config-vlanif-3)# shutdown
sonic (config-vlanif-3)# show this
!
interface vlan 300
   shutdown
```

### <font color="#1d50a2">mac\_address *HH\:HH\:HH\:HH\:HH\:HH*</font>

**\[Command]**
**mac\_address** *HH\:HH\:HH\:HH\:HH\:HH*

**\[Purpose]**
Specify a MAC address to the VLAN interface.

**\[Parameters]**

| **Parameter**            | **Description**                  |
| ------------------------ | -------------------------------- |
| *HH\:HH\:HH\:HH\:HH\:HH* | MAC address, not case sensitive. |

**\[View]**
VLANIF Configuration View

**\[Notes]**
The default is the MAC of the switch;
Run command **no mac\_address** to restore the MAC of the VLAN interface to default.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface vlan 300
sonic(config-vlanif-300)# mac-address 18:17:25:37:67:af
sonic(config-vlan-300)# show this
!
vlan 300
 mac-address 18:17:25:37:67:af
```

### <font color="#1d50a2">switchport \{trunk|access\} vlan *vlan-id*</font>

<font color="#000000">**\[Command\]**</font>
**switchport** \{**trunk**|**access**} **vlan** *vlan-id*

**\[Purpose]**
Add member port to the VLAN.

**\[Parameters]**

| **Parameter** | **Description**                  |
| ------------- | -------------------------------- |
| **access**    | Add to VLAN as untagged.         |
| **trunk**     | Add to VLAN as tagged.           |
| *vlan-id*     | VLAN ID, the range is \[1,4094]. |

**\[View]**
Physical Interface Configuration View/LAGIF Configuration View

**\[Notes]**
An interface can only be added to one VLAN as untagged, but it can be added to multiple VLANs as tagged. The VLAN ID of the untagged VLAN will be set as PVID of the interface;
Run command **no switchport vlan** *vlan-id* to remove the interface from specified VLAN;
Run command **no switchport** to remove the interface from all VLANs and change to Layer 3 port.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# switchport access vlan 300
sonic(config-if-0/0)# show this
!
interface ethernet 0/0
  switchport access vlan 300
```

### <font color="#1d50a2">vlan range *vlan-list*</font>

**\[Command]**
**vlan range** *vlan-list*

**\[Purpose]**
Create a bulk of VLANs.

**\[Parameters]**

| **Parameter** | **Description**                                       |
| ------------- | ----------------------------------------------------- |
| *vlan-list*   | Use '-' and ',' to separate VLAN ids  e.g. 1-20,30,40 |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no vlan range** *vlan-list*  to delete VLANs.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vlan range 10-20,4000
```

### <font color="#1d50a2">switchport trunk range vlan *vlan-list*</font>

**\[Command]**
**switchport trunk range vlan** *vlan-list*

**\[Purpose]**
Add member port to a bulk of VLANs.

**\[Parameters]**

| **Parameter** | **Description**                                       |
| ------------- | ----------------------------------------------------- |
| *vlan-list*   | Use '-' and ',' to separate VLAN ids  e.g. 1-20,30,40 |

**\[View]**
Physical Interface Configuration View/LAGIF Configuration View

**\[Notes]**
Run command **no switchport vlan range** *vlan-list*  to remove member port from a bulk of VLANs.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface ethernet 0/4
sonic(config-if-0/4)# switchport trunk range vlan 10-20,4000
```

## QinQ Config

<font color="#1d05a2">Table 3 QinQ Config</font>****

| **Command**                            | **Purpose**                  |
| -------------------------------------- | ---------------------------- |
| **dot1q-tunnel enable**                | Enable QinQ                  |
| **dot1q-tunnel&#x20;**                 | Enable QinQ on the interface |
| **dot1q-tunnel ethertype&#x20;***tpid* | Configure QinQ's TPID        |

### <font color="#1d50a2">**dot1q-tunnel enable**</font>

**\[Command]**
**dot1q-tunnel enable**

**\[Purpose]**
Enable QinQ

**\[View]**
Global Configuration View

**\[Notes]**
Currently, only CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 devices support this feature.
Execute th&#x65;**&#x20;no dot1q-tunnel enable&#x20;**&#x63;ommand to disable QinQ.

**\[Use Cases]**

```plaintext
sonic# configure
sonic(config)# dot1q-tunnel enable
```

### <font color="#1d50a2">**dot1q-tunnel** </font>

**\[Command]**
**dot1q-tunnel&#x20;**

**\[Purpose]**
Enable QinQ on the interface

**\[View]**
Interface Configuration View

**\[Notes]**
Currently, only CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 devices support this feature.
This command needs to be executed under the physical interface configured with access vlan.
Execute th&#x65;**&#x20;no dot1q-tunnel&#x20;**&#x63;ommand to disable QinQ.

**\[Use Cases]**

```plaintext
sonic# configure
sonic(config)# interface ethernet 0/8
sonic(config-if-0/8)# dot1q-tunnel
```

### <font color="#1d50a2">**dot1q-tunnel ethertype** *tpid*</font>

**\[Command]**
**dot1q-tunnel ethertype&#x20;***tpid*

**\[Purpose]**
Configure QinQ's TPID

**\[Parameters]**

| **Parameter** | **Description**                                                     |
| ------------- | ------------------------------------------------------------------- |
| *tpid*        | Set tpid；optional parameters include0x8100, 0x9100, 0x9200, 0x88A8. |

**\[View]**
Interface Configuration View

**\[Notes]**
Currently, only CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 devices support this feature.
This command needs to be executed under the physical interface configured with access vlan.
Execute the**no dot1q-tunnel ethertype**command to restore the default configuration of QinQ tpid.

**\[Use Cases]**

```plaintext
sonic# configure
sonic(config)# interface ethernet 0/8
sonic(config-if-0/8)# dot1q-tunnel ethertype 9200
```

