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