Gentoo Archives: gentoo-user

From: Datty <datty.wtb@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Traffic shaping - downstream data
Date: Tue, 12 Jun 2012 13:40:47
Message-Id: CAG+b7UVPLZnA7B3Wut5Tt-rHxSCuv_f5HRWr9K=UKEc0cWKVRw@mail.gmail.com
In Reply to: Re: [gentoo-user] Traffic shaping - downstream data by Michael Mol
1 On Tue, Jun 12, 2012 at 2:21 PM, Michael Mol <mikemol@×××××.com> wrote:
2
3 > More detail later...but make sure your vpn link is not TCP. UDP, fine,
4 > IP-IP, fine, but not TCP. TCP transport for a VPN tunnel leads to ugly
5 > traffic problems.
6 > On Jun 12, 2012 8:59 AM, "Datty" <datty.wtb@×××××.com> wrote:
7 >
8 >>
9 >> On Tue, Jun 12, 2012 at 9:58 AM, J. Roeleveld <joost@××××××××.org> wrote:
10 >>
11 >>> On Mon, June 11, 2012 5:27 pm, Datty wrote:
12 >>> > Hi all
13 >>> >
14 >>> > I'm looking for some help setting up traffic shaping on my internet
15 >>> > connection. I have a bit of an odd setup in that I run a remote VPN
16 >>> server
17 >>> > that all of my traffic is pushed through and out on to the internet.
18 >>> As I
19 >>> > understand generally it isn't possible to shape incoming traffic but
20 >>> as I
21 >>> > have control of the VPN server which pushes the traffic to me I
22 >>> wondered
23 >>> > if
24 >>> > it was possible to implement something on that side? No traffic other
25 >>> than
26 >>> > the VPN tunnel goes out of my home connection.
27 >>> >
28 >>> > I'm trying to do this because I have a service running on one of my
29 >>> home
30 >>> > machines that requires around 5kbps constantly with low latency
31 >>> (<200ms),
32 >>> > but as my home connection is 750kbps it gets saturated very quickly
33 >>> > causing
34 >>> > huge spikes in latency. Does anyone have any ideas as to how I could
35 >>> > achieve this? Generally any pointers at all would be greatly
36 >>> appreciated.
37 >>>
38 >>> If VPN is the only traffic to/from your home, eg. using your internet
39 >>> connection and you control the VPN-server on the other side, you could
40 >>> limit the "upstream" of the remote server to your home.
41 >>>
42 >>> > Thanks for your time
43 >>> >
44 >>> > Oliver
45 >>> >
46 >>>
47 >>>
48 >>> --
49 >>> Joost
50 >>>
51 >>>
52 >>> Thanks that makes total sense. I was looking at it backwards, not
53 >> thinking that I could apply the same upstream limit to my VPN server.
54 >> A bit of background/my aims - The vpn interface is 100mbps, I want
55 >> everybody but me on the VPN to be able to use up to that speed, but for
56 >> traffic sent to 192.168.50.0/24 to be limited to 750kbps, with 700kbps
57 >> of that for normal traffic and 50kbps for my tcp traffic from port 9999.
58 >>
59 >> Based on that do the following rules make sense?
60 >>
61 >> tc qdisc add dev tap0 root handle 1: htb default 12 -- Set the interface
62 >> to be handle 1 and default traffic to be in class 1:12
63 >> tc class add dev tap0 parent 1: classid 1:1 htb rate 100mbps ceil 100mbps
64 >> -- Set 100mbps to be available to all classes overall
65 >> tc class add dev tap0 parent 1:1 classid 1:12 htb rate 100mbps ceil
66 >> 100mbps -- Set 100mbps to be available to all people on the vpn
67 >> tc class add dev tap0 parent 1:1 classid 1:15 htb rate 750kbps ceil
68 >> 750kbps -- To be applied to all traffic from my home network
69 >> tc class add dev tap0 parent 1:15 classid 1:16 htb rate 700kbps ceil
70 >> 700kbps -- To be applied to all traffic other than special on home network
71 >> tc class add dev tap0 parent 1:15 classid 1:17 htb rate 50kbps ceil
72 >> 50kbps -- To be applied to special traffic on home network
73 >> tc qdisc add dev $modemif parent 1:15 handle 20: sfq perturb 10 -- I
74 >> understand this to prevent high bandwidth traffic in a class from filling
75 >> up the whole of the class bandwidth and allow fair sharing. Is this
76 >> right/needed?
77 >> tc qdisc add dev $modemif parent 1:12 handle 20: sfq perturb 10
78 >>
79 >> iptables -t mangle -A POSTROUTING -o tap0 -d 192.168.50.0/24 -p tcp
80 >> --sport 9999 -j CLASSIFY --set-class 1:17
81 >> iptables -t mangle -A POSTROUTING -o tap0 -d 192.168.50.4/24 -j CLASSIFY
82 >> --set-class 1:16
83 >> iptables -t mangle -A POSTROUTING -o tap0 -j CLASSIFY --set-class 1:12
84 >>
85 >>
86 >> Thanks again for your help
87 >>
88 >> Oliver
89 >>
90 >
91 Ah it is TCP at the moment. Not something I could change too easily either.
92 Is it possible to work around or is it not worth fighting with?

Replies

Subject Author
Re: [gentoo-user] Traffic shaping - downstream data Michael Mol <mikemol@×××××.com>