Howto shape or restrict bandwidth under Linux / UNIX / BSD

Posted on in Categories Debian Linux, FreeBSD, Gentoo Linux, Linux, Networking, OpenBSD, RedHat/Fedora Linux, Suse Linux, Tips, Tuning last updated October 27, 2009

There is a program called trickle. It is a portable lightweight userspace bandwidth shaper. It can run in collaborative mode (together with trickled) or in stand alone mode.

trickle works by taking advantage of the unix loader preloading. Essentially it provides, to the application, a new version of the functionality that is required to send and receive data through sockets. It then limits traffic based on delaying the sending and receiving of data over a socket. trickle runs entirely in userspace and does not require root privileges.

From the article:

Trickle is a lightweight userspace bandwidth shaper for users with low-speed Internet connections that lets you limit the bandwidth that a specific protocol is using so that you can maintain multiple simultaneous connections and not end up in a traffic jam.

Any user on the system can run Trickle without needing administrative privileges. The software can handle only TCP stream connections, so it cannot shape traffic for network services that uses UDP stream connections, such as DNS (Bind) and TFTP. Actually, it cannot work with all network services that use TCP streams; because trickle uses the dynamic linker and loader, it can handle only network services that uses dynamic libraries (glibc) and not any programs that are statically linked. You can check whether a network service or command uses dynamic libraries with help of the ldd command, which prints shared library dependencies, so that you can see exactly what libraries are used with the specific command. For example to check whether FTP uses dynamic libraries:

Read more: Shape your traffic with trickle []

2 comment

  1. “Um. wget has a –limit option.”

    If you just use the -limit option with wget, each wget will instance will suck up that much bandwidth. With trickle you can limit the total bandwidth of all the wget’s together…get it?

Leave a Comment