User:0xdc/Drafts/Cake

CAKE (Common Applications Kept Enhanced) is a traffic shaping-capable queue discipline. It is intended to be an improvement over the htb + fq_codel queue disciplines with very little configuration.

If a network connection is showing increased latency at maximum download and/or upload speed limit, then capping the bandwidth just below that limit will keep the latency low.

This is not only useful on routers, but on hypervisors and individual computers and laptops too.

Shaping
To shape outgoing traffic, attach the cake qdisc to the interface:

Linux cannot shape incoming packets, so we must mirror packets to an IFB device and emulate them egressing.

First, we add the special ingress chain to the interface:

Next, load the ifb module and set the new interface to "up":

Then, create a filter to redirect ("steal") all incoming packets to look like they are egress packets out of the ifb interface:

Finally, attach the cake qdisc to the ifb interface:

Script
The following script shows an example of an 80Mbit/s down, 20Mbit/s up VDSL line over PPPoE, although with appropriate tweaks it would also work with any network interface that has traffic going in or out.