Snake Test for networking performance testing

Ostinato Team bio photo By Ostinato Team

What is a Snake Test?

Verifying that a switch or router device can handle traffic at its full line rate (or vendor claimed max rate) across all ports is a standard part of all network equipment acceptance testing.

With increasing port densities in today’s network equipment (32 port, 48 port, 64 port, 96 port) actually performing this test is difficult because of lack of enough traffic generator ports (a costly and limited resource).

When there aren’t enough traffic generator ports to connect to all ports of the switch/router, a snake test provides an effective solution. This post explores L2 (Layer 2) snake test using a simple VLAN configuration, providing a technical yet easy-to-understand approach to optimize network testing with limited traffic generator resources.

The L2 snake test focuses on verifying the performance of a device under test (DUT) at Layer 2 (L2). You can use it for L2 switches or L3 routers if they support forwarding at L2. A future blog post will explore L3 configuration to do a snake test.

Snake Test Topology

Snake test topology (daisy chained ports)

Connect the first (port 1) and last ports (port N) of the DUT to the traffic generator.

Of the remaining ports, connect neighboring ports of the DUT back-to-back -

  • Connect port 2 to port 3
  • Connect port 4 to port 5
  • Continue in this fashion until all ports are connected

The setup and configuration process mentioned below applies both for pizza box (1RU) style devices and chassis devices with multiple line cards.

Snake Test Configuration (Layer 2)

  1. VLAN Assignment: Assign VLANs to neighboring port pairs
    • Port 1 and 2 to VLAN X
    • Port 3 and 4 to VLAN Y
    • Continue in this fashion until the last pair is assigned to a VLAN
  2. All ports are configured as access VLAN ports (not trunk vlan)

Example configuration

  1. Port 1 and Port 8: connected to traffic generator ports
  2. Port 1 and Port 2: VLAN 100
  3. Port 3 and Port 4: VLAN 200
  4. Port 5 and Port 6: VLAN 300
  5. Port 7 and Port 8: VLAN 400

Here’s the traffic flow diagram for the example configuration

Layer 2 Snake test traffic flow

Snake Test Traffic

Generate untagged line rate traffic from the traffic generator. Traffic could be generated either from a single traffic generator port (unidirectional traffic test) or both traffic generator ports (bidirectional traffic test) depending on the desired test.

Traffic Flow

To understand the traffic flow in an L2 snake test, let’s break down how packets move through the network with the example configuration above -

Traffic Source

  • Traffic is generated from the traffic generator port connected to first port of DUT. i.e., Port 1
  • The traffic is untagged

Traffic Flow through port pairs

  • Port 1 to Port 2
    • Traffic enters Port 1 untagged and is classified into VLAN 100 due to the access VLAN configuration
    • Traffic is forwarded to Port 2 by one of the following mechanisms
      • If MAC learning hasn’t happened yet, unknown unicast flooding (there’s only one other port – port 2 in the VLAN)
      • If MAC learning has happened (due to a reverse traffic flow), the destination MAC is already learned on port 2
    • Traffic exits Port 2 untagged
  • Port 2 to Port 3
    • Traffic exiting port 2 enters port 3 due to the physical back-to-back connectivity between port 2 and port 3
  • Port 3 to Port 4
    • Similar to Port 1 —> Port 2, except VLAN 200 is used for forwarding
  • Port 4 to Port 5
    • Traffic exiting port 4 enters port 5 due to the physical back-to-back connectivity between port 4 and port 5
  • Port 5 to Port 6
    • Similar to Port 1 —> Port 2, except VLAN 300 is used for forwarding
  • Port 6 to Port 7
    • Traffic exiting port 6 enters port 7 due to the physical back-to-back connectivity between port 6 and port 7
  • Port 7 to Port 8
    • Similar to Port 1 —> Port 2, except VLAN 400 is used for forwarding

Traffic Sink

  • Traffic exits the DUT through the last port connected to the traffic generator, i.e., Port 8
  • Traffic enters the second traffic generator port
  • Traffic Generator compares the source and sink traffic stats to verify and validate the performance of the DUT

A similar traffic flow applies for the reverse traffic generated from the traffic generator port connected to the last port of the DUT, i.e., Port 8.

Ensure that the Source and Destination MAC addresses are swapped in the traffic generated from the two traffic generator ports to enable correct MAC learning and forwarding.

On some DUTs, there may be a performance difference between unknown unicast forwarding (aka BUM traffic) and unicast forwarding.

Why Use Different VLANs?

Using different VLANs for each port pair helps in isolating traffic between different segments of the DUT. This setup prevents potential broadcast storms and allows for a clearer assessment of the DUT’s handling of multiple VLANs. It ensures that traffic between each pair of ports is treated independently, which is critical for accurately measuring performance metrics such as throughput.

If the same VLAN were used throughout, it will lead to traffic interference and skewed results, as all traffic would be in the same broadcast domain, potentially causing congestion and collision. It is therefore important that there are only two ports in each VLAN.

Benefits of Snake Test

  • Simplified Setup: By utilizing just two ports on the traffic generator, this method minimizes setup complexity.
  • Effective Line-Rate Validation: Snake test provides the capability to perform line rate validation tests (excluding measurements of latency and jitter) for both L2 and L3 packets as per the specifications in RFC 2544 and RFC 3918.
  • Stress Test: Generating line rate traffic and making it traverse all ports is an effective way to stress test the networking equipment at both the interface and forwarding ASIC levels
  • ASIC Packet Throughput Measurement: Snake test measures the forwarding ASIC packet throughput (pps) for both L2 and L3 packets across various packet sizes.
  • Cost-Effective: This approach reduces the requirement for expensive, multi-port traffic generators, resulting in lower testing expenses.


The L2 snake test is a practical approach for verifying the full forwarding capacity of the DUT across all ports. Using the snake test, network engineers can efficiently and cost-effectively ensure their devices meet necessary performance benchmarks.

Although this post used a L2 VLAN forwarding configuration, a L3 configuration can be used to verify forwarding at layer 3. Together these tests provide a comprehensive view of the device’s performance at different network layers, ensuring robust and reliable network operation.

🚀 The Ostinato Turbo add-on provides full line rate traffic generation. Combining Ostinato’s low cost with the Snake test can lead to significant cost savings for testing network equipment.


RFC 8239

This is a guest post by Tanu Vishwanath - a dataplane network engineer with 20 years of industry experience