Dell Networking SONiC: How to Create a VLAN and Assign it to Trunk and Access Switchports

Summary: This article explains how to create a VLAN and assign it to Trunk and Access switchports. This article uses a switch running Dell SONiC 4.1.

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

We are using standard interface namings to demonstrate the Concepts. See the article Dell Networking S-Series: Basic Interface Configuration - SONiC 4.0 for more information regarding interface naming


Table Of Contents

  1. Introduction
  2. Create VLAN
  3. Create a range of Vlans
  4. Configure an Interface as Access Port
  5. Configure an Interface as Trunk Port
  6. Remove VLAN from an interface
  7. Configure IP address and MTU


 

Introduction

Virtual local area networks (VLANs) are logical interfaces. It allows a group of devices to communicate as if they were in the same network, independent of physical location.
Physical interface and PortChannel can be members of Vlan. The VLAN range is from 1-4094.

Points to remember

  • Reserved VLAN

Dell Enterprise SONiC reserves 128 VLANs for use of the various protocols. This was implemented from 4.0 and later. By default, the reserved VLAN range for SONiC 4.0 is 3967 - 4094. You can change the reserved vlan range.

See the article Dell Networking Enterprise SONiC Reserved VLAN for more information about Reserved VLAN.

  • Switch profile
    • The default switch profile in Dell SONiC is L3 and does not have any VLAN. We must create a VLAN before assigning a port to a VLAN.
    • L2 Profile has default VLAN 1 and all ports are by default assigned to this VLAN 1.

See the article Dell Networking SONiC Operating System L2 and L3 Switch Profiles for more information regarding the L2 and L3 Switch Profile.

 

Create VLAN

Configuration syntax

Configuration

Explanation

admin@DELLSONiC:~$ sonic-cli

Enter Dell management framework CLI.

DELLSONiC# configure terminal

Enter Configuration Mode

DELLSONiC(config)# interface Vlan <Vlan ID>

Create VLAN

DELLSONiC(config)# no interface Vlan <Vlan ID> 

Remove a VLAN.


Create a range of Vlans
 

Configuration

Explanation

DELLSONiC# configure terminal

Enter Configuration Mode

DELLSONiC(config)# interface range create Vlan <Vlan ID-Vlan ID>

Create range of VLANs

DELLSONiC(config)# no interface Vlan <Vlan ID-Vlan ID>

Remove a range of  VLANs.



Sample configuration
Let us Configure VLAN 10 on the switch.
 

admin@DELLSONiC:~$ sonic-cli 
DELLSONiC# configure terminal 
DELLSONiC(config)# interface Vlan 10 
DELLSONiC(config-if-Vlan10)# end


Use the below command to verify if the VLAN is created.

show Vlan 


Sample output

DELLSONiC# show Vlan
Q: A - Access (Untagged), T - Tagged
NUM        Status      Q Ports            Autostate   Dynamic
10         Inactive                       Enable


 

Create a range of Vlans

Configuration

Explanation

DELLSONiC# configure terminal

Enter Configuration Mode

DELLSONiC(config)# interface range create Vlan <Vlan ID-Vlan ID>

Create range of VLANs

DELLSONiC(config)# no interface Vlan <Vlan ID-Vlan ID>

Remove a range of  VLANs.


Sample configuration

Lets Create range of Vlans 30-40

admin@sonic:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# interface range create Vlan 30-40
DELLSONiC(config-if-range-vl**)# exit
DELLSONiC(config)# exit
DELLSONiC# show Vlan
Q: A - Access (Untagged), T - Tagged
NUM        Status      Q Ports            Autostate   Dynamic
30         Inactive                        Enable
31         Inactive                        Enable
32         Inactive                        Enable
33         Inactive                        Enable
34         Inactive                        Enable
35         Inactive                        Enable
36         Inactive                        Enable
37         Inactive                        Enable
38         Inactive                        Enable
39         Inactive                        Enable
40         Inactive                        Enable
DELLSONiC#

 
Lets Remove The Vlans 30-40

DELLSONiC# configure
DELLSONiC(config)# no interface Vlan 30-40
DELLSONiC(config)# end


 

Configure an Interface as Access Port.

Access Port allows only a single VLAN. The access to VLAN traffic is untagged.

Configuration Syntax

Configuration

Explanation

DELLSONiC# configure

Enter Configuration Mode

DELLSONiC(config)# interface Ethernet <Number>

Configure Interface

DELLSONiC(conf-if-Ethernet/PoX)# switchport access Vlan X

Assign a Port as access port of VLAN.

DELLSONiC(conf-if-Ethernet/PoX)# no switchport access vlan

Remove access VLAN from port.


Sample configuration
Suppose we must assign Port Ethernet 1/1 as an access port of VLAN 10. Below is the sample configuration.

 

DELLSONiC# configure
DELLSONiC(config)# interface Eth 1/1
DELLSONiC(config-if-Eth1/1)# switchport access Vlan 10
DELLSONiC(config-if-Eth1/1)# end
DELLSONiC#


Use the below commands to verify the configuration.

show Vlan 

And 

show run interface <interface number>


Sample output
 

DELLSONiC# show Vlan
Q: A - Access (Untagged), T - Tagged
NUM        Status      Q Ports            Autostate   Dynamic
10         Inactive    A  Eth1/1           Enable      No
DELLSONiC# show running-configuration interface Eth 1/1
!
interface Eth1/1
mtu 9100
no shutdown
switchport access Vlan 10


 

Configure an Interface as Trunk Port.

Trunk Port can have Multiple tagged VLAN and one untagged VLAN (Native VLAN).

Points to remember

  • The VLAN must be created before being assigned to an interface
  • The ​​​​​​Same VLAN cannot be tagged and untagged VLAN in one interface
  • Only one Access or untagged VLAN (Native VLAN) can be assigned in an interface. 
  • You can use the following command to add VLAN to existing VLANs in the interface.
 
switchport trunk allowed VLAN add <Vlan id/Range of vlan>
 

CAUTION: The command switchport trunk allowed VLAN <Vlan id/Range of vlan> rewrites all VLANs existing in the interface with specified VLANs. Use this command with caution.

Configuration Syntax

Configuration

Explanation

DELLSONiC# configure

Enter Configuration Mode

DELLSONiC(config)# interface Ethernet/Portchannel <number>

Configure Interface

DELLSONiC(conf-if-Ethernet/PoX)# switchport trunk allowed VLAN add <Vlan id/Range of vlan> 

Allow VLAN or a range of VLANs to Trunk Port. To specify VLAN range use <1..4094>  (-) or (,) separated individual VLAN IDs and ranges of VLAN IDs; for example, 20,70-100,142

DELLSONiC(conf-if-Ethernet/PoX)#switchport trunk allowed Vlan all

Allow all VLANs (Optional).

DELLSONiC(conf-if-Ethernet/PoX)#switchport trunk allowed Vlan <Vlan id/Range of vlan>

(Optional. Use with Caution) Rewrites all existing VLAN configurations in the interface and allow the specified vlan/range of VLANs. 

DELLSONiC(conf-if-Ethernet/PoX)# switchport access Vlan <Vlan id>

Assign Untagged VLAN to Port (Native VLAN) (Optional).


Sample configuration
Let us assign VLAN 10 tagged and VLAN 20 as access port (untagged native-vlan) on Ethernet 1/1 interface. Below is the sample configuration.

DELLSONiC# configure
DELLSONiC(config)# interface Eth 1/1
DELLSONiC(config-if-Eth1/1)# switchport trunk allowed Vlan add 10
DELLSONiC(config-if-Eth1/1)# switchport access Vlan 20
DELLSONiC(config-if-Eth1/1)# end


Use the following command to verify the configuration.
 

show vlan and show run interface <interface id>


Sample output

DELLSONiC# show Vlan
Q: A - Access (Untagged), T - Tagged
NUM        Status      Q Ports            Autostate   Dynamic
10         Inactive    T  Eth1/1           Enable      No
20         Inactive    A  Eth1/1           Enable      No​​
DELLSONiC# show running-configuration interface Eth 1/1
!
interface Eth1/1
mtu 9100
no shutdown
switchport access Vlan 20
switchport trunk allowed Vlan 10
DELLSONiC#


 

Remove VLAN from an interface.

Configuration Syntax

Configuration

Explanation

DELLSONiC# configure

Enter Configuration Mode

DELLSONiC(config)# interface Ethernet/Portchannel <number>

Configure Interface

DELLSONiC(conf-if-Ethernet/PoX)# switchport trunk allowed Vlan remove <Vlan id/range> 

Remove VLAN or Range of VLANs from a Trunk Port. To specify VLAN range use <1..4094>  (-) or (,) separated individual VLAN IDs and ranges of VLAN IDs; for example, 20,70-100,142

DELLSONiC(conf-if-Ethernet/PoX)# no switchport access Vlan

Remove untagged (access) from the trunk port.


Sample configuration

DELLSONiC# configure
DELLSONiC(config)# interface Eth 1/1
DELLSONiC(config-if-Eth1/1)# switchport trunk allowed Vlan remove 10
DELLSONiC(config-if-Eth1/1)# no switchport access Vlan
DELLSONiC(config-if-Eth1/1)# end


 

Configure the IP address and MTU.

By default a VLAN is in layer two or more. It does not have an IPv4 and IPv6 address. We can assign the IPv4 or IPv6 address to a VLAN manually.

Points to remember

  • Configure the MTU on VLAN members first before configuring VLAN MTU. All members of a VLAN must have the same MTU value. Tagged members must have a link MTU 4 bytes higher than untagged members to account for the packet tag.
  • You can configure multiple IPv6 addresses on an interface.
  • You can configure a secondary IP address in a VLAN


Configuration Syntax

Configuration

Explanation

DELLSONiC# configure

Enter Configuration Mode

DELLSONiC(config)# interface Vlan <ID>

Configure Interface

DELLSONiC(conf-if-VlanX)#ip address <IP address/mask>

Add IP address.

DELLSONiC(conf-if-VlanX)#no ip address

Remove IP address.

DELLSONiC(conf-if-VlanX)#ipv6 address <ipv6–address/prefix-length>

Add IPv6 Address

DELLSONiC(conf-if-VlanX)#no ipv6 address

Remove the IPv6 address.

DELLSONiC(conf-if-VlanX)#mtu <MTU ID>

Change MTU (1312 to 9216). Default 9100


Sample Configuration
 

DELLDELLSONiC# configure
DELLSONiC(config)# interface Vlan 10
DELLSONiC(conf-if-Vlan10)# mtu 1500
DELLSONiC(conf-if-Vlan10)# ip address 10.0.0.1/24
DELLSONiC(conf-if-Vlan10)# ipv6 address a::b/64
DELLSONiC(conf-if-Vlan10)# end


Use the following command to verify the configuration.

show interface vlan <vlan id>


Sample output

DELLSONiC# show interface Vlan 10
Vlan10 is up, line protocol is down
Hardware is Vlan, address is 0c:6e:4a:87:00:0a
IPV4 address is 10.0.0.2/24
Mode of IPV4 address assignment: MANUAL
IPV6 address is a::b/64,fe80::e6e:4aff:fe87:a/64
Mode of IPV6 address assignment: MANUAL
IP MTU 1500 bytes
Time since last interface status change: 01:28:39

Affected Products

Enterprise SONiC Distribution, PowerSwitch S6000 ON, PowerSwitch E3200-ON Series, Dell EMC Networking N3200-ON, PowerSwitch S5224F-ON, PowerSwitch S5232F-ON, PowerSwitch S6100-ON, PowerSwitch Z9100-ON, PowerSwitch Z9264F-ON, PowerSwitch Z9332F-ON
Article Properties
Article Number: 000217901
Article Type: How To
Last Modified: 29 Sept 2023
Version:  6
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.