{"id":18033491,"url":"https://github.com/tohojo/sqm-scripts","last_synced_at":"2025-05-16T11:06:20.870Z","repository":{"id":33025942,"uuid":"36661217","full_name":"tohojo/sqm-scripts","owner":"tohojo","description":"SQM scripts traffic shaper","archived":false,"fork":false,"pushed_at":"2025-01-27T11:21:22.000Z","size":483,"stargazers_count":240,"open_issues_count":25,"forks_count":64,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-04-09T07:02:29.281Z","etag":null,"topics":["openwrt","router","sqm","traffic-shaping"],"latest_commit_sha":null,"homepage":"http://www.bufferbloat.net/projects/cerowrt/wiki/Smart_Queue_Management","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tohojo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-01T13:05:44.000Z","updated_at":"2025-04-02T08:34:20.000Z","dependencies_parsed_at":"2024-06-03T09:06:42.758Z","dependency_job_id":"1cdfcd9a-8596-4395-addf-1b9a06ed2926","html_url":"https://github.com/tohojo/sqm-scripts","commit_stats":{"total_commits":289,"total_committers":17,"mean_commits":17.0,"dds":0.5086505190311419,"last_synced_commit":"75dee1468721b3831b5437f83c8d73bc86520330"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tohojo%2Fsqm-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tohojo%2Fsqm-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tohojo%2Fsqm-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tohojo%2Fsqm-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tohojo","download_url":"https://codeload.github.com/tohojo/sqm-scripts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openwrt","router","sqm","traffic-shaping"],"created_at":"2024-10-30T11:07:29.474Z","updated_at":"2025-05-16T11:06:15.861Z","avatar_url":"https://github.com/tohojo.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The sqm-scripts traffic shaper\n\n[![DOI](https://zenodo.org/badge/36661217.svg)](https://zenodo.org/badge/latestdoi/36661217)\n\nThis repository contains the sqm-scripts traffic shaper from the CeroWrt\nproject. See:\nhttp://www.bufferbloat.net/projects/cerowrt/wiki/Smart_Queue_Management\n\n## How does sqm-scripts set up traffic shaping?\n\nsqm-scripts uses the Linux qdisc mechanism to configure traffic shaping and\nscheduling. Either by a combination of the HTB qdisc (for shaping) and fq_codel\n(for packet scheduling), or using the CAKE integrated scheduler to do both at\nonce.\n\nBecause qdiscs only see traffic as it is *leaving* an interface, for ingress\nshaping sqm-scripts sets up an IFB device. Incoming packets are redirected to\nthis device where a regular qdisc can handle them. The IFB device is named for\nthe egress interface it is paired with, so the IFB for 'eth0' will be called\n'ifb4eth0'.\n\nThis is all illustrated on the following diagram:\n\n![qdisc diagram](qdisc-diagram.png)\nDiagram contributed by Matt Taggart (@taggart). Source in [qdisc-diagram.dia](qdisc-diagram.dia).\n\n## Requirements\n\nTo run sqm-scripts you just need a Linux machine with a kernel from the last\ndecade or so (any of the longterm releases on kernel.org should work - please\ndon't run a kernel that is not a currently released version, longterm or\ncurrent). The only exception is that if you want to use the `cake` qdisc, you\neither need kernel 4.19 or newer (with matching `iproute2` version), or you need\nto build CAKE yourself from the out-of-tree repository at\nhttps://github.com/dtaht/sch_cake.\n\n## Installing\n`sudo make install` should install things on a regular Linux box. For\nOpenWrt, there are packages available in the distribution, so just install the\nsqm-scripts package, and optionally luci-app-sqm for GUI support.\n\n## Running on regular Linux distributions\nAfter installing using `make install`, do the following to enable sqm-scripts:\n\n1. Copy `/etc/sqm/default.conf` to `/etc/sqm/\u003cdev\u003e.iface.conf` where `\u003cdev\u003e` is\n   the name of the interface you wish to run sqm-scripts on. Then adjust the\n   values in the file to your environment, setting at least UPLINK, DOWNLINK,\n   and possibly SCRIPT.\n\n2. If you're on a Debian-derived distribution that uses old-style network config\n   in `/etc/network/`, the Makefile should detect this and drop in appropriate\n   hotplug scripts, so sqm-script should automatically run on the next 'ifup'.\n\n3. If you're on a systemd-enabled distro, just enable the `sqm@\u003cdev\u003e` service\n   corresponding to your interface name. E.g., for `eth0`, issue `systemctl\n   enable sqm@eth0` (and run `systemctl start sqm@eth0` to start sqm-scripts\n   immediately).\n\n## \"Installing\" the current development version from git on OpenWrt\n\nRun the steps below on your own computer (not on the router) to retrieve the newest script version from this repository, create the scripts, then copy those new scripts to your router.\n\n1. Make a local clone of the git repository (if you have not already):\n\n    `git clone https://github.com/tohojo/sqm-scripts`\n\n2. Change into the new directory:\n\n    `cd ./sqm-scripts`\n\n3. Make sure the source is updated:\n\n    `git pull`\n\n4. Create the scripts for your platform (PLATFORM is either linux or openwrt) and output them to a local `current_sqm_base` directory:\n\n    `make install PLATFORM=openwrt DESTDIR=./current_sqm_base`\n\n5. Change to `./current_sqm_base`:\n\n    `cd ./current_sqm_base`\n\n6. Optional for OpenWrt: The final step will overwrite your router's current sqm configuration file (at `/etc/config/sqm`). If you want to preserve the current configuration, delete the newly created config file from the local `etc/config`:\n\n    `rm -r etc/config`\n\n7. Now, use scp to copy the new scripts to the router. Change `$YOUR.SQM.HOSTNAME` to the address/DNS name for your computer - probably `192.168.1.1` or on cerowrt `gw.hom.lan`. If your account on the router is not \"root\", change \"root\" to your account:\n\n\n    `scp -r ./* root@$YOUR.SQM.HOSTNAME:/`\n\nNote this method relies on the presence of the required qdiscs on the router/destination host. On openwrt, you should first install the \"normal\" sqm-scripts package to take care of all the dependencies, then use this procedure to update to the newest sqm-scripts.\n\n## Run-time debugging\n\nSQM_VERBOSITY_MAX controls the verbosity of sqm's output to the shell and syslog (0: no logging; 8: full debug output).\nSQM_DEBUG controls whether sqm will log the output of the last invocation of start-sqm into  `var/run/sqm/${interface_name}.start-sqm.log` and the ouput of the last invocation of stop-sqm into `var/run/sqm/${interface_name}.stop-sqm.log` e.g. for pppoe-wan `/var/run/sqm/pppoe-wan.start-sqm.log` and `/var/run/sqm/pppoe-wan.stop-sqm.log`.\n\n#### Examples\n\n- Log only the binary invocations and their output:\n\n    `/etc/init.d/sqm stop ; SQM_DEBUG=1 SQM_VERBOSITY_MAX=0 /etc/init.d/sqm start`\n\n- Log verbose debug output and all the binary invocations and their output:\n\n    `/etc/init.d/sqm stop ; SQM_DEBUG=1 SQM_VERBOSITY_MAX=8 /etc/init.d/sqm start`\n\n- Log both start and stop:\n\n    `SQM_DEBUG=1 SQM_VERBOSITY_MAX=8 /etc/init.d/sqm stop ; SQM_DEBUG=1 SQM_VERBOSITY_MAX=8 /etc/init.d/sqm start`\n\nNote: Both the start and stop log are re-written on every sqm instance start and stop and are logging all output independent of the value of `SQM_VERBOSITY_MAX`. They will not grow indefintely, but they are written repeatedly. On reliably rewritable media like hard disk, ssd, flash with wear-leveling, or ram-disk, `SQM_DEBUG` can be safely set to 1 in `defaults.sh`, but on media like NOR flash that do only allow few write-cycles, keeping the default at 0 and using the above invocations to run a single instance with `SQM_DEBUG=1` is recommended.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftohojo%2Fsqm-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftohojo%2Fsqm-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftohojo%2Fsqm-scripts/lists"}