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 :-)
|PasswordPing Ltd.'s Exposed Password and Credentials API Service||Apr 28, 2017|
|Graph Any Data with Cacti!||Apr 27, 2017|
|Be Kind, Buffer!||Apr 26, 2017|
|Preparing Data for Machine Learning||Apr 25, 2017|
|openHAB||Apr 24, 2017|
|Omesh Tickoo and Ravi Iyer's Making Sense of Sensors (Apress)||Apr 21, 2017|
- Graph Any Data with Cacti!
- 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
- Preparing Data for Machine Learning
- Server Technology's HDOT Alt-Phase Switched POPS PDU
- Gordon H. Williams' Making Things Smart (Maker Media, Inc.)
- IGEL Universal Desktop Converter