Arista EOS VLAN Configuration: Access, Trunk and SVI - 夜莺博客

Arista EOS VLAN Configuration: Access, Trunk and SVI

Arista EOS implements IEEE 802.1Q VLANs across the 7050, 7060, 7170 and 7280 families, supporting up to 4094 VLAN IDs with the control plane decoupled from the data plane. This run book walks the full VLAN lifecycle on EOS: creating and naming VLANs, configuring access and trunk ports, voice VLANs, port-channel (LAG) memberships, and inter-VLAN routing through SVIs - with verification commands after every step.

Arista EOS VLAN trunk configuration run book

VLAN Creation and Management

switch# configure terminal
switch(config)# vlan 10
switch(config-vlan-10)# name mgmt
switch(config-vlan-10)# state active
switch(config-vlan-10)# exit

Create multiple VLANs in one command with vlan 10,20,30,40, suspend a VLAN with state suspend, delete it with no vlan 40, and verify with show vlan, show vlan brief or show vlan id 10. Unlike Cisco IOS there is no separate vlan.dat file - the VLAN database lives in the running configuration and is persisted with write memory.

Access Port Configuration

switch(config)# interface Ethernet1
switch(config-if-Et1)# description web-server-01
switch(config-if-Et1)# switchport mode access
switch(config-if-Et1)# switchport access vlan 20
switch(config-if-Et1)# spanning-tree portfast
switch(config-if-Et1)# no shutdown

Use interface ranges (interface Ethernet1-8) to configure many access ports at once. For IP phones, EOS supports an auxiliary voice VLAN on the same port:

switch(config)# interface Ethernet5
switch(config-if-Et5)# switchport mode access
switch(config-if-Et5)# switchport access vlan 20
switch(config-if-Et5)# switchport voice vlan 100
switch(config-if-Et5)# spanning-tree portfast

Trunk Port Configuration

switch(config)# interface Ethernet49
switch(config-if-Et49)# switchport mode trunk
switch(config-if-Et49)# switchport trunk allowed vlan 10,20,30,40
switch(config-if-Et49)# switchport trunk native vlan 999
switch(config-if-Et49)# no shutdown

Add VLANs with switchport trunk allowed vlan add 50,60, remove them with switchport trunk allowed vlan remove 60, or allow everything with switchport trunk allowed vlan all. Security note: always set the native VLAN to an unused ID such as 999 - never leave VLAN 1 as native in production, since it is susceptible to VLAN hopping.

Trunk Between Two Arista Switches

! sw1 (distribution)
switch(config)# interface Ethernet49
switch(config-if-Et49)# description Downlink-to-sw2
switch(config-if-Et49)# switchport mode trunk
switch(config-if-Et49)# switchport trunk allowed vlan 10,20,30,40
switch(config-if-Et49)# switchport trunk native vlan 999
switch(config-if-Et49)# no shutdown

Apply the mirrored configuration on sw2 and verify adjacency with show lldp neighbors and show interfaces Ethernet49 trunk.

VLAN on Port-Channel (LAG) Interfaces

switch(config)# interface Port-Channel1
switch(config-if-Po1)# description LAG-to-sw2
switch(config-if-Po1)# switchport mode trunk
switch(config-if-Po1)# switchport trunk allowed vlan 10,20,30,40
switch(config-if-Po1)# switchport trunk native vlan 999
switch(config)# interface Ethernet49,Ethernet50
switch(config-if-Et49,Et50)# channel-group 1 mode active
switch(config-if-Et49,Et50)# no shutdown

VLAN configuration is applied to the port-channel interface only; members carry no VLAN-specific config. Verify with show port-channel 1.

Inter-VLAN Routing with SVIs

switch(config)# ip routing
switch(config)# interface Vlan10
switch(config-if-Vl10)# description SVI-mgmt
switch(config-if-Vl10)# ip address 10.10.10.1/24
switch(config-if-Vl10)# no shutdown
switch(config)# interface Vlan20
switch(config-if-Vl20)# ip address 10.10.20.1/24
switch(config-if-Vl20)# no shutdown

Routing between VLANs is performed in hardware at line rate. An SVI only comes up when at least one port in the VLAN is up and in STP forwarding state. Verify with show ip interface brief and show ip route.

Routed Ports

switch(config)# interface Ethernet50
switch(config-if-Et50)# no switchport
switch(config-if-Et50)# ip address 10.0.0.2/30
switch(config-if-Et50)# no shutdown

Revert with the switchport command. EOS does not support DTP or VTP - trunk mode must be configured explicitly on both ends.

Related articles: How to manage VLANs on Arista EOS, ArubaOS-CX access vs trunk native VLAN tagging, and Port mirroring on Cisco, Huawei and Arista.

原文链接:https://infrarunbook.com/article/arista-eos-vlan-trunk-configuration-access-trunk-inter-vlan-routing