Content-type: text/html Man page of pyshaper

pyshaper

Section: Traffic-shaping (bandwidth management) (8)
Updated: 0.1.1
Index Return to Main Contents
 

NAME

pyshaper - Simple yet versatile dynamic bandwidth manager  

SYNOPSIS

pyshaper [<options>]

pyshaper [<options>] start

pyshaper stop

pyshaper help

pyshaper reload

pyshaper status

pyshaper netstat  

DESCRIPTION

pyshaper is a daemon which dynamically manages your incoming and outgoing bandwidth allocations.

Its main purpose is for people in countries like New Zealand and Australia, where the telcos routinely indulge in monopoly price-gouging, and broadband connectivity is hobbled by meagre traffic caps (as little as 400MB/month) with harsh fees for excess traffic.

With pyshaper you can safely run internet programs, and leave them running, without fear of maxing out your monthly traffic allowances. You can easily set up high-level classes (traffic categories), and enforce strict priorities and bandwidth limits for connections which fall into each of these classes.

In contrast to 'bare-bones' traffic shaping programs like tc(8), and the various 'tc-wrapper' programs, pyshaper is simple to configure and use, and allows you to create bandwidth allocations which will be dynamically applied in real time to the current TCP connections, based on sophisticated combinations of attributes such as:

raddr IP address of remote host
rport Remote port
laddr IP address of local host
lport Local port
cc 2-letter uppercase country code for the remote host
country Full country name of remote host
user Username under which the program owning the local connected port is running.
pid Process ID of the locally connected program (probably not much use).
cmd The command under which the locally connected program was launched, ie the program's argv[0]
args The invocation arguments of the locally connected program

pyshaper periodically scans the current TCP connections from the local computer (by default, once every 30 seconds), and matches them against your chosen rules - a simple set of boolean expressions in your configuration file.

For each connection that matches one of your rules, pyshaper runs the appropriate tc(8) commands to dynamically set the priority, and shape the outgoing (and incoming) bandwidth allocation, for that connection.

What makes pyshaper unique is its dynamic shaping feature.

Most 'tc-wrapping' traffic shaping programs just pass a set of static shaping rules to tc. Such static rules can only match on local and remote hostname and port (unless of course you're a nuts-n-bolts networking wizard, and can write iptables(1) rules in your sleep).

But since pyshaper periodically scans all active connections, and reads /proc info for each locally connected program, it allows you to match connections in real time, based on the additional attributes listed above.

All this amounts to a high degree of flexibility, which allows you to create some interesting traffic-shaping scenarios such as:

Providing generous downloading bandwidth for people visiting your website from New Zealand or Australia, nominal bandwidth for visitors from other countries, but severely restricted bandwidth for visitors from Slovakia

Providing high bandwidth between a local Freenet node, and remote Freenet nodes in your own country, but creating a severely restricted bandwidth pool for communications between the local Freenet node and nodes in other countries. (This is an interesting scenario, because Freenet nodes connect via random ports, and no protocol-based traffic detectors are yet available which can match Freenet FNP traffic)

Setting a fixed 32kbit/s bandwidth for all Peer2peer connections (including eDonkey, I2P, Freenet, Limewire etc) resulting from local processes owned by user fred
 

OPTIONS

-h, --help
Output help information and exit.
-v, --version
Display program version number and exit.
-f, --foreground
Do not detach - run the program in foreground.
By default, pyshaper detaches from the console and runs as a daemon.
-d, --debug
Enable debugging mode (wrecks performance).
-V, --verbosity=n
Sets output verbosity level.
Values are 1 (silent), 2 (normal), 3 (detailed), 4 (noisy).
Default is 2.
 

COMMANDS

The available pyshaper commands are:

start
Start pyshaper running (forks and detaches from console and runs in background, unless -f or --foreground option is set.

stop
Sends a SIGTERM signal to the running pyshaper process, telling it to terminate.

help
Output help information and exit.

status
Runs tc commands to display the status of the shaped network interfaces.

netstat
Runs the netstat command with a number of options set, to display current TCP connections.

reload
Sends a SIGHUP signal to the running pyshaper process, telling it to reload its configuration file.
Handy, because it allows you to edit the configuration file and make pyshaper use this configuration without terminating.

restart
Synonym for reload

kill
Synonym for stop

 

FILES

/etc/pyshaper/pyshaper.conf

pyshaper configuration

/etc/pyshaper/pyshaper.conf.readme

pyshaper config file syntax

/var/run/pyshaper.pid

Holds process id of running pyshaper process, used by the reload and stop commands.
 

RESTRICTIONS

You must be root to run pyshaper.  

ENVIRONMENT VARIABLES

PYSHAPERCONFIG
Specifies an alternative configuration file
(default is /etc/pyshaper/pyshaper.conf)
 

EXAMPLES

Refer to pyshaper.conf(8), or the examples directory within the pyshaper distribution tarball.  

BUGS

New TCP connections will gain the 'default' bandwidth (as set in your configuration), until the next pyshaper connection scanning cycle, at which time they will be matched against your rules and shaped accordingly. This can cause momentary bursts of excess bandwidth consumption on the part of connections you want throttled. To work around this, be a little more conservative in your bandwidth allocations, and/or set a more frequent connection scanning interval.

pyshaper only manages TCP connections. At this time, it is not capable of managing UDP traffic.  

AUTHORS

pyshaper was written by David McNab <david@freenet.org.nz>
Refer author's python repository at http://www.freenet.org.nz/python

 

LICENSE

pyshaper is released under the terms of the GNU General Public License (GPL). For more information on the GPL, refer to the GNU Website at http://gnu.org  

SEE ALSO

pyshaper.conf(8)

tc(8)


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
COMMANDS
FILES
RESTRICTIONS
ENVIRONMENT VARIABLES
EXAMPLES
BUGS
AUTHORS
LICENSE
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 23:33:39 GMT, March 20, 2004