Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux_router:tc [2026-05-13 Wed wk20 21:30] – [TC - Traffic Control] baumkp | linux_router:tc [2026-05-18 Mon wk21 02:34] (current) – [Links] baumkp | ||
|---|---|---|---|
| Line 23: | Line 23: | ||
| Test your connection at the [[https:// | Test your connection at the [[https:// | ||
| - | CAKE (Common Applications Kept Enhanced) is the modern Linux qdisc that fixes this. It combines Active Queue Management (AQM), Fair Queuing (FQ), and traffic shaping into a single qdisc. CAKE has been in the mainline kernel since 4.19, so no extra kernel modules are required on any modern distro. It replaced the older approach of combining fq_codel with htb shaping - CAKE does everything in one shot with less configuration. | + | [[https:// |
| - | Upload Shaping | + | |
| + | ====Upload Shaping==== | ||
| Apply CAKE to your WAN interface with your upload bandwidth set to 90-95% of measured speed: | Apply CAKE to your WAN interface with your upload bandwidth set to 90-95% of measured speed: | ||
| - | + | *'' | |
| - | '' | + | |
| Key options: | Key options: | ||
| Line 36: | Line 35: | ||
| *ack-filter-aggressive - reduces TCP ACK congestion on asymmetric links (important if your download is much faster than upload) | *ack-filter-aggressive - reduces TCP ACK congestion on asymmetric links (important if your download is much faster than upload) | ||
| - | Download Shaping with IFB | + | ====Download Shaping with IFB==== |
| CAKE can only shape outgoing (egress) traffic. To shape incoming (ingress) traffic - which is where download bufferbloat lives - you redirect incoming packets through an Intermediate Functional Block (IFB) device and apply CAKE there: | CAKE can only shape outgoing (egress) traffic. To shape incoming (ingress) traffic - which is where download bufferbloat lives - you redirect incoming packets through an Intermediate Functional Block (IFB) device and apply CAKE there: | ||
| - | + | ++++bash script for ingress traffic| | |
| - | # Create and bring up IFB device | + | <code bash># Create and bring up IFB device |
| ip link add ifb-wan0 type ifb | ip link add ifb-wan0 type ifb | ||
| ip link set ifb-wan0 up | ip link set ifb-wan0 up | ||
| Line 50: | Line 49: | ||
| # Apply CAKE on the IFB device | # Apply CAKE on the IFB device | ||
| - | tc qdisc replace dev ifb-wan0 root cake bandwidth 900mbit besteffort wash | + | tc qdisc replace dev ifb-wan0 root cake bandwidth 900mbit besteffort wash </ |
| Set the IFB bandwidth to 90-95% of your measured download speed. | Set the IFB bandwidth to 90-95% of your measured download speed. | ||
| - | Persist Across Reboots | + | ++++ |
| + | ====Persist Across Reboots==== | ||
| These tc commands do not survive a reboot on their own. Create a systemd service: | These tc commands do not survive a reboot on their own. Create a systemd service: | ||
| - | + | ++++sudo vim / | |
| - | # / | + | <code bash># / |
| [Unit] | [Unit] | ||
| Description=SQM (CAKE) Traffic Shaping | Description=SQM (CAKE) Traffic Shaping | ||
| Line 83: | Line 82: | ||
| [Install] | [Install] | ||
| - | WantedBy=multi-user.target | + | WantedBy=multi-user.target</ |
| - | + | ||
| - | Enable it: | + | |
| - | + | ||
| - | systemctl enable --now sqm.service | + | |
| - | Verify It Works | + | Enable it: '' |
| + | ++++ | ||
| - | After applying CAKE, rerun the Waveform Bufferbloat Test . You should see latency under load drop from 200-500ms down to 5-15ms. Video calls stop freezing mid-sentence and game ping stays flat even during large transfers. | + | ====Verify It Works==== |
| - | Monitor | + | After applying |
| - | tc -s qdisc show dev wan0 | + | ====Monitor CAKE statistics==== |
| - | tc -s qdisc show dev ifb-wan0 | + | *'' |
| + | | ||
| This shows drops, ECN marks, and per-tin flow counts. If you see high drop rates, your bandwidth setting may be too close to the actual line speed. Lower it by another 5%. | This shows drops, ECN marks, and per-tin flow counts. If you see high drop rates, your bandwidth setting may be too close to the actual line speed. Lower it by another 5%. | ||
| Line 103: | Line 100: | ||
| *[[https:// | *[[https:// | ||
| *[[https:// | *[[https:// | ||
| + | *[[https:// | ||
| *tc-fq_codel | *tc-fq_codel | ||
| *[[https:// | *[[https:// | ||