Skip to main content

Simple tc command wrapper. Easy to setup traffic control of network bandwidth/latency/packet-loss to a network interface.

Project description

tcconfig

https://img.shields.io/pypi/pyversions/tcconfig.svg https://travis-ci.org/thombashi/tcconfig.svg?branch=master

Summary

Simple tc command wrapper. Easy to setup traffic control of network bandwidth/latency/packet-loss to a network interface.

Traffic control

The following parameters can be set of network interfaces.

  • Network bandwidth [G/M/K bps]

  • Network latency [milliseconds]

  • Packet loss rate [%]

Traffic control can specify the IP network and port to apply to.

Installation

Install via pip

tcconfig canbe installed via pip (Python package manager).

sudo pip install tcconfig

Usage

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 [--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
  --rate RATE        network bandwidth to apply the limit [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 setting

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.

# tcdel --device eth0

Dependencies

Linux package

  • iproute2 (reqrequired for tc commandured)

Python packagge

Python packagge: test dependencies

Project details


Release history Release notifications | RSS feed

This version

0.2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tcconfig-0.2.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

tcconfig-0.2.0-py2.py3-none-any.whl (8.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tcconfig-0.2.0.tar.gz.

File metadata

  • Download URL: tcconfig-0.2.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tcconfig-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fd05c7c2929723e48a1b5c777cc6ca9cc6e956d069812fbd7e0d3339b7c79de2
MD5 5885b47cf54a64b8adedc8ff095850b2
BLAKE2b-256 4e48d970ed463ce048a10198dd24cbaa2dd14855b2fa3cf3087602c04724593c

See more details on using hashes here.

Provenance

File details

Details for the file tcconfig-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for tcconfig-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 adc6231289abed95499dc93aaa86b380ad7461a30f7c58d467257fd73df550ae
MD5 228b56d4a9ee47ca7f0dc8abf7b4e50f
BLAKE2b-256 84e2047f1ba1222abe3fac58cbb375275dd4db1a42050abb1f370600fed944a5

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page