Skip to content

Instantly share code, notes, and snippets.

@diffficult
Forked from beardicus/edgerouter-qos
Last active July 9, 2023 16:32
Show Gist options
  • Save diffficult/3b1d1ee9ce141b1db071d348d1c40665 to your computer and use it in GitHub Desktop.
Save diffficult/3b1d1ee9ce141b1db071d348d1c40665 to your computer and use it in GitHub Desktop.
EdgeRouter Lite QOS Settings
#
# fair-queue based settings for EdgeRouter Lite traffic shaping
#
# download is typically 6 and change. everything can burst to 100%
# of bandwidth, priority rules keep the garbage in check
set traffic-policy shaper download
set traffic-policy shaper download bandwidth 30Mbit
# set default download priority
set traffic-policy shaper download default bandwidth 90%
set traffic-policy shaper download default ceiling 100%
set traffic-policy shaper download default priority 3
set traffic-policy shaper download default queue-type fair-queue
# megasuper priority dns and ssh and icmp
set traffic-policy shaper download class 10 bandwidth 10%
set traffic-policy shaper download class 10 ceiling 100%
set traffic-policy shaper download class 10 priority 5
set traffic-policy shaper download class 10 queue-type fair-queue
set traffic-policy shaper download class 10 match icmp ip protocol icmp
set traffic-policy shaper download class 10 match ssh ip source port 22
set traffic-policy shaper download class 10 match dns ip source port 53
# semipriority http and https
set traffic-policy shaper download class 20 bandwidth 10%
set traffic-policy shaper download class 20 ceiling 100%
set traffic-policy shaper download class 20 priority 4
set traffic-policy shaper download class 20 queue-type fair-queue
set traffic-policy shaper download class 20 match http ip source port 80
set traffic-policy shaper download class 20 match https ip source port 443
# garbage bittorrent
set traffic-policy shaper download class 30 bandwidth 10%
set traffic-policy shaper download class 30 ceiling 100%
set traffic-policy shaper download class 30 priority 1
set traffic-policy shaper download class 30 queue-type fair-queue
# FIXME: no port ranges in QOS rules.
# instead, mark packets in a firewall rule and match on that
#set traffic-policy shaper download class 30 match bittorrent ip source port 6881-6889
set traffic-policy shaper download class 30 match transmission ip source port 51413
set interfaces ethernet eth0 traffic-policy out download
# upload is typically 5.5-ish. should be clamped at less than 100%
# of advertised bandwidth to avoid buffer bloat and lag
set traffic-policy shaper upload
set traffic-policy shaper upload bandwidth 5Mbit
# high priority, interactive, ssh, dns, icmp
set traffic-policy shaper upload class 2 bandwidth 10%
set traffic-policy shaper upload class 2 ceiling 100%
set traffic-policy shaper upload class 2 priority 5
set traffic-policy shaper upload class 2 queue-type fair-queue
set traffic-policy shaper upload class 2 queue-limit 16
set traffic-policy shaper upload class 2 match icmp ip protocol icmp
set traffic-policy shaper upload class 2 match ssh ip destination port 22
set traffic-policy shaper upload class 2 match dns ip destination port 53
# high priority but not quite so much, http, https
set traffic-policy shaper upload class 5 bandwidth 10%
set traffic-policy shaper upload class 5 ceiling 100%
set traffic-policy shaper upload class 5 priority 4
set traffic-policy shaper upload class 5 queue-type fair-queue
set traffic-policy shaper upload class 5 match http ip destination port 80
set traffic-policy shaper upload class 5 match https ip destination port 443
# everything else is middle-of-the-road priority
set traffic-policy shaper upload default bandwidth 60%
set traffic-policy shaper upload default ceiling 100%
set traffic-policy shaper upload default priority 3
set traffic-policy shaper upload default queue-type fair-queue
# crashplan traffic only, set DSCP to 32 in crashplan, matches 8 here (?)
set traffic-policy shaper upload class 10 bandwidth 10%
set traffic-policy shaper upload class 10 ceiling 100%
set traffic-policy shaper upload class 10 priority 2
set traffic-policy shaper upload class 10 queue-type fair-queue
set traffic-policy shaper upload class 10 match crashplan ip dscp 8
# bulk, bittorrent from transmission client on default port
set traffic-policy shaper upload class 20 bandwidth 10%
set traffic-policy shaper upload class 20 ceiling 100%
set traffic-policy shaper upload class 20 priority 1
set traffic-policy shaper upload class 20 queue-type fair-queue
set traffic-policy shaper upload class 20 match bittorrent ip source port 51413
set interfaces ethernet eth0 traffic-policy out upload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment