Package: tcconfig
tcconfigSummaryTraffic controlUsageSet traffic control (tcsetcommand)Delete traffic control (tcdelcommand)Display traffic control configurations (tcshowcommand)For more informationInstallationInstallation: pipInstallation: dpkg (Debian/Ubuntu)DependenciesLinux packagesLinux kernel moduleOptional Python packagesDocumentationTroubleshootingDocker imageSponsorsSummarytcconfigis a tc command wrapper. Make it easy to set up traffic control of network bandwidth/latency/packet-loss/packet-corruption/etc. to a network-interface/Docker-container(veth).Traffic controlSetup traffic shaping rulesEasy to apply traffic shaping rules to specific network:Outgoing/Incoming packetsSource/Destination IP-address/network (IPv4/IPv6)Source/Destination portsAvailable parametersThe following parameters can be set to network interfaces:Network bandwidth rate[G/M/K bps]Network latency[microseconds/milliseconds/seconds/minutes]Packet loss rate[%]Packet corruption rate[%]Packet duplicate rate[%]Packet reordering rate[%]TargetsNetwork interfaces: e.g.eth0Docker container (vethcorresponding with a container)UsageSet traffic control (tcsetcommand)tcsetis a command to add traffic control rule to a network interface (device).e.g. Set a limit on bandwidth up to 100Kbps#tcseteth0--rate100Kbpse.g. Set network latencyYou can use time units (such as us/sec/min/etc.) to designate delay time.Set 100 milliseconds network latency#tcseteth0--delay100msSet 10 seconds network latency#tcseteth0--delay10secSet 0.5 minutes (30 seconds) network latency#tcseteth0--delay0.5minYou can also use the following time units:UnitAvailable specifiers (str)hoursh/hour/hoursminutesm/min/mins/minute/minutessecondss/sec/secs/second/secondsmillisecondsms/msec/msecs/millisecond/millisecondsmicrosecondsus/usec/usecs/microsecond/microsecondse.g. Set 0.1% packet loss#tcseteth0--loss0.1%e.g. All of the above settings at once#tcseteth0--rate100Kbps--delay100ms--loss0.1%e.g. Specify the IP address of traffic control#tcseteth0--delay100ms--network192.168.0.10e.g. Specify the IP network and port of traffic control#tcseteth0--delay100ms--network192.168.0.0/24--port80Set traffic control to a docker containerExecutetcconfigwith--dockeroption on a Docker host:#tcset<containernameorID>--docker...You could use--src-container/--dst-containeroptions to specify source/destination container.Set traffic control within a docker containerYou need to run a container with--cap-addNET_ADMINoption
if you you would like to set a tc rule within a container:docker run -d --cap-add NET_ADMIN -t <docker image>A container image that builtin tcconfig can be available athttps://hub.docker.com/r/thombashi/tcconfig/Delete traffic control (tcdelcommand)tcdelis a command to delete traffic shaping rules from a network interface (device).e.g. Delete traffic control ofeth0You can delete all of the shaping rules for theeth0with-a/--alloption:#tcdeleth0--allDisplay traffic control configurations (tcshowcommand)tcshowis a command to display the current traffic control settings for network interface(s).Example#tcseteth0--delay10ms--delay-distro2--loss0.01%--rate0.25Mbps--network192.168.0.10--port8080#tcseteth0--delay1ms--loss0.02%--rate500Kbps--directionincoming#tcshoweth0{
    "eth0": {
        "outgoing": {
            "dst-network=192.168.0.10/32, dst-port=8080, protocol=ip": {
                "filter_id": "800::800",
                "delay": "10.0ms",
                "delay-distro": "2.0ms",
                "loss": "0.01%",
                "rate": "250Kbps"
            }
        },
        "incoming": {
            "protocol=ip": {
                "filter_id": "800::800",
                "delay": "1.0ms",
                "loss": "0.02%",
                "rate": "500Kbps"
            }
        }
    }
}For more informationMore examples are available athttps://tcconfig.rtfd.io/en/latest/pages/usage/index.htmlInstallationInstallation: piptcconfigcan be installed fromPyPIviapip(Python package manager) command.sudo pip install tcconfigInstallation: dpkg (Debian/Ubuntu)curl -sSL https://raw.githubusercontent.com/thombashi/tcconfig/master/scripts/installer.sh | sudo bashDependenciesPython 3.6+Python package dependencies (automatically installed)Linux packagesmandatory: required fortccommand:Ubuntu/Debian:iproute2Fedora/RHEL:iproute-tcoptional: required to when you use--iptablesoption:iptablesLinux kernel modulesch_netemOptional Python packagesPygmentsDocumentationhttps://tcconfig.rtfd.io/Troubleshootinghttps://tcconfig.rtfd.io/en/latest/pages/troubleshooting.htmlDocker imagehttps://hub.docker.com/r/thombashi/tcconfig/SponsorsBecome a sponsor