I
I
Infactum2013-03-31 13:28:17
linux
Infactum, 2013-03-31 13:28:17

Shaping p2p traffic on linux + tc + ndpi?

I'm using a router with OpenWRT. The task is to make incoming P2P/eDonkey traffic have a lower priority than the rest, and occupy only the free part of the channel.
I do the following:

tc qdisc add dev br-lan root handle 1: htb default 20
tc class add dev br-lan parent 1: classid 1:1 htb rate 100Mbps
# класс под P2P трафик
tc class add dev br-lan parent 1:1 classid 1:10 htb rate 1kbps ceil 100Mbps prio 10
# класс под остальной трафик
tc class add dev br-lan parent 1:1 classid 1:20 htb rate 1kbps ceil 100Mbps prio 0

iptables -t mangle -A POSTROUTING -m ndpi --bittorrent -j CLASSIFY --set-class 1:10
iptables -t mangle -A POSTROUTING -m ndpi --edonkey -j CLASSIFY --set-class 1:10

Checking the tc statistics shows that the traffic is classified correctly and goes into the correct htb buckets.
Next, I perform the test as follows:
1. I go to speedtest.net and see the test result of an unloaded channel.
2. I launch a torrent that completely downloads the channel.
3. I run speedtest again, expecting the same results as with a free channel, since the shaper must transfer the bandwidth to the class with priority 0.
As a result, the speed of speedtest with a running torrent is almost zero. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
ValdikSS, 2013-03-31
@ValdikSS

You are shaping outgoing traffic, not incoming traffic. You can’t shape incoming traffic “just like that”, you need to somehow make it outgoing. For example, via IMQ or IFB

S
sht0rm13, 2013-03-31
@sht0rm13

Does the torrent client use encryption?

I
Infactum, 2014-01-04
@Infactum

So much time has already passed, but it turns out that they sent me an answer on another forum ..
I'll write it here, I hope it will come in handy for someone:

the error is that your ceiling is specified as 100Mb / s (100Mbs), but it should be 100Mbit, or rather, less than this value by 5-10%. Therefore, the queue is empty and prioritization does not work at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question