Traffic Control with tc
This weekend I had an interesting dilemma. I needed to transfer about 2GB worth of data to a remote machine. That's not really a lot to download, but it can be quite a pain on an asynchronous upload home Internet connection where your upload speed is pitiful! So, I began the transfer, and wouldn't you know that halfway through, my roommate returned from work. Now, since my roommate works at a startup called Blinkx in downtown San Francisco, he has work to do pretty much 24/7. I didn't want to disturb his work, but I also didn't want to cancel my transfer. What was a hacker to do :-(
After feeling defeated for about five minutes and having no idea how to shape the current traffic connection, I stumbled onto something. tc! Yes, tc can do everything you need to shape traffic. Amazing. A little man page reading later, and in ten minutes, I was now happily transferring data and not hogging all the upload bandwidth from my roommate. Here's how I was able to limit my upload to ~30KB/sec, from our cap of ~100KB/sec.
# tc qdisc add dev eth1 root handle 1: tbf rate 300kbit burst 300kbit latency 1
Now, this command is quite a hack. I didn't actually bother to find the best options for the job, but then again, I didn't have much time. The command above merely limits the connection of my wireless device to ~30KB/sec using the Token Bucket Filter mechanism.
I highly encourage the reader to find more advanced usage of tc and craft some beautiful shaping rules. If you don't want as much control, then you may consider other useful tools such as trickle/trickled (user-space) and wondershaper. Happy hacking :-)
|Omesh Tickoo and Ravi Iyer's Making Sense of Sensors (Apress)||Apr 21, 2017|
|Low Power Wireless: 6LoWPAN, IEEE802.15.4 and the Raspberry Pi||Apr 20, 2017|
|CodeLathe's Tonido Personal Cloud||Apr 19, 2017|
|Wrapping Up the Mars Lander||Apr 18, 2017|
|MultiTaction's MT Canvus-Connect||Apr 17, 2017|
|Android Candy: Facebook Everything?!?!||Apr 14, 2017|
- Low Power Wireless: 6LoWPAN, IEEE802.15.4 and the Raspberry Pi
- Teradici's Cloud Access Platform: "Plug & Play" Cloud for the Enterprise
- The Weather Outside Is Frightful (Or Is It?)
- Simple Server Hardening
- Understanding Firewalld in Multi-Zone Configurations
- Gordon H. Williams' Making Things Smart (Maker Media, Inc.)
- Non-Linux FOSS: Control Web-Based Music!
- Buddy Platform Limited's Parse on Buddy Service
- Bash Shell Script: Building a Better March Madness Bracket