SONiC VLANs explained: access ports, trunks, VLAN interfaces and routing between VLANs

Lesson 4 of the SONiC course: VLANs, access and trunk ports, the 802.1Q tag on the wire, VLAN interfaces as gateways and routing between VLANs, on Enterprise SONiC and on community SONiC.
Hand-drawn whiteboard: SONiC VLANs, access, trunk, gateway, with VLAN 10 and VLAN 20 joined by a VLAN interface

On this page

Three hosts and two switches. Two of the hosts belong together although they are plugged into different switches. The third must not hear them at all, and yet, when it needs to, it should be able to reach them. That is three ideas in one requirement: separation, extension and routing. On a switch they are the VLAN, the trunk and the VLAN interface. This post builds all three on blank SONiC switches, one command at a time, and after each one looks at what the switch did with it. The switches run Enterprise SONiC 4.6.0; the same steps follow on community SONiC.

This is the written deep dive for lesson 4 of the SONiC course on the LevelUP I.T. YouTube channel. It runs on the lab built in lesson 1, before the fabric exists: spine1 is used as a plain switch between leaf1a and leaf1b. Every output below is from the lab as the lesson recorded it.

What you'll find here

  • What a VLAN is: an address table and a set of ports of its own.
  • Two VLANs and two access ports, and the records behind them: VLAN and VLAN_MEMBER in CONFIG_DB, the bridge in Linux.
  • The MAC address table, per VLAN.
  • Access and trunk: untagged and tagged membership, and the 802.1Q tag captured on the wire.
  • VLAN interfaces as gateways, routing between VLANs, and the three tables that explain a routed ping.
  • What one gateway on one switch costs.
  • Removing VLANs, and what goes with them on each platform.
  • The community SONiC command set for the same steps.

This post is for paying subscribers only

Subscribe to LevelUp I.T. newsletter and stay updated.

Don't miss anything. Get all the latest posts delivered straight to your inbox. It's free!
Great! Check your inbox and click the link to confirm your subscription.
Error! Please enter a valid email address!