Initial commit

This commit is contained in:
Will Bradley 2015-05-22 18:37:20 -07:00
commit 88c8d06a9e
5 changed files with 91 additions and 0 deletions

24
LICENSING.txt Normal file
View File

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

22
README.md Normal file
View File

@ -0,0 +1,22 @@
TC Slowify
==========
Shell scripts to help you simulate slow network connections
-----------------------------------------------------------
*Requirements (generally included in Ubuntu, Fedora, OpenSuse, Gentoo, Debian, Mandriva, etc)*:
- tc (a Linux command, part of the iproute2 package)
- netem (included in the 2.6 Linux kernel)
*Usage*:
- ./apply.sh
- Applies limiting rules; prompts you to select an interface name, rate, and latency
- ./remove.sh
- Removes limiter from that interface
- ./status.sh
- Shows rules on that interface (sometimes other rules may already exist, that's ok)
*License*:
The Unlicense, see LICENSING.txt

20
apply.sh Executable file
View File

@ -0,0 +1,20 @@
# TC Slowify
# Shell scripts to help you simulate slow network connections
# By Will Bradley
# Thanks to https://gist.github.com/trongthanh/1196596
# Released via the Unlicense (see LICENSING.txt)
echo ""
read -e -i "lo" -p "Interface name to limit (ex: `ls -C /sys/class/net | sed 's/\s\+/, /g'`): " ifname
read -e -i "56kbps" -p "Limit amount (including units, ex: 56kbps): " limit
read -e -i "200ms" -p "Latency amount (including units, ex: 200ms): " latency
sudo tc qdisc add dev $ifname root handle 1: htb default 12
sudo tc class add dev $ifname parent 1:1 classid 1:12 htb rate $limit ceil $limit
sudo tc qdisc add dev $ifname parent 1:12 netem delay $latency
echo ""
echo "Set limiter on $ifname to:"
echo ""
sudo tc -s qdisc ls dev $ifname

17
remove.sh Executable file
View File

@ -0,0 +1,17 @@
# TC Slowify
# Shell scripts to help you simulate slow network connections
# By Will Bradley
# Thanks to https://gist.github.com/trongthanh/1196596
# Released via the Unlicense (see LICENSING.txt)
echo ""
read -e -i "lo" -p "Interface name to un-limit (ex: `ls -C /sys/class/net | sed 's/\s\+/, /g'`): " ifname
sudo tc qdisc del dev $ifname root
echo ""
echo "Removed limiter; $ifname is now:"
echo ""
sudo tc -s qdisc ls dev $ifname

8
status.sh Executable file
View File

@ -0,0 +1,8 @@
# TC Slowify
# Shell scripts to help you simulate slow network connections
# By Will Bradley
# Thanks to https://gist.github.com/trongthanh/1196596
# Released via the Unlicense (see LICENSING.txt)
sudo tc -s qdisc ls dev eth3