Dell Networking SONiC: Como criar uma VLAN e atribuí-la a switchports de acesso e tronco

Summary: Este artigo explica como criar uma VLAN e atribuí-la às switchports de tronco e de acesso. Este artigo usa um switch que executa o 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

Estamos usando nomenclaturas de interface padrão para demonstrar os conceitos. Consulte o artigo Dell Networking série S: Configuração básica da interface — SONiC 4.0 para obter mais informações sobre nomenclatura de interface


Sumário

  1. Introdução
  2. Criar VLAN
  3. Criar um intervalo de VLANs
  4. Configurar uma interface como porta de acesso
  5. Configurar uma interface como porta de tronco
  6. Remover a VLAN de uma interface
  7. Configurar endereço IP e MTU


 

Introdução

As redes locais virtuais (VLANs) são interfaces lógicas. Ele permite que um grupo de dispositivos se comunique como se estivessem na mesma rede, independente do local físico.
A interface física e o PortChannel podem ser membros da VLAN. O intervalo de VLAN é de 1 a 4094.

Pontos a serem lembrados

  • VLAN reservada

O Dell Enterprise SONiC reserva 128 VLANs para uso dos vários protocolos. Isso foi implementado a partir da versão 4.0 e posterior. Por padrão, o intervalo de VLAN reservado para o SONiC 4.0 é 3967 - 4094. Você pode alterar o intervalo de VLAN reservado.

Consulte o artigo VLAN reservada do Dell Networking Enterprise SONiC para obter mais informações sobre VLAN reservada.

  • Perfil do switch
    • O perfil de switch padrão no Dell SONiC é L3 e não tem nenhuma VLAN. Precisamos criar uma VLAN antes de atribuir uma porta a uma VLAN.
    • O perfil L2 tem a VLAN 1 padrão e, por padrão, todas as portas são atribuídas a essa VLAN 1.

Consulte o artigo Perfis de switch L2 e L3 do sistema operacional Dell Networking SONiC para obter mais informações sobre o perfil de switch L2 e L3.

 

Criar VLAN

Sintaxe de configuração

Configuração

Explicação

admin@DELLSONiC:~$ sonic-cli

Entre na CLI do Dell Management Framework.

DELLSONiC# configure terminal

Entrar no modo de configuração

DELLSONiC(config)# interface Vlan <Vlan ID>

Criar VLAN

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

Remova uma VLAN.


Criar um intervalo de VLANs
 

Configuração

Explicação

DELLSONiC# configure terminal

Entrar no modo de configuração

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

Criar intervalo de VLANs

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

Remova um intervalo de VLANs.



Exemplo de configuração
Vamos configurar a VLAN 10 no switch.
 

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


Use o comando abaixo para verificar se a VLAN foi criada.

show Vlan 


Exemplo de saída

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


 

Criar um intervalo de VLANs

Configuração

Explicação

DELLSONiC# configure terminal

Entrar no modo de configuração

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

Criar intervalo de VLANs

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

Remova um intervalo de VLANs.


Exemplo de configuração

Permite criar uma faixa de Vlans de 30 a 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#

 
Vamos remover as VLANs 30-40

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


 

Configure uma interface como porta de acesso.

A porta de acesso permite apenas uma única VLAN. O acesso ao tráfego da VLAN está sem marcação.

Sintaxe de configuração

Configuração

Explicação

DELLSONiC# configure

Entrar no modo de configuração

DELLSONiC(config)# interface Ethernet <Number>

Configurar interface

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

Atribua uma porta como porta de acesso da VLAN.

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

Remova a VLAN de acesso da porta.


Exemplo de configuração
Suponha que devemos atribuir a porta Ethernet 1/1 como uma porta de acesso de VLAN 10. Abaixo está a configuração de amostra.

 

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 os comandos abaixo para verificar a configuração.

show Vlan 

And 

show run interface <interface number>


Exemplo de saída
 

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 uma interface como porta de tronco.

A porta tronco pode ter várias VLAN com marcação e uma VLAN sem marcação (VLAN nativa).

Pontos a serem lembrados

  • A VLAN deve ser criada antes de ser atribuída a uma interface
  • A mesma VLAN não pode ser marcada e VLAN sem etiqueta em uma interface
  • Apenas uma VLAN de acesso ou sem marcação (VLAN nativa) pode ser atribuída em uma interface. 
  • Você pode usar o comando a seguir para adicionar a VLAN às VLANs existentes na interface.
 
switchport trunk allowed VLAN add <Vlan id/Range of vlan>
 

AVISO: O comando switchport trunk allowed VLAN <Vlan id/Range of vlan> regrava todas as VLANs existentes na interface com as VLANs especificadas. Use esse comando com cuidado.

Sintaxe de configuração

Configuração

Explicação

DELLSONiC# configure

Entrar no modo de configuração

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

Configurar interface

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

Permite VLAN ou um intervalo de VLANs para a porta tronco. Para especificar o intervalo de VLAN, use <IDs de VLAN individuais separados 1..4094> (-) ou (,) e intervalos de IDs de VLAN; por exemplo, 20,70-100,142

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

Permitir todas as VLANs (opcional).

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

(Opcional. Use with Caution) Regrava todas as configurações de VLAN existentes na interface e permite a vlan/intervalo especificado de VLANs. 

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

Atribua uma VLAN sem marcação à porta (VLAN nativa) (opcional).


Exemplo de configuração
Vamos atribuir a VLAN 10 marcada e a VLAN 20 como porta de acesso (VLAN nativa não marcada) na interface Ethernet 1/1. Abaixo está a configuração de amostra.

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 o comando a seguir para verificar a configuração.
 

show vlan and show run interface <interface id>


Exemplo de saída

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#


 

Remova a VLAN de uma interface.

Sintaxe de configuração

Configuração

Explicação

DELLSONiC# configure

Entrar no modo de configuração

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

Configurar interface

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

Remova a VLAN ou um intervalo de VLANs de uma porta de tronco. Para especificar o intervalo de VLAN, use <IDs de VLAN individuais separados 1..4094> (-) ou (,) e intervalos de IDs de VLAN; por exemplo, 20,70-100,142

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

Remova a desetiqueta (acesso) da porta tronco.


Exemplo de configuração

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 o endereço IP e a MTU.

Por padrão, uma VLAN está na camada dois ou mais. Ele não tem um endereço IPv4 e IPv6. Podemos atribuir o endereço IPv4 ou IPv6 a uma VLAN manualmente.

Pontos a serem lembrados

  • Configure a MTU nos membros da VLAN antes de configurar a MTU da VLAN. Todos os membros de uma VLAN devem ter o mesmo valor de MTU. Os membros marcados devem ter uma MTU de link 4 bytes maior do que os membros sem marca para contabilizar a tag de pacote.
  • Você pode configurar vários endereços IPv6 em uma interface.
  • Você pode configurar um endereço IP secundário em uma VLAN


Sintaxe de configuração

Configuração

Explicação

DELLSONiC# configure

Entrar no modo de configuração

DELLSONiC(config)# interface Vlan <ID>

Configurar interface

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

Adicione o endereço IP.

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

Remova o endereço IP.

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

Adicionar endereço IPv6

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

Remova o endereço IPv6.

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

Altere a MTU (1312 para 9216). Padrão 9100


Exemplo de configuração
 

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 o comando a seguir para verificar a configuração.

show interface vlan <vlan id>


Exemplo de saída

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.