Let this script configure wondershaper queues for you automagically!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Steven Saus c68105ce7c GitHub Pages 4 years ago
docs GitHub Pages 4 years ago
.gitignore readying for github pages 4 years ago
60-autobandwidth readying for github pages 4 years ago
LICENSE Initial commit 8 years ago
README.md Additional changes to avoid script being called multiple times for each status change. 4 years ago
autobandwidth.sh Better terminal output for standalone 4 years ago
automatic_wondershaper_wombat-icon.png readying for github pages 4 years ago
wondershaper.sh Adding modded wondershaper script 4 years ago

README.md

automatic_wondershaper_wombat

A script in bash (with some assorted tools) to automagically shape network traffic using a modified version of the wondershaper script (and maintaining your high LAN network speeds).

Contents

  1. About
  2. License
  3. Prerequisites
  4. Installation
  5. Usage

1. About

A script in bash (with some assorted tools) to automagically shape network traffic using a modified version of the wondershaper script (and maintaining your high LAN network speeds). This is a per-machine setup.

It is designed to be run under Network Manager, but can be invoked manually (or from a cron job).

2. License

This project is licensed under the GNU general public license. For the full license, see LICENSE.

3. Prerequisites

These are probably already installed or are easily available from your distro:

Optional:

4. Installation

  • Clone or download the repository; change into the directory.
  • Install wondershaper (see below)
  • Edit your sudoers file and add the following line at the end:

ALL ALL=NOPASSWD:/sbin/wondershaper

  • sudo mkdir /etc/NetworkManager/dispatcher.d (if it doesn't exist)
  • sudo cp ./autobandwidth.sh /etc/NetworkManager/dispatcher.d/90-autobandwidth

Installing wondershaper

#IMPORTANT EDIT: Of course, it's after I write all this up that someone points out to me that I was looking at an abandoned fork of wondershaper. Please utilize this version of wondershaper, and redownload my script, as the command line switches have changed, and I corrected for that. Still put it in /sbin, though, please.

The wondershaper script is rather old, and has one big glaring omission - it also rate-limits your LAN connectivity. My modified copy, using this guide, changes the rate limit for LAN traffic to 85% of a 10MB link for subnet 192.168.1.* . If your LAN subnet is different (or has a higher link speed), you will want to change those values.

You are free to utilize your distro's package for wondershaper, or inspect and use my modified copy so that LAN traffic is shaped differently than internet traffic.

If you are using my script:

sudo cp ./wondershaper.sh /sbin/wondershaper

This guide (and script) are written assuming that wondershaper is located in /sbin and is executable. So if you're not using mine and are using your distro's version, install it normally and then type:

sudo ln -s $(which wondershaper) /sbin/wondershaper

to create a symlink to /sbin/wondershaper if it does not yet exist.

Then make sure it's executable:

sudo chmod a+x /sbin/wondershaper

To install autobandwidth for Network Manager, first type

sudo mkdir /etc/NetworkManager/dispatcher.d

so that the directory exists if it's not already there. Then type

sudo cp ./autobandwidth.sh /etc/NetworkManager/dispatcher.d/60-autobandwidth

to copy the script. Then, finally,

sudo chown root:root /etc/NetworkManager/dispatcher.d/60-autobandwidth

If it isn't owned by root, NetworkManager won't touch it.

If you're using it manually, copy it (or create a symlink to) somewhere in your $PATH.

5. Usage

If you have installed it properly and Network Manager is installed, it should run automagically when the interface changes. It will (if not specified by Network Manager) find the active link, measure bandwidth using speedtest-cli, and then shape your internet traffic to 85% of measured bandwidth.

It waits until the load is less than 2 before running; this is hardcoded in the script. It's line 29: while (( $(echo "$MyLoad > 2" |bc -l) )); do.
Change 2 if you want or need to.

If you run autobandwidth without any arguments, it will look for links that are up. It will choose the first ethernet link first, and if there's no wired connection, it will look for (and choose) the first wireless connection that is up.

IMPORTANT autobandwidth uses the eno[0-9] and wlp[0-9]s[0-9] interface naming conventions!

If you run autobandwidth quit manually, it will clear the existing queues on the automatically chosen link. If you wish to specify the link in question, try this: autobandwidth eno1 quit or autobandwidth wlp2s0 quit, replacing the link names with your own.

This might also be useful to run as a cronjob if your connection changes or is funky.

It will output a minimal result to /tmp/bandwidthqueues as well if you wish to use that data in conky, etc.