-
-
Notifications
You must be signed in to change notification settings - Fork 318
Simulate bad network with pf
Vincent Velociter edited this page Nov 4, 2016
·
2 revisions
First create an anchor and reload pf conf:
(cat /etc/pf.conf && echo "dummynet-anchor \"lichess\"" && echo "anchor \"lichess\"") | sudo pfctl -f -
Pipe all traffic to port 9663 to dummynet:
echo "dummynet out quick proto tcp from any to any port 9663 pipe 1" | sudo pfctl -a lichess -f -
Configure the pipe:
sudo dnctl pipe 1 config bw 10Kbit/s plr 0.1 delay 500
Here it simulate a very bad network, with a limited bandwidth and a packet loss rate of 10%. This last command can be changed on the fly to test different network configurations.
Enable/disable firewall:
sudo pfctl [-e|-d]
Reset conf:
sudo dnctl flush
sudo pfctl -f /etc/pf.conf