Differences between version 17 and previous revision of TrafficShaping.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 17 | Last edited on Friday, April 1, 2005 10:14:42 pm | by JohnMcPherson | Revert |
Older page: | version 16 | Last edited on Friday, April 1, 2005 5:27:53 pm | by JohnMcPherson | Revert |
@@ -18,9 +18,9 @@
This is a script I use to throttle one machine down to half our ADSL rate. This machine is used for downloading large files (for example .iso's of the latest LinuxDistribution), but we don't want it impacting the rest of our machines. This example was stolen from the Advanced Router HOWTO, and cleaned up a bit by me.
You run this script on your gateway rate limiting data to your internal client machine(s).
-<verbatim
>
+<pre
>
#!/bin/sh
# The device data is going *out* of. You can't stop a machine recieving data (short of firewalling)
# But you can limit how fast it *sends* data.
@@ -46,9 +46,9 @@
# Where the tc executable is.
TC=/sbin/tc
- if [ ! -x $TC ]; then
+ if ~
[ ! -x $TC ]; then
echo Cant find $TC, aborting
exit 1
fi
@@ -91,13 +91,13 @@
# around this is to change the hash function frequently so that this effect is reduced. However
# doing this too often makes your rate limiting less accurate, doing it too rarely means that
# data is incorrectly classified as above, so we tell the kernel to change the hash every 10s.
$TC qdisc add dev $DEV parent 1:1 sfq perturb 10
-</verbatim
>
+</pre
>
Hopefully this is enough to get people started, please, if you know anything more add it to this page. I found the advanced router howto very oblique in it's information.
----
-Similar script, for the case where your router is also a fileserver (and you don't want to rate-limit that
, obviously).
+Similar script, for the case where your router is also a fileserver (and you don't want to rate-limit traffic from it to the lan clients
, obviously).
My server has <tt>eth1</tt> going to the ISP, and <tt>eth0</tt> going to the lan clients. This doesn't rate-limit upstream connections, but few users on our lan use much upstream bandwidth. This script rate-limits to just below our ADSL bandwidth, so that packets get dropped (and [TCP] adjusts its sending rate) rather than getting queued in [TelecomNZ]'s equipment.
<verbatim>