Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] Traffic shaping - downstream data Datty <datty.wtb@×××××.com>