Search code examples
pythonlinuxubuntutrafficshaping

Traffic shaping under Linux


Where can I learn about controlling/interrogating the network interface under Linux? I'd like to get specific application upload/download speeds, and enforce a speed limit for a specific application.

I'd particularly like information that can help me write a traffic shaping application using Python.


Solution

  • You want the iproute2 suite, in which you use the tc command. tc commands look like

    tc class add dev eth2 parent 1: classid 1:1 htb rate 100Mbit ceil 100Mbit quantum 1600
    

    Here's an existing Python traffic-shaping application that uses iproute2.