Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bigntallmike/c81debe0f24f4640b340d0f46222a230 to your computer and use it in GitHub Desktop.
Save bigntallmike/c81debe0f24f4640b340d0f46222a230 to your computer and use it in GitHub Desktop.
Basic QoS Settings Scripts for calling from Network Manager
# /etc/sysconfig/QOSDATA:
# Specify internal and external interface names and uplinks speeds
EXT="eno1"
INT="eno2"
EXTUP="10mbit"
INTUP="40mbit"
#/usr/local/libexec/qos_defaults:
#!/bin/sh
. /etc/sysconfig/QOSDATA
QDISC_DEL="/usr/sbin/tc qdisc del dev"
QDISC_ADD="/usr/sbin/tc qdisc add dev"
CLASS_ADD="/usr/sbin/tc class add dev"
case $1 in
$EXT)
# External Interface
$QDISC_ADD $EXT root fq_codel
;;
$INT)
# Internal Interface
$QDISC_DEL $INT root 2>/dev/null
$QDISC_ADD $INT root handle 1: htb default 100
$CLASS_ADD $INT parent 1: classid 1:100 htb rate $INTUP burst 16k
$QDISC_ADD $INT parent 1:100 handle 100: prio
$QDISC_ADD $INT parent 100:1 sfq # Interactive
$QDISC_ADD $INT parent 100:2 sfq # Best effort / interactive bulk
$QDISC_ADD $INT parent 100:3 sfq # Bulk
;;
esac
# /etc/NetworkManager/dispatcher.d/ifup-local:
#!/bin/sh
INF="$1" # interface name
STA="$2" # status
# Send message to /var/log/messages
logger -t "ifup.local" "$0 called for interface named $INF with $STA ..."
if [ "$STA" = "up" ]; then
case "$INF" in
eno*)
/usr/local/libexec/qos_defaults $1
;;
esac
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment