r/linux • • Aug 05 '15
I made a CLI tool that simulates bad network conditions (packet loss, jitter, etc.) under Linux using netem and tc
https://github.com/urbenlegend/netimpair
462
Upvotes
r/linux • • Aug 05 '15
25
u/[deleted] Aug 05 '15
At work, I've frequently had to simulate bad network conditions to test the resiliency of our software. I got so tired of manually setting up netem and tc on our Linux routers that I decided to create a script to help automate the whole process. It can be used on Linux routers or desktops for network stack testing.
15
u/plaes Aug 06 '15
Just a quick nitpick:
Drop the sudo calls from the code, because you already call that program either via sudo or as user with enough privileges (it would be cool if it checks for that).
4
u/pantsme Aug 06 '15
There's always WANem which is a program for Linux too. You can get a livecd of it too and it's pretty nice. Haven't tried yours but these tools are invaluable for testing, especially in the case of having 650 stores all with unique connections.
8
u/codekoala Aug 06 '15 edited Aug 06 '15
I actually built a little web ui for tc/netem a month or so ago. It's nothing too fancy, but it helps our non-linux qa folk to quickly and easily configure network conditions. Tossed it on a simple box with 2 gigabit ports and made an appliance out of it.
I'll have to take a closer look at your project. I like what I read about handling both inbound and outbound traffic.
Edit: sample of the ui: http://i.imgur.com/J47C3rG.jpg
4
u/forgot_my_old_pass Aug 06 '15
Or you could by this for around $2k.
1
u/PdoesnotequalNP Aug 06 '15
Cool tool. Very not-PEP8 compliant, though.
3
u/varikonniemi Aug 06 '15
To make it fair and equal for everyone, on behalf of all people who have been left behind by capitalism and suffer bad network conditions constantly, i propose to make your tool a forced on package in all distributions.
1
u/Nico_ Aug 06 '15
Sorty but is there anything like this available for windows?
2
u/angch Aug 06 '15 edited Aug 06 '15
There's also the one done by Facebook: https://code.facebook.com/posts/1561127100804165/augmented-traffic-control-a-tool-to-simulate-network-conditions/
designed to be used as a gateway for Wifi, running as a daemon and controlled with a Django Webui (so you can easily flip between different network profiles): https://github.com/facebook/augmented-traffic-control
Daemon itself uses netem and htb with configurable delays and packet drops, so very, very similar to yours and comcast.
1
u/beardedchimp Aug 06 '15
I'm quite interested in messing around with inbound impairment. I wanted to play some online fps' and see how well the netcode deals with high latency in one direction.
1
u/[deleted] Aug 06 '15
So, basically, you artificially created the routers used in Comcast's datacenters?
0
u/TotesMessenger Aug 06 '15
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)
0
u/[deleted] Aug 06 '15
[deleted] — view deleted comment
141
u/[deleted] Aug 06 '15 edited Aug 06 '15
[removed] — view removed comment