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

Arista EOS VLAN Configuration Step by Step: Access, Trunk, SVI

EOS keeps VLAN configuration deliberately close to IOS, so the syntax is easy - and that is exactly why small differences cause silent failures. This is the full path from an unconfigured port to a verified Layer 2 and Layer 3 setup: VLAN creation, access port, trunk port, switched virtual interface, and the verification commands that prove each step.

Step 1 - Create the VLANs

EOS offers two ways to create a VLAN. The single-VLAN form enters VLAN configuration mode so you can name it; the range form creates many at once.

switch(config)# vlan 10
switch(config-vlan-10)# name SERVERS
switch(config-vlan-10)# exit

switch(config)# vlan 20,30,40
switch(config-vlan-20-40)# exit

VLANs are not persistent objects in the hardware until they are created here. A port configured for access vlan 40 when VLAN 40 does not exist is a port that will not forward.

Step 2 - Configure an Access Port

switch(config)# interface Ethernet1
switch(config-if-Et1)# switchport mode access
switch(config-if-Et1)# switchport access vlan 10
switch(config-if-Et1)# spanning-tree portfast
switch(config-if-Et1)# spanning-tree bpduguard enable
switch(config-if-Et1)# no shutdown

All ports on EOS are switchports by default; the switchport keyword is implicit but writing it makes intent explicit and survives reviews.

Step 3 - Configure a Trunk Port

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

Note the safest habit with allowed lists: use switchport trunk allowed vlan with an explicit list rather than add, which appends to the current list and makes the resulting state depend on history. If you do use add, verify with show interfaces Ethernet2 trunk afterwards - the allowed list on EOS is enforced, so a forgotten VLAN is a silent black hole for that VLAN rather than a trunk-wide outage.

Step 4 - Build the SVI for Routing

switch(config)# interface Vlan10
switch(config-if-Vl10)# description SERVER-GATEWAY
switch(config-if-Vl10)# ip address 10.10.10.1/24
switch(config-if-Vl10)# no shutdown

switch(config)# ip routing

ip routing is the step most often forgotten when EOS is replacing a switch that previously sat behind an external router. Without it, SVIs come up but no inter-VLAN traffic is routed.

Step 5 - Verify Port by Port

switch# show vlan
switch# show vlan 10
switch# show interfaces Ethernet1 switchport
switch# show interfaces Ethernet2 trunk
switch# show interfaces Vlan10
switch# show ip interface brief
switch# show ip route
switch# show mac address-table vlan 10
  • show vlan - confirms the VLAN exists and lists its ports; an access port must appear here.
  • show interfaces Ethernet2 trunk - prints mode, native VLAN and the allowed list, which is the definitive check on a trunk.
  • show ip interface brief - confirms each SVI is up/up and has the intended mask.
  • show mac address-table vlan 10 - if expected hosts are missing, the problem is on the access side, not the SVI.

Step 6 - Save and Stage

switch# copy running-config startup-config
switch# show running-config interfaces Ethernet2
switch# write memory

EOS supports configuration sessions for change control, which is worth using on production: configure session change-ticket-1234, make the edits, review with show session-config named change-ticket-1234 diffs, then commit. Nothing touches the running configuration until the commit, which is a far better safety net than editing live.

Common Failures and What They Look Like

Symptom Likely cause
VLAN tagged on the trunk but hosts unreachable VLAN not created, or missing from the allowed list
Inter-VLAN traffic dead, SVIs up ip routing not enabled
Untagged frames leaking between switches Native VLAN left at default 1 on one side only
Access port drops frames from a tagged host Port left in access mode when the host tags; make it a trunk
SVI down/down No active member port in that VLAN, or VLAN not created

Once basic VLANs are working, the natural next step is Layer 3 policy - the route map and prefix list guide covers redistribution, and the OSPF walkthrough shows how to advertise these SVIs. If you plan to automate the build, eAPI and pyeapi can push the same configuration programmatically.

原文链接:https://www.arista.com/en/um-eos/eos-virtual-lans-vlans