Skip to content

Bash script to simulate slower network connections

License

Notifications You must be signed in to change notification settings

sunapi386/slowutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow 3G -l 600ms -p 10%   # slow network on eth0 and setup latency to 600ms packetloss to 10%
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency
slow dsl -b 1mbps         # Simulate DSL with a slower speed than the default
slow modem-56k -d eth0    # Simulate a 56k modem on the eth1 device. eth0 is unchanged.

Usage

slow <network-type> [-d device] [-b bandwidth] [-l latency] [-p %drop] [-u %duplication] [-c %corruption] [-r %reordering] [-s self_reset_delay_s]
slow reset
slow status

Use the -s to to trigger slow reset automatically after the timeout. Useful when experimenting with dangerous settings (such as 90% packet loss) and you want to recover the device without rebooting. Also useful for scripting into a test.

slow edge -s 60 &
SLOWPID=$!
ping 8.8.8.8 -c 60
wait $SLOWPID

Credits

  • v0.5 @sunapi386 implements reset after timeout; to recover device without a reboot
  • v0.4 @sunapi386 implements packet duplication, corruption, reordering
  • v0.3 @sunapi386 implements the active device selected by default
  • v0.2 @aloysius implements packet loss
  • v0.1 first version

Richard Bullington-McGuire [email protected] wrote the script inspired by a UI suggestion from Mike Schwartz [email protected].

Stack Overflow and Superuser questions that helped:

An Aptivate blog post lent some inspiration, as did this script for throttling bandwidth.

About

Bash script to simulate slower network connections

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages