Skip to content
An easy-to-use network impairment script for Linux written in Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


An easy-to-use network impairment script for Linux written in Python is a CLI tool that simulates bad network conditions on Linux machines. It essentially is a wrapper script around the Linux netem module and the tc command. Using tc and netem is sometimes difficult, unintuitive or tedious at best, especially if you only want to impair a specific subset of network traffic. automates all of this and provides a simpler CLI interface for basic network impairment needs.

NOTE: Fedora users may need to install kernel-modules-extra if they're getting the below error:

RTNETLINK answers: No such file or directory
Traceback (most recent call last):
  File "./", line 295, in main
  File "./", line 175, in netem
  File "./", line 58, in _check_call
  File "/usr/lib64/python2.7/", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['tc', 'qdisc', 'add', 'dev', 'wlp3s0', 'parent', '1:3', 'handle', '30:', 'netem']' returned non-zero exit status 2

Features can do the following things:

  • Simulate packet loss, duplication, jitter, reordering, and rate limiting
  • Selective impairment based on ip/port
  • Inbound or outbound impairment
  • Automatically cleans up any impairment on exit or Ctrl-C supports both Python 2 and 3.


# Add 200ms jitter
sudo ./ -n eth0 netem --jitter 200


# Add 200ms delay
sudo ./ -n eth0 netem --delay 200


# Add 5% loss
sudo ./ -n eth0 netem --loss_ratio 5

Rate Control

# Limit rate to 1mbit
sudo ./ -n eth0 rate --limit 1000

Impair inbound traffic

# Append --inbound flag before the impairment keyword to apply inbound impairment
# For example, this applies 5% loss on inbound eth0
sudo ./ -n eth0 --inbound netem --loss_ratio 5

Selectively impair certain traffic

# Add 5% loss on packets with source IP of and destination port 9001
# NOTE: Specifying include flag overrides the default include, which impairs everything
sudo ./ -n eth0 --include src=,dport=9001 netem --loss_ratio 5
# Exclude packets with destination IP and source port 10000
sudo ./ -n eth0 --exclude dst=,sport=10000 netem --loss_ratio 5
# Exclude SSH 
sudo ./ -n eth0 --exclude dport=22 netem --loss_ratio 5
# Exclude a certain source IP on all ports
sudo ./ -n eth0 --exclude src= netem --loss_ratio 5

Additional parameters can be found with the help option

# Basic help
./ -h
# Help for the netem subcommand
./ netem -h
# Help for the rate subcommand
./ rate -h
You can’t perform that action at this time.