Skip to content

Instantly share code, notes, and snippets.

@fhriley
Last active April 16, 2023 05:35
Show Gist options
  • Save fhriley/3a20366bbf087fc15bbb to your computer and use it in GitHub Desktop.
Save fhriley/3a20366bbf087fc15bbb to your computer and use it in GitHub Desktop.
EdgeRouter Lite QOS for upload bandwidth
# new fq-codel style
delete traffic-control
set traffic-control smart-queue wan-qos interface eth1
set traffic-control smart-queue wan-qos rate-up 34mbit
set traffic-control smart-queue wan-qos limit 600
set traffic-control smart-queue wan-qos target 2ms
sudo tc qdisc change dev eth1 parent 1:10 handle 100: fq_codel quantum 300
# old shaper style
# WAN = eth1
# priority: 7 = low, 0 = high
delete interfaces ethernet eth1 traffic-policy
delete traffic-policy
# restrict upload bw to 95% of real bw
set traffic-policy shaper shaper-outbound
set traffic-policy shaper shaper-outbound description "Qos policy for 10mbit upload bandwidth"
set traffic-policy shaper shaper-outbound bandwidth 34000kbit
# default upload priority - above usenet/crashplan, below everything else
set traffic-policy shaper shaper-outbound default bandwidth 38%
set traffic-policy shaper shaper-outbound default ceiling 100%
set traffic-policy shaper shaper-outbound default priority 5
set traffic-policy shaper shaper-outbound default queue-type fair-queue
# highest priority - interactive, ssh, dns, icmp
set traffic-policy shaper shaper-outbound class 20 description "DNS/SSH/ICMP traffic"
set traffic-policy shaper shaper-outbound class 20 bandwidth 10%
set traffic-policy shaper shaper-outbound class 20 ceiling 100%
set traffic-policy shaper shaper-outbound class 20 priority 0
set traffic-policy shaper shaper-outbound class 20 match ICMP ip protocol icmp
set traffic-policy shaper shaper-outbound class 20 match SSH ip destination port 22
set traffic-policy shaper shaper-outbound class 20 match DNS ip destination port 53
#set traffic-policy shaper shaper-outbound class 20 queue-limit 16
# next highest priority - http, https, TOS
set traffic-policy shaper shaper-outbound class 30 description "HTTP/HTTPS/TOS traffic"
set traffic-policy shaper shaper-outbound class 30 bandwidth 40%
set traffic-policy shaper shaper-outbound class 30 ceiling 100%
set traffic-policy shaper shaper-outbound class 30 priority 1
set traffic-policy shaper shaper-outbound class 30 match HTTP ip destination port 80
set traffic-policy shaper shaper-outbound class 30 match HTTPS ip destination port 443
set traffic-policy shaper shaper-outbound class 30 match TOS1 ip destination port 7001
set traffic-policy shaper shaper-outbound class 30 match TOS2 ip destination port 7002
set traffic-policy shaper shaper-outbound class 30 match TOS3 ip destination port 543
# second lowest priority - usenet
set traffic-policy shaper shaper-outbound class 40 description "Usenet traffic"
set traffic-policy shaper shaper-outbound class 40 bandwidth 10%
set traffic-policy shaper shaper-outbound class 40 ceiling 100%
set traffic-policy shaper shaper-outbound class 40 priority 6
set traffic-policy shaper shaper-outbound class 40 match USENET ip destination port 563
# set transmission peer-socket-tos to "reliability"
set traffic-policy shaper shaper-outbound class 15 description "Torrent traffic"
set traffic-policy shaper shaper-outbound class 15 bandwidth 1%
set traffic-policy shaper shaper-outbound class 15 ceiling 100%
set traffic-policy shaper shaper-outbound class 15 priority 6
set traffic-policy shaper shaper-outbound class 15 match TORRENT ip dscp 1
# backup traffic
set traffic-policy shaper shaper-outbound class 9 description "Backup traffic"
set traffic-policy shaper shaper-outbound class 9 bandwidth 1%
set traffic-policy shaper shaper-outbound class 9 ceiling 100%
set traffic-policy shaper shaper-outbound class 9 priority 7
set traffic-policy shaper shaper-outbound class 9 match S3 ip destination address 54.231.160.0/19
set traffic-policy shaper shaper-outbound class 9 match B2_56 ip destination address 162.244.56.0/21
set traffic-policy shaper shaper-outbound class 9 match B2_57 ip destination address 162.244.57.0/24
set traffic-policy shaper shaper-outbound class 9 match B2_58 ip destination address 162.244.58.0/24
set traffic-policy shaper shaper-outbound class 9 match B2_59 ip destination address 162.244.59.0/24
set traffic-policy shaper shaper-outbound class 9 match B2_60 ip destination address 162.244.60.0/24
set traffic-policy shaper shaper-outbound class 9 match B2_61 ip destination address 162.244.61.0/24
set traffic-policy shaper shaper-outbound class 9 match B2_62 ip destination address 162.244.62.0/24
set traffic-policy shaper shaper-outbound class 9 match B2_204 ip destination address 204.11.104.0/30
set traffic-policy shaper shaper-outbound class 9 match B2_206 ip destination address 206.190.208.0/21
set interfaces ethernet eth1 traffic-policy out shaper-outbound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment