Gentoo Archives: gentoo-user

From: Hans-Werner Hilse <hilse@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Packet Shaping
Date: Sat, 14 Apr 2007 17:13:17
Message-Id: 20070414190735.cd7f1b58.hilse@web.de
In Reply to: Re: [gentoo-user] Packet Shaping by Grant
1 Hi,
2
3 On Sat, 14 Apr 2007 08:37:19 -0700
4 Grant <emailgrant@×××××.com> wrote:
5
6 > After a lot of testing, these numbers seem to give me the best
7 > performance as far as bittorrent download speed.
8 > How can that be? Is DOWNLINK my upload and UPLINK my download?
9
10 Hm, usually not. Are you by chance shaping the internal (i.e. LAN)
11 interface on a router? Then, of course, it would make sense (except
12 from the fact that shaping your actual bottle neck, i.e. Internet
13 connection, would make more sense).
14
15 > I tried to define the bittorrent ports as a low priority like this:
16 > NOPRIOPORTSRC=6881:6999
17 > NOPRIOPORTDST=6881:6999
18 >
19 > but I get this when restarting shorewall:
20 > Illegal "match"
21
22 In the wshaper source, the action happens here (and the same for *DST):
23 ---snip
24 for a in $NOPRIOPORTSRC
25 do
26 tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
27 match ip sport $a 0xffff flowid 1:30
28 done
29 ---snip
30
31 In this configuration, it expects a shell-separatable list of ports,
32 i.e. separated by whitespace. It will create a rule for each one.
33
34 The dirty, easy way:
35 | NOPRIOPORTSRC=$(seq 6881 6999)
36 | NOPRIOPORTDST=$NOPRIOPORTSRC
37
38 But I would rather extend wshaper by another (custom) line and dump your
39 NOPRIOPORT*-settings.
40
41 The syntax is "match ip sport PATTERN MASK". The port of an incoming
42 packet is AND'ed w/ the MASK and compared to the PATTERN.
43
44 e.g. "match ip sport 6880 0xffe0" would match 6880-6911, a further
45 "match ip sport 6912 0xffc0" would match 6912-6975.
46
47 The advantage of this is simply speed/CPU cycles. Alternatively, you
48 could just use iptables to mark your packets (which probably means even
49 more precious CPU cycles). The wshaper script, however, doesn't use
50 iptables.
51
52 -hwh
53 --
54 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] Packet Shaping Grant <emailgrant@×××××.com>