SonicLab18 lessons · Available
On this page
L2 forwarding · Practical operator lesson

VLAN Membership and MAC Learning

Put two untagged endpoints in one VLAN, follow source-MAC learning, and diagnose a wrong-membership fault.

Prerequisite: Persistence, Changes, and RecoveryScenario → configuration → state → evidence → fault / repair
By the end, you should be able to:
  • Configure two reserved ports as untagged members of one VLAN.
  • Relate source learning and destination lookup to the observed FDB.
  • Repair a membership error without treating stale state as packet proof.

Community SONiC 202505 source baseline; single ASIC, default namespace, community CLI. Virtual feature support and physical ASIC behavior differ. All commands and output are illustrative; no lab was executed.

Scenario: one VLAN, two endpoints

Host A and Host B are Linux endpoints already configured as shown. Both send untagged frames and use /24 masks. They need no default gateway to reach each other. SONiC has no IP interface on Vlan100 in this example.

VLAN 100: a bridged path
VLAN 100: a bridged pathHost A eth1, 192.0.2.10/24 and MAC 02:00:00:00:00:0a connects to SONiC Ethernet0. Host B eth1, 192.0.2.20/24 and MAC 02:00:00:00:00:0b connects to Ethernet4. Both switch ports are untagged members of VLAN100. There is no SVI or routed hop.Host A · eth1192.0.2.10/24SONiC · VLAN 100Ethernet0 ↔ Ethernet4Host B · eth1192.0.2.20/24UntaggedUntaggedMAC 02:00:00:00:00:0aMAC 02:00:00:00:00:0bSame IP subnet; no SVI, gateway, or TTL decrement at this switch.
Original topology. MAC addresses are invented locally administered examples. Only the two reserved ports participate; no loop or external VLAN extension is present.
Lab contract: isolated, reserved ports and documentation addresses; independent management access. Starting baseline: listed switch ports administratively down, no lab addresses or VLAN/LAG membership, and no lab static routes; endpoints already prepared as shown. Record and verify that baseline first. If it differs, adapt the plan rather than overwrite existing state. Use the before-state method from lesson 06. No example saves startup configuration. All output and packet results are illustrative, not live observations.

Configuration: make membership explicit

Use unused VLAN IDs 100 and 200, and ports Ethernet0/Ethernet4 with no L3 address, LAG membership, or existing VLAN membership. If those assumptions fail, stop and select a clean lab allocation rather than remove unrelated configuration.

show version
show vlan config
show interfaces status
config vlan member add --help
sudo config vlan add 100
sudo config vlan member add -u 100 Ethernet0
sudo config vlan member add -u 100 Ethernet4
sudo config interface startup Ethernet0
sudo config interface startup Ethernet4

SONiC setup commands for the reserved lab. Illustrative only; not executed on a SONiC device.

-u matters: without it this baseline creates a tagged member. The endpoints here do not send VLAN tags. Port existence and correct speed/physical connectivity remain separate prerequisites.

Read further: 202505 VLAN membership CLI · 202505 command reference (pinned).

State: membership first, then learning

show vlan config
show vlan brief
show interfaces status Ethernet0
show interfaces status Ethernet4
show mac -v 100

Read-only inspection. Illustrative only; not executed on a SONiC device.

Name       VID  Member     Mode
Vlan100    100  Ethernet0  untagged
Vlan100    100  Ethernet4  untagged

Invented shortened membership output.

Membership describes which ports belong to the bridge domain. A quiet endpoint may have no learned FDB entry yet. From Host A, generate a small demand with ping -c 3 192.0.2.20; then inspect the FDB again.

Vlan  MacAddress         Port       Type
100   02:00:00:00:00:0a  Ethernet0  Dynamic
100   02:00:00:00:00:0b  Ethernet4  Dynamic

Invented FDB excerpt after traffic from both endpoints. Column layout varies.

The switch learns a frame’s source MAC on its ingress port within the VLAN. It looks up the destination MAC to select an egress action. Do not reverse those roles or assume an FDB entry proves the host is reachable now.

Read further: 202505 command reference (pinned) · Windows cross-check revision: FDB orchestration.

Forwarding evidence: follow the first exchange

  1. A treats B as on-link and broadcasts an ARP request in VLAN 100. The bridge can learn A’s source MAC.
  2. The broadcast reaches eligible forwarding members of VLAN 100, including Ethernet4. B’s reply supplies B’s IP-to-MAC mapping to A and lets the bridge learn B’s source MAC.
  3. Subsequent known-unicast frames to B use the VLAN/MAC entry toward Ethernet4. Unknown unicast normally floods only eligible members of that VLAN, subject to platform configuration and forwarding state.

Check host neighbor state, both endpoint captures if available, a bounded ping result, and relevant counters. A hypothetical 3/3 reply result supports that tested exchange only. FDB output is a software-visible view; it is not independent verification of every ASIC table. Virtual behavior does not establish hardware throughput.

Fault and repair: B joins the wrong VLAN

sudo config vlan add 200
sudo config vlan member del 100 Ethernet4
sudo config vlan member add -u 200 Ethernet4
show vlan config
show mac -v 100
show mac -v 200

Isolated fault injection on the reserved B-facing port only. Illustrative only; not executed on a SONiC device.

A remains in VLAN 100; B’s untagged ingress now belongs to VLAN 200. Their matching IP subnet does not merge those broadcast domains. A cannot newly resolve B across this separation. B may learn in VLAN 200 when it transmits. A cached host ARP or stale FDB row can remain temporarily; neither overrides membership or proves delivery.

sudo config vlan member del 200 Ethernet4
sudo config vlan member add -u 100 Ethernet4
sudo config vlan del 200
show vlan config
show mac -v 100

Repair the exact membership change; VLAN 200 must have no other lab use. Illustrative only; not executed on a SONiC device.

Repeat the endpoint exchange and compare membership, learning, and packet results. For full teardown after repair, use the following sequence. It restores the stated absent-VLAN/admin-down switch baseline; endpoints retain their original prepared addresses. Do not automatically config save.

sudo config vlan member del 100 Ethernet0
sudo config vlan member del 100 Ethernet4
sudo config vlan del 100
sudo config interface shutdown Ethernet0
sudo config interface shutdown Ethernet4
show vlan config
show interfaces status

Teardown only after the fault has been repaired and VLAN 200 removed. Illustrative only; not executed on a SONiC device.

Compare the final switch state with the before record.

Key takeaways

  • VLAN membership and endpoint tag behavior must agree.
  • Learn source MACs on ingress; look up destination MACs within the VLAN.
  • Same-subnet IP addresses do not bridge separate VLANs.
  • Cached ARP or FDB state can outlive a change; compare it with fresh traffic evidence.
  • Repair the bounded change and reconcile running versus saved configuration separately.

Check your understanding

Six questions, four choices each. Review the explanation after each answer, then see your score and retry.

Sources & baseline

Reviewed 18 October 2026. Community source pins: sonic-utilities 7511bf2f8ea3582c2b67cf5016f8e8237e62882b; sonic-buildimage ff3c0c9f686a1d0dbddbe813b233b3b7a51bd8e2. Confirm image support and local help; these pins are not a claim about a deployed binary.

Additional Windows code inspection: buildimage 128f6802b6e1, utilities cc4fbb3e8313, SWSS b8a9b65494c2. The static-route manager is inside sonic-buildimage, not a separate checked-out repository. These are different revisions from the release baseline. Exact paths and checks are recorded in SOURCE-REVIEW.txt.

Lesson 07 · Knowledge check