NetEm Commands for Linux
1. Adding Delay
sudo tc qdisc add dev eth0 root netem delay 100ms
Adds a delay of 100 milliseconds (ms) to the network interface.
2. Changing Delay
sudo tc qdisc change dev eth0 root netem delay 200ms
Changes the existing delay to 200 ms.
3. Removing Delay
sudo tc qdisc del dev eth0 root
Removes the added delay (along with any other NetEm settings).
Additional Options
Add Variability to Delay
sudo tc qdisc add dev eth0 root netem delay 100ms 50ms
Adds a base delay of 100 ms with a maximum variation of 50 ms.
Add Packet Loss
sudo tc qdisc add dev eth0 root netem delay 100ms loss 10%
Simulates packet loss along with delay.
Adding Bandwidth Limit
sudo tc qdisc add dev eth0 root tbf rate 1mbit burst 32kbit latency 400ms
Limits the bandwidth to 1 Mbit/s with a burst of 32 kbit and 400 ms latency.
Check Current Configuration
sudo tc -s qdisc show dev eth0
Views the current qdisc settings on the specified interface.
Find Network Interfaces
ip link show
Lists all network interfaces on your system.
Show network condition
sudo tc qdisc show dev eth0
Show network condition applied on interface.
Adding Duplicate Packets
sudo tc qdisc add dev eth0 root netem duplicate 10%
Duplicates 10% of the packets sent through the network interface.
Reordering Packets
sudo tc qdisc add dev eth0 root netem reorder 10% 50%
Reorders 10% of packets with a 50% chance of being out of order.