Simple tc command wrapper. Easy to setup traffic control of network bandwidth/latency/packet-loss to a network interface.
Project description
tcconfig
Summary
Simple tc command wrapper. Easy to setup traffic control of network bandwidth/latency/packet-loss to a network interface.
Traffic control
Network
Traffic control can be specified network to apply to:
Outgoing/Incoming packets
Certain IP address/network and port
Parameters
The following parameters can be set of network interfaces.
Network bandwidth [G/M/K bps]
Network latency [milliseconds]
Packet loss rate [%]
Installation
Install via pip
tcconfig canbe installed via pip (Python package manager).
sudo pip install tcconfig
Basic usage
Outgoing packet traffic control settings are as follows
Set traffic control (tcset)
tcset is a command to impose traffic control to a network interface (device).
tcset help
usage: tcset [-h] [--version] [--logging] [--stacktrace] [--debug | --quiet]
--device DEVICE [--direction {outgoing,incoming}] [--rate RATE]
[--delay DELAY] [--loss LOSS] [--network NETWORK] [--port PORT]
[--overwrite]
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--debug for debug print.
--quiet suppress output of execution log message.
Miscellaneous:
--logging output execution log to a file (tcset.log).
--stacktrace display stack trace when an error occurred.
Traffic Control:
--device DEVICE network device name (e.g. eth0)
--direction {outgoing,incoming}
direction of network communication that impose traffic
control. default=outgoing
--rate RATE network bandwidth [K|M|G bps]
--delay DELAY round trip network delay [ms] (default=0)
--loss LOSS round trip packet loss rate [%] (default=0)
--network NETWORK destination network of traffic control
--port PORT destination port of traffic control
--overwrite overwrite existing settings
e.g. Set a limit on bandwidth up to 100Kbps
# tcset --device eth0 --rate 100k
e.g. Set 100ms network delay
# tcset --device eth0 --delay 100
e.g. Set 0.1% packet loss
# tcset --device eth0 --loss 0.1
e.g. All of the above at onece
# tcset --device eth0 --rate 100k --delay 100 --loss 0.1
e.g. Specify the IP address of traffic control
# tcset --device eth0 --delay 100 --network 192.168.0.10
e.g. Specify the IP network and port of traffic control
# tcset --device eth0 --delay 100 --network 192.168.0.0/24 --port 80
Delete traffic control (tcdel)
tcdel is a command to delete traffic control from a network interface (device).
tcdel help
usage: tcdel [-h] [--version] [--logging] [--stacktrace] [--debug | --quiet]
--device DEVICE
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--debug for debug print.
--quiet suppress output of execution log message.
Miscellaneous:
--logging output execution log to a file (tcdel.log).
--stacktrace display stack trace when an error occurred.
Traffic Control:
--device DEVICE network device name (e.g. eth0)
e.g.
# tcdel --device eth0
Advanced usage
Traffic control of incoming packets
Execute tcset command with --direction incoming option to set incoming traffic control. Other options are the same as in the case of the basic usage.
e.g. Set traffic control both incoming and outgoing network
tcset --device eth0 --direction outgoing --rate 200K --network 192.168.0.0/24
tcset --device eth0 --direction incoming --rate 1M --network 192.168.0.0/24
Requirements
Incoming packet traffic control requires additional ifb module, Which need to the following conditions:
Equal or greater than Linux kernel version 2.6.20
Equal or newer than iproute2 package version 20070313
Dependencies
Linux package
iproute2 (reqrequired for tc commandured)
Python packagge
Dependency python packages are automatically installed during AAA installation via pip.
Test dependencies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tcconfig-0.3.0.tar.gz
.
File metadata
- Download URL: tcconfig-0.3.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76f8bfc3663260adf69d71bfd9379d814d7493d63a5a148959a62cf6d10e2ef5 |
|
MD5 | 2cceca96227e8b42d2679c350c0d915e |
|
BLAKE2b-256 | 19396bf2d1ceaacd8235aba272364a7b181bde2a27f74716e3857fb42fbf96c8 |
Provenance
File details
Details for the file tcconfig-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: tcconfig-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 249cfbcfb10c3530e7216b62986ec03c8dc4c80791ad78de2ec1e8c1df7fbf88 |
|
MD5 | fd057067b484459518bbca52330cef41 |
|
BLAKE2b-256 | 7da6da8cdfd855cdebe5aa75a3f1d15fa27ab1308af0c5f5934b861ec96956e1 |