Files
qos-profiles/50-qos-profiles
zpericic 86a0d2cdd1 Initial import of qos-profiles
Role subpackages set the system-wide default qdisc and TCP congestion
control via /usr/lib/sysctl.d, without pulling in the base package:

  server   fq + bbr        bare metal, VM guests
  vmhost   fq_codel + bbr  hypervisors, container hosts
  router   fq_codel + cubic
  desktop  fq_codel + cubic

The base package applies cake per interface from
/etc/qos-profiles/<iface>.conf, layered over role defaults and
/etc/qos-profiles/defaults.conf:

- LINK_RATE with per-direction overrides, shaped to SHAPE_PERCENT
  (default 95, per direction overridable)
- outbound fairness per source host and diffserv4; inbound via ifb,
  fairness per destination host, besteffort with DSCP wash
- NAT awareness, extra cake args (shared and per direction), raw
  qdisc overrides
- config parsed without executing it, validated before any change,
  previous state undone on each run

Applied by the qos-profiles@<iface> unit (bound to the device) or the
qos-profiles-networkmanager dispatcher subpackage, installed
automatically on hosts with NetworkManager. Includes ready-made
examples for VM hosts, OVH dual-NIC servers, DC and home routers.
2026-10-10 22:41:12 +02:00

17 lines
643 B
Bash
Executable File

#!/usr/bin/bash
# NetworkManager dispatcher: apply qos-profiles when an interface with
# /etc/qos-profiles/<iface>.conf comes up, clean up when it is removed.
# Both the device and its IP interface are checked (eth0 and ppp0 for PPPoE).
action=$2
ifaces=("$1")
[[ -n ${DEVICE_IP_IFACE:-} && $DEVICE_IP_IFACE != "$1" ]] && ifaces+=("$DEVICE_IP_IFACE")
for iface in "${ifaces[@]}"; do
[[ -n $iface && -f /etc/qos-profiles/$iface.conf ]] || continue
case $action in
up | reapply) /usr/libexec/qos-profiles/qos-apply start "$iface" ;;
down) [[ -e /sys/class/net/$iface ]] || /usr/libexec/qos-profiles/qos-apply stop "$iface" ;;
esac
done