PDA

View Full Version : [Solved] Cause/simulate packet loss on the Linux network interface



Fli
04-21-2021, 09:37 AM
Following command may work (eth0 is my network interface name).
But executing this on remote computer to which you do not have physical access may be risky, because you can make its network interface not responding your connection requests!
Maybe will help to reboot that remove PC if the provider has web console, maybe even this will not work. So maybe run the script like:


#!/bin/bash
sudo tc qdisc add dev eth0 root netem loss 20%
pause 1800
sudo tc qdisc del dev eth0 root netem loss 20%

and run it inside "screen" or in background "bash scriptname &"

packet loss:
sudo tc qdisc add dev eth0 root netem loss 20%

remove the rule:
sudo tc qdisc del dev eth0 root netem loss 20%