Skip to content

Instantly share code, notes, and snippets.

@Dianoga
Forked from beardicus/edgerouter-qos
Last active June 25, 2023 15:23
Show Gist options
  • Save Dianoga/e0edbd9e7532191933d0 to your computer and use it in GitHub Desktop.
Save Dianoga/e0edbd9e7532191933d0 to your computer and use it in GitHub Desktop.
#
# fair-queue based settings for EdgeRouter Lite traffic shaping
#
# download is typically 30 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 60Mbit
# set default download priority
set traffic-policy shaper download default bandwidth 70%
set traffic-policy shaper download default ceiling 100%
set traffic-policy shaper download default priority 4
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 0
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
# Hangouts and other VOIP stuff
set traffic-policy shaper download class 15 bandwidth 20%
set traffic-policy shaper download class 15 ceiling 100%
set traffic-policy shaper download class 15 priority 1
set traffic-policy shaper download class 15 queue-type fair-queue
set traffic-policy shaper download class 15 match udp1 ip protocol udp
set traffic-policy shaper download class 15 match udp1 ip destination port 19302
set traffic-policy shaper download class 15 match udp2 ip protocol udp
set traffic-policy shaper download class 15 match udp2 ip destination port 19303
set traffic-policy shaper download class 15 match udp3 ip protocol udp
set traffic-policy shaper download class 15 match udp3 ip destination port 19304
set traffic-policy shaper download class 15 match udp4 ip protocol udp
set traffic-policy shaper download class 15 match udp4 ip destination port 19305
set traffic-policy shaper download class 15 match udp5 ip protocol udp
set traffic-policy shaper download class 15 match udp5 ip destination port 19306
set traffic-policy shaper download class 15 match udp6 ip protocol udp
set traffic-policy shaper download class 15 match udp6 ip destination port 19307
set traffic-policy shaper download class 15 match udp7 ip protocol udp
set traffic-policy shaper download class 15 match udp7 ip destination port 19308
set traffic-policy shaper download class 15 match udp8 ip protocol udp
set traffic-policy shaper download class 15 match udp8 ip destination port 19309
# semipriority http and https
set traffic-policy shaper download class 20 bandwidth 80%
set traffic-policy shaper download class 20 ceiling 100%
set traffic-policy shaper download class 20 priority 2
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 6
set traffic-policy shaper download class 30 queue-type fair-queue
set traffic-policy shaper download class 30 match transmission ip source port 51413
set interfaces bridge br0 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 12Mbit
# default upload priority
set traffic-policy shaper upload default bandwidth 60%
set traffic-policy shaper upload default ceiling 100%
set traffic-policy shaper upload default priority 4
set traffic-policy shaper upload default queue-type fair-queue
# highest 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 0
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
# Hangouts and other VOIP stuff
set traffic-policy shaper upload class 15 bandwidth 20%
set traffic-policy shaper upload class 15 ceiling 100%
set traffic-policy shaper upload class 15 priority 1
set traffic-policy shaper upload class 15 queue-type fair-queue
set traffic-policy shaper upload class 15 match udp1 ip protocol udp
set traffic-policy shaper upload class 15 match udp1 ip destination port 19302
set traffic-policy shaper upload class 15 match udp2 ip protocol udp
set traffic-policy shaper upload class 15 match udp2 ip destination port 19303
set traffic-policy shaper upload class 15 match udp3 ip protocol udp
set traffic-policy shaper upload class 15 match udp3 ip destination port 19304
set traffic-policy shaper upload class 15 match udp4 ip protocol udp
set traffic-policy shaper upload class 15 match udp4 ip destination port 19305
set traffic-policy shaper upload class 15 match udp5 ip protocol udp
set traffic-policy shaper upload class 15 match udp5 ip destination port 19306
set traffic-policy shaper upload class 15 match udp6 ip protocol udp
set traffic-policy shaper upload class 15 match udp6 ip destination port 19307
set traffic-policy shaper upload class 15 match udp7 ip protocol udp
set traffic-policy shaper upload class 15 match udp7 ip destination port 19308
set traffic-policy shaper upload class 15 match udp8 ip protocol udp
set traffic-policy shaper upload class 15 match udp8 ip destination port 19309
# higher priority, plex streaming
set traffic-policy shaper upload class 3 bandwidth 90%
set traffic-policy shaper upload class 3 ceiling 100%
set traffic-policy shaper upload class 3 priority 2
set traffic-policy shaper upload class 3 queue-type fair-queue
set traffic-policy shaper upload class 3 queue-limit 16
set traffic-policy shaper upload class 3 match plex ip destination port 32400
# 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 3
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
# 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 6
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 7
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