Help me update my HFSC shaper scripts for fw4/nftables

hi hudra

I tried to run CT info on the script with Élan, but it's more complicated than it seems. Have you had a chance to look into it, or did you also have trouble?

@Hudra - does the install.sh script, installl the /etc/init.d/SimpleHFSCgamerscript?

ive done it a few times, and doesnt seem to be in startup?

also the install.sh on your github doesnt download your updated script.

wget -O /etc/SimpleHFSCgamerscript.sh https://raw.githubusercontent.com/dlakelan/routerperf/master/SimpleHFSCgamerscript.sh && chmod a+x /etc/SimpleHFSCgamerscript.sh

Actually, you don’t need the install script anymore. All functions of the install script are handled by the init script. At least when using the version of the script on my GitHub.

This is how you set it up:

I’m in the process of writing an updated readme. I hope this helps setting up and understanding the script.

2 Likes

Thats great thank you :+1:

1 Like

No, unfortunately I haven't found the time yet...

1 Like

Hey for your cake QOS script it works a lot better for my network but I have an issue with firewall tracking my ipv6 address. Every time I input them exactly how they look from the routing table. The firewall shows 0bytes for the ip6 addresses. Do I have to put ipv6: before inputting the address of a device?

Likely your IPv6 devices use IPv6 privacy extensions and change addresses every few minutes, so by the time you put an address into a firewall rule the device in question might not actually be using that...

Does new script not create veth?
cleaned installed 23.05.3
Used your init.d to install script
Internet seem to work fine.

  new_flows_len 0 old_flows_len 0
qdisc mq 0: dev eth1 root
 Sent 21015558608 bytes 16125431 pkt (dropped 0, overlimits 0 requeues 4219)
 backlog 0b 0p requeues 4219
qdisc fq_codel 0: dev eth1 parent :4 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 4556579875 bytes 3699161 pkt (dropped 0, overlimits 0 requeues 117)
 backlog 0b 0p requeues 117
  maxpacket 1506 drop_overlimit 0 new_flow_count 144 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :3 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 3568988191 bytes 2838392 pkt (dropped 0, overlimits 0 requeues 589)
 backlog 0b 0p requeues 589
  maxpacket 1506 drop_overlimit 0 new_flow_count 497 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :2 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 3062459237 bytes 2507883 pkt (dropped 0, overlimits 0 requeues 2873)
 backlog 0b 0p requeues 2873
  maxpacket 1506 drop_overlimit 0 new_flow_count 2108 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :1 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 9827531305 bytes 7079995 pkt (dropped 0, overlimits 0 requeues 640)
 backlog 0b 0p requeues 640
  maxpacket 1506 drop_overlimit 0 new_flow_count 563 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc mq 0: dev eth2 root
 Sent 15369569052 bytes 11449585 pkt (dropped 0, overlimits 0 requeues 1300)
 backlog 0b 0p requeues 1300
qdisc fq_codel 0: dev eth2 parent :4 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 4804852521 bytes 3452852 pkt (dropped 0, overlimits 0 requeues 379)
 backlog 0b 0p requeues 379
  maxpacket 1506 drop_overlimit 0 new_flow_count 1128 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth2 parent :3 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 2066899199 bytes 1676618 pkt (dropped 0, overlimits 0 requeues 109)
 backlog 0b 0p requeues 109
  maxpacket 1506 drop_overlimit 0 new_flow_count 119 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth2 parent :2 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 4322707822 bytes 3345665 pkt (dropped 0, overlimits 0 requeues 130)
 backlog 0b 0p requeues 130
  maxpacket 1506 drop_overlimit 0 new_flow_count 292 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth2 parent :1 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 4175109510 bytes 2974450 pkt (dropped 0, overlimits 0 requeues 682)
 backlog 0b 0p requeues 682
  maxpacket 1506 drop_overlimit 0 new_flow_count 2953 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc mq 0: dev eth3 root
 Sent 5726030 bytes 14085 pkt (dropped 0, overlimits 0 requeues 7)
 backlog 0b 0p requeues 7
qdisc fq_codel 0: dev eth3 parent :4 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 424250 bytes 1732 pkt (dropped 0, overlimits 0 requeues 1)
 backlog 0b 0p requeues 1
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth3 parent :3 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 2449771 bytes 4535 pkt (dropped 0, overlimits 0 requeues 3)
 backlog 0b 0p requeues 3
  maxpacket 1506 drop_overlimit 0 new_flow_count 1 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth3 parent :2 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 905579 bytes 2349 pkt (dropped 0, overlimits 0 requeues 1)
 backlog 0b 0p requeues 1
  maxpacket 1506 drop_overlimit 0 new_flow_count 1 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth3 parent :1 limit 10240p flows 1024 quantum 1514 target        5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 1946430 bytes 5469 pkt (dropped 0, overlimits 0 requeues 2)
 backlog 0b 0p requeues 2
  maxpacket 1506 drop_overlimit 0 new_flow_count 3 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth4 root refcnt 2 limit 10240p flows 1024 quantum 1514 ta       rget 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 2710156459 bytes 10217307 pkt (dropped 0, overlimits 0 requeues 50)
 backlog 0b 0p requeues 50
  maxpacket 1514 drop_overlimit 0 new_flow_count 28 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev br-lan root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc hfsc 1: dev ifb-pppoe-wan root refcnt 2 default 13
 Sent 12557143320 bytes 8815364 pkt (dropped 196, overlimits 10870788 requeues 0       )
 backlog 0b 0p requeues 0
qdisc fq_codel 801c: dev ifb-pppoe-wan parent 1:15 limit 10240p flows 1024 quant       um 3000 target 4ms interval 100ms memory_limit 22500000b ecn drop_batch 64
 Sent 5379450677 bytes 3560016 pkt (dropped 1, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 2 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc fq_codel 801a: dev ifb-pppoe-wan parent 1:13 limit 10240p flows 1024 quant       um 3000 target 4ms interval 100ms memory_limit 22500000b ecn drop_batch 64
 Sent 4655360397 bytes 3441804 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 42066 ecn_mark 0
  new_flows_len 1 old_flows_len 4
qdisc pfifo 10: dev ifb-pppoe-wan parent 1:11 limit 6255p
 Sent 34612902 bytes 43401 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 8019: dev ifb-pppoe-wan parent 1:12 limit 10240p flows 1024 quant       um 3000 target 4ms interval 100ms memory_limit 22500000b ecn drop_batch 64
 Sent 1022912349 bytes 765288 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 41094 ecn_mark 0
  new_flows_len 1 old_flows_len 1
qdisc fq_codel 801b: dev ifb-pppoe-wan parent 1:14 limit 10240p flows 1024 quant       um 3000 target 4ms interval 100ms memory_limit 22500000b ecn drop_batch 64
 Sent 1464718353 bytes 1004795 pkt (dropped 195, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 14945 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc hfsc 1: dev pppoe-wan root refcnt 2 default 13
 Sent 357864311 bytes 1776758 pkt (dropped 88, overlimits 371475 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 8016: dev pppoe-wan parent 1:13 limit 10240p flows 1024 quantum 3       000 target 4ms interval 100ms memory_limit 2000000b ecn drop_batch 64
 Sent 73541224 bytes 416669 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1418 drop_overlimit 0 new_flow_count 36061 ecn_mark 0
  new_flows_len 1 old_flows_len 4
qdisc fq_codel 8018: dev pppoe-wan parent 1:15 limit 10240p flows 1024 quantum 3       000 target 4ms interval 100ms memory_limit 2000000b ecn drop_batch 64
 Sent 42626432 bytes 450632 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 578 drop_overlimit 0 new_flow_count 2 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc pfifo 10: dev pppoe-wan parent 1:11 limit 560p
 Sent 32878587 bytes 139836 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 8015: dev pppoe-wan parent 1:12 limit 10240p flows 1024 quantum 3       000 target 4ms interval 100ms memory_limit 2000000b ecn drop_batch 64
 Sent 94482203 bytes 431100 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 29120 drop_overlimit 0 new_flow_count 43573 ecn_mark 0
  new_flows_len 0 old_flows_len 3
qdisc fq_codel 8017: dev pppoe-wan parent 1:14 limit 10240p flows 1024 quantum 3       000 target 4ms interval 100ms memory_limit 2000000b ecn drop_batch 64
 Sent 114334990 bytes 338517 pkt (dropped 88, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 34928 drop_overlimit 0 new_flow_count 61743 ecn_mark 0
  new_flows_len 1 old_flows_len 2
qdisc ingress ffff: dev pppoe-wan parent ffff:fff1 ----------------
 Sent 12204827596 bytes 8815575 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
root@OpenWrt:~#

this working correctly?

Zia

You can still use veth, but it's no longer necessary. Veth works well for simple network topologies, but it's not ideal for multiple networks with different firewall zones.

The new approach uses ctinfo, which is now the default in my repository:

DOWNSHAPING_METHOD="ctinfo" # Options: "veth", "ctinfo", "lan"

If you still want to use veth, simply type:

DOWNSHAPING_METHOD="veth"

You'll find more information on how it works in the post where I announced the feature.

I'm in the process of writing a manual to help you all better understand what the script does and how to use it. I'm also experimenting with other qdisc options like bfifo and different root qdiscs like cake (even though the script is called SimpleHFSCgamerscript). Additionally, I'm working on enhancements to preserve the script files after a firmware update, so you won't have to set everything up again after upgrading your router.

Seems like it's working.

2 Likes

Hello Hudra. I already appreciate your great work and time developing and improving the script more and more. I'm a newbie to these things, but I've been reading network configuration forums for years to optimize my network and so far your script is working. I'm from Argentina, I wanted to ask you about a detail I have. My 700 mb symmetrical fiber ISP. When configuring the interface.

General settings

##############################

"atm" for old-school DSL, "DOCSIS" for cable modem, or "other" for anything else

LINKTYPE="ethernet"
WAN=wan-poe # Change this to your WAN device name
LAN=br-lan # Change to your LAN device if you don't use veth/bridge, leave it alone if you use veth
DOWNRATE=560000 # Change this to about 80% of your download speed (in kbps)
UPRATE=700000 # Change this to your kbps upload speed
OH=44 # Number of bytes of Overhead on your line

##############################

I don't know why when I perform a speed test, it gives me about 320 mb of download and perfect upload at 700. (knowing that it would have to give me 560 mb of download)

My router is a Linksys WRT x32.
From already thank you very much!

1 Like
  1. Please ensure to format code snippets as preformatted text to maintain readability.
  2. Is your WAN interface really "wan-poe" or did you mean "pppoe-wan"?
  3. If you have a 700 Mbps symmetrical connection, I recommend setting your upload/download limits to about 80%-90% of that speed.
  4. Which DOWNSHAPING_METHOD are you using?
  5. Could you provide the output of tc -s qdisc?
 -----------------------------------------------------
 OpenWrt 23.05.3, r23809-234f1a2efa
 -----------------------------------------------------
root@OpenWrt:~# /etc/init.d/SimpleHFSCgamerscript status
==== Traffic Control (tc) Queues ====
qdisc noqueue 0: dev lo root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc mq 0: dev eth0 root
 Sent 940697210 bytes 4135898 pkt (dropped 0, overlimits 0 requeues 100)
 backlog 0b 0p requeues 100
qdisc fq_codel 0: dev eth0 parent :8 limit 10240p flows 1024 quantum 1522 target              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :7 limit 10240p flows 1024 quantum 1522 target              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :6 limit 10240p flows 1024 quantum 1522 target              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :5 limit 10240p flows 1024 quantum 1522 target              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :4 limit 10240p flows 1024 quantum 1522 target              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :3 limit 10240p flows 1024 quantum 1522 target              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :2 limit 10240p flows 1024 quantum 1522 target              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :1 limit 10240p flows 1024 quantum 1522 target              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 940697210 bytes 4135898 pkt (dropped 0, overlimits 0 requeues 100)
 backlog 0b 0p requeues 100
  maxpacket 1522 drop_overlimit 0 new_flow_count 77 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev lan4 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev lan3 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev lan2 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev lan1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev wan root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev br-lan root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc hfsc 1: dev ifb-pppoe-wan root refcnt 2 default 13
 Sent 10314708673 bytes 8000084 pkt (dropped 0, overlimits 6852048 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 801e: dev ifb-pppoe-wan parent 1:13 limit 10240p flows 1024 quant             um 3000 target 4ms interval 100ms memory_limit 14000000b ecn drop_batch 64
 Sent 2366180545 bytes 1855777 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 123079 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc fq_codel 8020: dev ifb-pppoe-wan parent 1:15 limit 10240p flows 1024 quant             um 3000 target 4ms interval 100ms memory_limit 14000000b ecn drop_batch 64
 Sent 56495007 bytes 37499 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 1 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc pfifo 10: dev ifb-pppoe-wan parent 1:11 limit 3893p
 Sent 6816990 bytes 17575 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 801d: dev ifb-pppoe-wan parent 1:12 limit 10240p flows 1024 quant             um 3000 target 4ms interval 100ms memory_limit 14000000b ecn drop_batch 64
 Sent 4364098408 bytes 3139421 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 350301 ecn_mark 0
  new_flows_len 0 old_flows_len 7
qdisc fq_codel 801f: dev ifb-pppoe-wan parent 1:14 limit 10240p flows 1024 quant             um 3000 target 4ms interval 100ms memory_limit 14000000b ecn drop_batch 64
 Sent 3521116671 bytes 2949808 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 142365 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc noqueue 0: dev phy1-ap0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev phy0-ap0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc mq 0: dev phy2-ap0 root
 Sent 2973416 bytes 26105 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev phy2-ap0 parent :4 limit 10240p flows 1024 quantum 1514 ta             rget 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 19070 bytes 349 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev phy2-ap0 parent :3 limit 10240p flows 1024 quantum 1514 ta             rget 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 38173 bytes 247 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev phy2-ap0 parent :2 limit 10240p flows 1024 quantum 1514 ta             rget 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 2916173 bytes 25509 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 86 drop_overlimit 0 new_flow_count 3 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev phy2-ap0 parent :1 limit 10240p flows 1024 quantum 1514 ta             rget 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc hfsc 1: dev pppoe-wan root refcnt 2 default 13
 Sent 670400796 bytes 3883543 pkt (dropped 2, overlimits 818 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 801c: dev pppoe-wan parent 1:15 limit 10240p flows 1024 quantum 3             000 target 4ms interval 100ms memory_limit 17500000b ecn drop_batch 64
 Sent 375108 bytes 3545 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 120 drop_overlimit 0 new_flow_count 1 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc fq_codel 801a: dev pppoe-wan parent 1:13 limit 10240p flows 1024 quantum 3             000 target 4ms interval 100ms memory_limit 17500000b ecn drop_batch 64
 Sent 138714004 bytes 696241 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 13763 drop_overlimit 0 new_flow_count 100087 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc pfifo 10: dev pppoe-wan parent 1:11 limit 4866p
 Sent 8101079 bytes 37880 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 8019: dev pppoe-wan parent 1:12 limit 10240p flows 1024 quantum 3             000 target 4ms interval 100ms memory_limit 17500000b ecn drop_batch 64
 Sent 303551363 bytes 2037310 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 13148 drop_overlimit 0 new_flow_count 283063 ecn_mark 0
  new_flows_len 1 old_flows_len 7
qdisc fq_codel 801b: dev pppoe-wan parent 1:14 limit 10240p flows 1024 quantum 3             000 target 4ms interval 100ms memory_limit 17500000b ecn drop_batch 64
 Sent 219658565 bytes 1108561 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1532 drop_overlimit 0 new_flow_count 82317 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc ingress ffff: dev pppoe-wan parent ffff:fff1 ----------------
 Sent 9996200135 bytes 8001627 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0

==== Nftables Ruleset: dscptag ====
        chain dscptag {
                type filter hook forward priority filter; policy accept;
                ip dscp set cs0 counter packets 10140450 bytes 9028358744
                ip6 dscp set cs0 counter packets 1640724 bytes 1469815571
                ip protocol tcp tcp flags & ack == ack meta length < 100 add @xf             st4ack { ip daddr . ip saddr . tcp dport . tcp sport limit rate over 3500000/sec             ond } counter packets 0 bytes 0 jump drop995
                ip protocol tcp tcp flags & ack == ack meta length < 100 add @fa             st4ack { ip daddr . ip saddr . tcp dport . tcp sport limit rate over 350000/seco             nd } counter packets 0 bytes 0 jump drop95
                ip protocol tcp tcp flags & ack == ack meta length < 100 add @me             d4ack { ip daddr . ip saddr . tcp dport . tcp sport limit rate over 35000/second              } counter packets 12035 bytes 789840 jump drop50
                ip protocol tcp tcp flags & ack == ack meta length < 100 add @sl             ow4ack { ip daddr . ip saddr . tcp dport . tcp sport limit rate over 35000/secon             d } counter packets 6064 bytes 398040 jump drop50
                ip protocol udp ip daddr 192.168.0.207 ip dscp set cs5 counter p             ackets 63197 bytes 62445935
                ip protocol udp ip saddr 192.168.0.207 ip dscp set cs5 counter p             ackets 43246 bytes 7285761
                ip protocol udp ip daddr { 192.168.0.200, 192.168.0.201, 192.168             .0.203, 192.168.0.204, 192.168.0.205, 192.168.0.206, 192.168.0.208, 192.168.0.20             9 } ip dscp set cs2 counter packets 1994677 bytes 2027188756
                ip protocol udp ip saddr { 192.168.0.200, 192.168.0.201, 192.168             .0.203, 192.168.0.204, 192.168.0.205, 192.168.0.206, 192.168.0.208, 192.168.0.20             9 } ip dscp set cs2 counter packets 685225 bytes 144433444
                ip protocol udp ip dscp > cs2 add @udp_meter4 { ip saddr . ip da             ddr . udp sport . udp dport limit rate over 450/second } counter packets 50095 b             ytes 57150227 ip dscp set cs2 counter packets 50095 bytes 57150227
                ip6 nexthdr udp ip6 dscp > cs2 add @udp_meter6 { ip6 saddr . ip6              daddr . udp sport . udp dport limit rate over 450/second } counter packets 0 by             tes 0 ip6 dscp set cs2 counter packets 0 bytes 0
                ip protocol udp ip dscp > cs2 add @udp_meter4 { ip saddr . ip da             ddr . udp sport . udp dport limit rate over 450/second } counter packets 2326 by             tes 1565547 ip dscp set cs2 counter packets 2326 bytes 1565547
                ip6 nexthdr udp ip6 dscp > cs2 add @udp_meter6 { ip6 saddr . ip6              daddr . udp sport . udp dport limit rate over 450/second } counter packets 0 by             tes 0 ip6 dscp set cs2 counter packets 0 bytes 0
                ip protocol tcp ct bytes < 35000000 ip dscp < cs4 ip dscp set cs             2 counter packets 4828626 bytes 4177424025
                ip protocol tcp ct bytes > 700000000 ip dscp < cs4 ip dscp set c             s1 counter packets 184317 bytes 199360708
                ip protocol tcp add @slowtcp4 { ip saddr . ip daddr . tcp sport              . tcp dport limit rate 150/second burst 150 packets } ip dscp set cs4 counter pa             ckets 4976757 bytes 4166995382
                ip6 nexthdr tcp add @slowtcp6 { ip6 saddr . ip6 daddr . tcp spor             t . tcp dport limit rate 150/second burst 150 packets } ip6 dscp set cs4 counter              packets 365396 bytes 184249964
                ip saddr 192.168.0.207 udp sport 37000-40000 udp dport 37000-655             35 ip dscp set cs5 counter packets 0 bytes 0
                ip saddr 192.168.0.207 udp dport 37000-40000 ip dscp set cs5 cou             nter packets 36165 bytes 6118271
                meta priority set ip dscp map @priomap counter packets 10131416              bytes 9027765748
                meta priority set ip6 dscp map @priomap counter packets 1640724              bytes 1469815571
                meta nfproto ipv4 ct mark set @nh,8,8 & 0xfc [invalid type] | 0x             80 counter packets 10131416 bytes 9027765748
                meta nfproto ipv6 ct mark set @nh,0,16 & 0xfc0 [invalid type] |              0x80 counter packets 1640724 bytes 1469815571
                oifname "pppoe-wan" ip dscp set cs0
                oifname "pppoe-wan" ip6 dscp set cs0
        }
}
root@OpenWrt:~#

1 Like
#!/bin/sh

##############################
# General settings
##############################

# "atm" for old-school DSL, "DOCSIS" for cable modem, or "other" for anything else
LINKTYPE="ethernet" 
WAN=pppoe-wan # Change this to your WAN device name
LAN=br-lan # Change to your LAN device if you don't use veth/bridge, leave it alone if you use veth
DOWNRATE=560000 # Change this to about 80% of your download speed (in kbps)
UPRATE=700000 # Change this to your kbps upload speed
OH=44 # Number of bytes of Overhead on your line

##############################
# Downstream shaping method
##############################
DOWNSHAPING_METHOD="ctinfo" # Options: "veth", "ctinfo", "lan"

DOWNRATE=560000
UPRATE=700000

With 80% download and upload
DOWN RATE=560000
UPDATE=560000

How do:

  1. tc -s qdisc
  2. cat /proc/interrupts
  3. cat /proc/softirq

and do you have packet steering enabled? What kind of router are you using?

2 Likes

Seems like the script is up and running now.

He said:

Maybe the WRT32X AC3200 is reaching its limits in terms of CPU performance with qos enabled.

In addition to what @moeller0 said you can install htop:

opkg update
opkg install htop

to monitor CPU Load run:

htop

Then run an online Speed Test and look at the CPU Load....

1 Like

is the issue something to do with ack filter settings?

@NeMe_FuUuRyyyyY try these

# Set the ACK rate to 5% of the upload bandwidth. This allocation helps ensure that ACK packets,
# which are essential for maintaining smooth TCP connections, do not overwhelm the network.
# By limiting ACK traffic to a small percentage of the total bandwidth, we prevent these packets
# from interfering with higher priority gaming traffic, thus reducing latency and improving
# overall network performance during gaming sessions.
ACKRATE="$(($UPRATE * 5 / 100))" # auto moode - or set manual
#ACKRATE="600"  ## 300-600 ist a good starting point - or leave blank to disable
# Function to calculate different ACK rates based on the existing ACKRATE variable
calculate_ack_rates() {
    SLOWACKRATE=$ACKRATE # Direkte Verwendung von ACKRATE für slow4ack und med4ack
    #MEDACKRATE=$ACKRATE
    FASTACKRATE=$(($ACKRATE * 10))
    XFSTACKRATE=$(($ACKRATE * 100))
}
# Check if ACKRATE is greater than 0
if [ "$ACKRATE" -gt 0 ]; then
    ack_rules="\
ip protocol tcp tcp flags & ack == ack meta length < 100 add @xfst4ack {ip daddr . ip saddr . tcp dport . tcp sport limit rate over ${XFSTACKRATE}/second} counter jump drop995
        ip protocol tcp tcp flags & ack == ack meta length < 100 add @fast4ack {ip daddr . ip saddr . tcp dport . tcp sport limit rate over ${FASTACKRATE}/second} counter jump drop95
        #ip protocol tcp tcp flags & ack == ack meta length < 100 add @med4ack {ip daddr . ip saddr . tcp dport . tcp sport limit rate over ${MEDACKRATE}/second} counter jump drop50
        ip protocol tcp tcp flags & ack == ack meta length < 100 add @slow4ack {ip daddr . ip saddr . tcp dport . tcp sport limit rate over ${SLOWACKRATE}/second} counter jump drop50"
else
    ack_rules="# ACK rate regulation disabled as ACKRATE=0 or not set."
fi

i think @dlakelan picked up on these settings somewhere in this thread, and suggested alternatives for higher symmetrical speeds.

2 Likes

@Hudra - Cake QOS uses the below, would this approach or a variant of this be benefical?

## ACK-FILTER parameters (AUTO)
# Automatically use the "ack-filter" parameter if your up/down bandwidth is at least 1x15 asymmetric
FORMULA="$(awk "BEGIN { a = $BANDWIDTH_DOWN; b = $BANDWIDTH_UP * 14; print (a > b) }")" > /dev/null 2>&1
if [  "$FORMULA" -eq 1 ]; then
    case $ACK_FILTER_EGRESS in
        yes) ACK_FILTER_EGRESS="yes" ;;
        no) ACK_FILTER_EGRESS="no" ;;
        *) ACK_FILTER_EGRESS="yes" ;;
    esac
fi

You should be able to disable ACK limiting if you don't need it by:

ACKRATE=""

Or by commenting it out:

#ACKRATE="$(($UPRATE * 5 / 100))" # auto mode - or set manually

However, I discovered a bug that prevented it from being disabled. Pushed a fix to my github repo...

Generally speaking, I have been overestimating the ACKRATE by using 5% of the total upload bandwidth.

Look at this post from @moeller0:

1/40 is 2,5 %, so my guess was that with a high upload bandwidth, not much traffic would land in the ACK limiting rules.

I don't know. I guess first we would need to determine if there is an issue with the current settings.

1 Like

So cake's ack-filter is considerably more selective than rate limiting ACKs. It merges ACKs to thin out the ACK stream without removing information (it does remove redundancy). With cake as leaf qdisc I would use cake's ack-filter, if ACK thinning is desired at all.

2 Likes