traffic control shaping
This example configures traffic control settings:
- configure interface eth0 with an ipv4 address
- add traffic control shaping with the cake qdisc
- add a
ifb0device for incoming shaping on eth0 - set shaper to 80Mbps download and 30Mbps upload speed
interfaces:
ifb0:
link:
kind: ifb
state: up
tc:
qdisc:
kind: cake
handle: "1:"
bandwidth: 80mbit
eth0:
addresses:
- 192.0.2.1/24
link:
kind: physical
state: up
tc:
ingress: true
qdisc:
kind: cake
handle: "1:"
bandwidth: 30mbit
filter:
- kind: matchall
parent: "ffff:"
action:
- kind: mirred
direction: egress
action: redirect
dev: ifb0
{
networking.ifstate = {
enable = true;
settings = {
interfaces = {
ifb0 = {
link = {
kind = "ifb";
state = "up";
};
tc = {
qdisc = {
kind = "cake";
handle = "1:";
bandwidth = "80mbit";
};
};
};
eth0 = {
addresses = [ "192.0.2.1/24" ];
link = {
kind = "physical";
state = "up";
};
tc = {
ingress = true;
qdisc = {
kind = "cake";
handle = "1:";
bandwidth = "30mbit";
};
filter = [{
kind = "matchall";
parent = "ffff:";
action = [{
kind = "mirred";
direction = "egress";
action = "redirect";
dev = "ifb0";
}];
}];
};
};
};
};
};
}
# configure interfaces
ip link add name ifb0 type ifb
ip link set ifb0 up
ip address add 192.0.2.1/24 dev eth0
ip link set eth0 up
# configure traffic control shaping
tc qdisc add dev ifb0 parent root handle 1: cake bandwidth 80mbit
tc qdisc add dev eth0 parent root handle 1: cake bandwidth 30mbit
tc filter add dev eth0 parent ffff: matchall action mirred egress redirect \
dev ifb0