Dell Networking SONiC: Sådan opretter du et VLAN og tildeler det til trunk- og adgangsswitchporte

Summary: Denne artikel forklarer, hvordan du opretter et VLAN og tildeler det til trunk- og access-switchporte. Denne artikel bruger en switch, der kører 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

Vi bruger standardgrænsefladenavne til at demonstrere koncepterne. Se artiklen Dell Networking S-serien: Basic Interface Configuration - SONiC 4.0 for at få flere oplysninger om navngivning af grænseflade


Indholdsfortegnelse

  1. Indledning
  2. Opret VLAN
  3. Opret en række Vlan'er
  4. Konfigurer en grænseflade som adgangsport
  5. Konfigurer en grænseflade som trunkport
  6. Fjern VLAN fra en grænseflade
  7. Konfigurer IP-adresse og MTU


 

Indledning

Virtuelle lokalnetværk (VLAN'er) er logiske grænseflader. Det gør det muligt for en gruppe enheder at kommunikere som om de var i det samme netværk, uafhængigt af fysisk placering.
Fysisk grænseflade og PortChannel kan være medlemmer af Vlan. VLAN-serien er fra 1-4094.

Point at huske

  • Reserveret VLAN

Dell Enterprise SONiC reserverer 128 VLAN er til brug for de forskellige protokoller. Dette blev implementeret fra 4.0 og senere. Som standard er det reserverede VLAN-interval for SONiC 4.0 3967-4094. Du kan ændre det reserverede vlan-interval.

Se artiklen Dell Networking Enterprise SONiC reserveret VLAN for at få flere oplysninger om reserveret VLAN.

  • Skift profil
    • Standardswitchprofilen i Dell SONiC er L3 og har ikke noget VLAN. Vi skal oprette et VLAN, før vi tildeler en port til et VLAN.
    • L2-profilen har standard VLAN 1, og alle porte er som standard tildelt dette VLAN 1.

Se artiklen Dell Networking SONiC-operativsystemets L2- og L3-switchprofiler for at få flere oplysninger om L2- og L3-switchprofilen.

 

Opret VLAN

Syntaks for konfiguration

Konfiguration

Forklaring

admin@DELLSONiC:~$ sonic-cli

Indtast Dell Management Framework CLI.

DELLSONiC# configure terminal

Gå til konfigurationstilstand

DELLSONiC(config)# interface Vlan <Vlan ID>

Opret VLAN

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

Fjern et VLAN.


Opret en række Vlan'er
 

Konfiguration

Forklaring

DELLSONiC# configure terminal

Gå til konfigurationstilstand

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

Opret et udvalg af VLAN er

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

Fjern et interval af VLAN er.



Eksempel på konfiguration
Lad os konfigurere VLAN 10 på switchen.
 

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


Brug nedenstående kommando til at kontrollere, om VLAN et er oprettet.

show Vlan 


Eksempel på output

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


 

Opret en række Vlan'er

Konfiguration

Forklaring

DELLSONiC# configure terminal

Gå til konfigurationstilstand

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

Opret et udvalg af VLAN er

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

Fjern et interval af VLAN er.


Eksempel på konfiguration

Lad os oprette rækkevidde af 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#

 
Lad os fjerne Vlans 30-40

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


 

Konfigurer en grænseflade som adgangsport.

Adgangsport tillader kun et enkelt VLAN. Adgangen til VLAN-trafik er umærket.

Syntaks for konfiguration

Konfiguration

Forklaring

DELLSONiC# configure

Gå til konfigurationstilstand

DELLSONiC(config)# interface Ethernet <Number>

Konfigurer grænseflade

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

Tildel en port som adgangsport til VLAN.

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

Fjern adgangs-VLAN fra porten.


Eksempel på konfiguration
Antag, at vi skal tildele Port Ethernet 1/1 som en adgangsport til VLAN 10. Nedenfor er eksempelkonfigurationen.

 

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


Brug nedenstående kommandoer til at kontrollere konfigurationen.

show Vlan 

And 

show run interface <interface number>


Eksempel på 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


 

Konfigurer en grænseflade som trunkport.

Trunk-port kan have flere mærkede VLAN og et ikke-mærket VLAN (indbygget VLAN).

Point at huske

  • VLAN et skal oprettes, før det tildeles en grænseflade
  • Det samme VLAN kan ikke mærkes og ikke-mærkes VLAN i én grænseflade
  • Der kan kun tildeles ét Access eller ukodet VLAN (oprindeligt VLAN) i en grænseflade. 
  • Du kan bruge følgende kommando til at føje VLAN til eksisterende VLAN er i grænsefladen.
 
switchport trunk allowed VLAN add <Vlan id/Range of vlan>
 

FORSIGTIG: Kommandoen switchport trunk allowed VLAN Vlan <id/Range of vlan> omskriver alle VLAN er, der findes i grænsefladen med specificerede VLAN er. Brug denne kommando med forsigtighed.

Syntaks for konfiguration

Konfiguration

Forklaring

DELLSONiC# configure

Gå til konfigurationstilstand

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

Konfigurer grænseflade

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

Tillad VLAN eller et interval af VLAN er til trunkporten. For at angive VLAN-område skal du bruge <1..4094> (-) eller (,) adskilte individuelle VLAN-ID er og intervaller af VLAN-ID'er, f.eks. 20,70-100,142

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

Tillad alle VLAN er (valgfrit).

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

(Valgfrit. Brug med forsigtighed) Omskriver alle eksisterende VLAN-konfigurationer i grænsefladen og tillader det angivne vlan/interval af VLAN'er. 

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

Tildel umærket VLAN til port (oprindeligt VLAN) (valgfrit).


Eksempel på konfiguration
Lad os tildele VLAN 10-mærket og VLAN 20 som adgangsport (umærket native-vlan) på Ethernet 1/1-grænsefladen. Nedenfor er eksempelkonfigurationen.

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


Brug følgende kommando til at kontrollere konfigurationen.
 

show vlan and show run interface <interface id>


Eksempel på 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#


 

Fjern VLAN fra en grænseflade.

Syntaks for konfiguration

Konfiguration

Forklaring

DELLSONiC# configure

Gå til konfigurationstilstand

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

Konfigurer grænseflade

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

Fjern VLAN eller rækkevidde af VLAN er fra en trunkport. For at angive VLAN-område skal du bruge <1..4094> (-) eller (,) adskilte individuelle VLAN-ID er og intervaller af VLAN-ID'er, f.eks. 20,70-100,142

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

Fjern umærket (adgang) fra trunkporten.


Eksempelkonfiguration

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


 

Konfigurer IP-adressen og MTU'en.

Som standard er et VLAN i lag to eller flere. Den har ikke en IPv4- og IPv6-adresse. Vi kan tildele IPv4- eller IPv6-adressen til et VLAN manuelt.

Point at huske

  • Konfigurer først MTU på VLAN-medlemmer, før du konfigurerer VLAN MTU. Alle medlemmer af et VLAN skal have den samme MTU-værdi. Mærkede medlemmer skal have et link, der er 4 byte højere end ikke-mærkede medlemmer for at tage højde for pakketagget.
  • Du kan konfigurere flere IPv6-adresser på en grænseflade.
  • Du kan konfigurere en sekundær IP-adresse i et VLAN


Syntaks for konfiguration

Konfiguration

Forklaring

DELLSONiC# configure

Gå til konfigurationstilstand

DELLSONiC(config)# interface Vlan <ID>

Konfigurer grænseflade

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

Tilføj IP-adresse.

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

Fjern IP-adressen.

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

Tilføj IPv6-adresse

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

Fjern IPv6-adressen.

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

Skift MTU (1312 til 9216). Standard 9100


Eksempelkonfiguration
 

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


Brug følgende kommando til at kontrollere konfigurationen.

show interface vlan <vlan id>


Eksempel på 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.