Skip to content

Instantly share code, notes, and snippets.

@Randy420Marsh
Last active January 3, 2026 08:43
Show Gist options
  • Select an option

  • Save Randy420Marsh/41ac63c491d554bde1354c7edfe4707b to your computer and use it in GitHub Desktop.

Select an option

Save Randy420Marsh/41ac63c491d554bde1354c7edfe4707b to your computer and use it in GitHub Desktop.
latency tuning and stuff with wireless bridge
Latency Tuning Summary: ethtool & Beyond
You have successfully moved both machines from "Efficiency Mode" (High Latency) to "Formula 1 Mode" (Lowest Jitter). Here is the breakdown of the transformation.
1. Performance at Defaults
By default, Ubuntu and your hardware use Interrupt Coalescing and ASPM Power Management. This is designed to save electricity and reduce CPU heat, but it is the enemy of low-latency networking.
Behavior: The NIC waits to "bundle" packets before telling the CPU. This creates the "batching" effect you saw.
Latency Result: Your "Loaded High" latency was spiking between 250ms and 999ms under load.
Jitter: High. The connection felt "stuttery" because packets arrived in bursts rather than a smooth stream.
2. The Optimal "Low-Latency" Settings
After our testing, these are the confirmed "Sweet Spot" settings for your specific hardware.
Older PC (M4A79) — Realtek RTL8111
The Command: sudo ethtool -C enp3s0 rx-usecs 0 tx-usecs 0
The Logic: Forces rx-frames 1. The NIC interrupts the CPU for every single packet immediately.
Result: Real-world latency dropped by 95%. This is the most aggressive setting possible.
Newer PC (Z170PG) — Intel i219-V
The Command: sudo ethtool -C enp0s31f6 rx-usecs 1
The Logic: Provides a 1-microsecond safety buffer.
Result: Setting this to 0 actually caused lag because the Intel chip became "interrupt-bound." Setting it to 1 allowed full 282 Mbps throughput with a "Loaded High" of only 58ms.
3. The Permanent "Dispatcher" Script
To ensure these settings survive a reboot on Ubuntu 24.04, you should use a NetworkManager script.
Create script: sudo nano /etc/NetworkManager/dispatcher.d/99-net-tune
Paste content (Adjust interface names for each PC):
Bash
#!/bin/sh
INTERFACE=$1
STATUS=$2
if [ "$STATUS" = "up" ]; then
case "$INTERFACE" in
"enp3s0") # For Old PC
/usr/sbin/ethtool -C enp3s0 rx-usecs 0 tx-usecs 0
;;
"enp0s31f6") # For New PC
/usr/sbin/ethtool -C enp0s31f6 rx-usecs 1
;;
esac
fi
Permissions: sudo chmod +x /etc/NetworkManager/dispatcher.d/99-net-tune
4. Final Bridge Safety Rule
To keep the 999ms spike from returning on the wireless side, remember the "90% Rule":
Set FreshTomato Bandwidth Limiter to 240 Mbps.
This keeps the hardware buffer of the RT-AC66U from ever filling up, allowing your ethtool optimizations to actually reach the internet.
Would you like me to help you verify that the Dispatcher script is working correctly after your next reboot?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment