Linux: Simulating slow internet connection

PHOTO EMBED

Sun Aug 28 2022 02:00:16 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #bash

#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12 
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 33kbps ceil 56kbps 
sudo tc qdisc add dev lo parent 1:12 netem delay 400ms
 
#Remove the rate control/delay
sudo tc qdisc del dev lo root
 
#To see what is configured on an interface, do this
sudo tc -s qdisc ls dev lo
 
#Replace lo with eth0/wlan0 to limit speed at lan
content_copyCOPY

I got this script for simulating slow network connection in order to test my work as it was running through internet using linux tc utility (traffic control center). It was tested using "lo" (local test) but it can be set up for other interfaces (ethX/wlanX/etc).