From: Teresa e Junior <teresaejunior@gmail.com>
To: lartc@vger.kernel.org
Subject: Can't get tc to limit network traffic
Date: Mon, 15 Sep 2014 01:37:26 +0000 [thread overview]
Message-ID: <541642D6.4040104@gmail.com> (raw)
I have asked this on http://unix.stackexchange.com/questions/154144/,
and even offered a bounty, but nobody was able to answer me (if you want
the bounty, go there and grab it fast ;)
Based on this section of the Linux Advanced Routing & Traffic Control
HOWTO: http://lartc.org/howto/lartc.ratelimit.single.html, I can't get
tc to limit the network speed in my computer.
Basically, I have 13 machines in the network, and this particular
machine sometimes steals all traffic available. The router is a Motorola
SurfBoard modem with a few routing capabilities and firewall. The
machine I want to limit the traffic is 192.168.0.5, and also the script
is being run from 192.168.0.5.
Here is my adaption of the commands in the HOWTO for
/etc/NetworkManager/dispatcher.d/:
#!/bin/sh -eu
# clear any previous queuing disciplines (qdisc)
tc qdisc del dev wlan0 root 2>/dev/null ||:
# add a cbq qdisc; see `man tc-cbq' for details
if [ $2 = up ]; then
# set to a 3mbit interface for more precise calculations
tc qdisc add dev wlan0 root handle 1: cbq avpkt 1000 \
bandwidth 3mbit
# leave 30KB (240kbps) to other machines in the network
tc class add dev wlan0 parent 1: classid 1:1 cbq \
rate 2832kbit allot 1500 prio 5 bounded isolated
# redirect all traffic on 192.168.0.5 to the previous class
tc filter add dev wlan0 parent 1: protocol ip prio 16 \
u32 match ip dst 192.168.0.5 flowid 1:1
# change the hashing algorithm every 10s to avoid collisions
tc qdisc add dev wlan0 parent 1:1 sfq perturb 10
fi
The problem is that I have tried setting 2832kbit to very small values
for testing (like 16kbit), but I still can browse the web at high speed.
The problem is not in NetworkManager, because I'm testing the script
manually. Also, tc doesn't return any errors.
I have found that by changing dst 192.168.0.5 to src 192.168.0.5, the
upload speed is reliably limited, but I still haven't figured how to get
the download speed to work, which is the most important for me.
The following approach I have taken from wondershaper:
tc qdisc add dev wlan0 handle ffff: ingress
tc filter add dev wlan0 parent ffff: protocol ip prio 50 u32 match ip \
dst 192.168.0.5 police rate 200kbps burst 10k drop flowid :1
But the problem with this one is that it is very unreliable, it results in
unstable download speeds (if set to 200, it downloads at ~80-120).
Thank you!
Teresa and Junior
next reply other threads:[~2014-09-15 1:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-15 1:37 Teresa e Junior [this message]
2014-09-15 4:18 ` Can't get tc to limit network traffic Mike Schmidt
2014-09-15 5:09 ` Teresa e Junior
2014-09-15 5:49 ` Mike Schmidt
2014-09-15 16:03 ` Andy Furniss
2014-09-15 16:33 ` Dave Taht
2014-09-15 17:27 ` Andy Furniss
2014-09-15 17:41 ` Dave Taht
2014-09-15 21:56 ` Teresa e Junior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=541642D6.4040104@gmail.com \
--to=teresaejunior@gmail.com \
--cc=lartc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.