Gentoo Archives: gentoo-user

From: Norberto Bensa <nbensa@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Rate limiting TCP connections...
Date: Mon, 18 Aug 2008 14:48:35
Message-Id: 20080818114825.cpkq29aym84c0s8o@mail.bensa.ar
In Reply to: Re: [gentoo-user] Rate limiting TCP connections... by gentoo_steve@shic.co.uk
1 Quoting gentoo_steve@×××××××.uk:
2
3 > Norberto Bensa wrote:
4 >> Ah!! But Windows (XP) uses TC by default. It doesn't use 20% of the
5 >> network bandwidth unless you tweak some registry setting and/or
6 >> disable QoS in network properties.
7 > That sounds like a fine plan for me...
8
9 which one? remove qos from windows? nope. that would just overload
10 your router.
11
12 > but, erm, how does it know? Both
13 > Linux and Xp talk to my router at 100mbps - and my router talks to the
14 > outside world at 0.5mbps...
15
16 That's the problem. It's common, don't worry. You just need to control
17 how much and in which order packages are delivered to your router so
18 it doesn't have to decide how to route traffic (its queue is not that
19 intelligent.) It's all explained in "latrc" which I recommend you to
20 read.
21
22
23 > so, while I'd be entirely happy to cap both
24 > machines at 80mbps, I don't see why this would have any effect on the
25 > competition for the 0.5mbps to the outside world.
26
27 Yes. My iptables example was toooooo aggresive, I know. It was just an
28 example. You can modify it like this:
29
30 iptables -I INPUT -i lo -j ACCEPT
31 iptables -I INPUT -s 192.168.0.0/24 -j ACCEPT
32 iptables -I INPUT -p tcp -m limit --limit 50/sec -j ACCEPT
33 iptables -I INPUT -p tcp -j DROP
34
35 The first one takes care of localhost. You don't want to limit traffic
36 on that interface :)
37
38 The seccond one permits everything from the local network (change
39 192.168.0.0/24 for the rights values for your local/home network)
40
41 Third and fourth are the same rules I posted before.
42
43 With those rules you'll get full speed on the local network and 50
44 packets per second on everything else (internet.)
45
46
47 > What's more to the point, it doesn't seem to be Linux competing with
48 > Xp, per se - but rather Linux competing with Linux - since my LAN works
49 > great - and I can communicate at will between Xp and Linux - it is only
50 > when Linux's bind competes with Linux's wget that I see a problem.
51 > This is with two processes on the same PC.
52
53 wget and bind compete for internet access. wget is eating all the
54 bandwidth and bind doesn't have a chance. Do you have "forward first"
55 in named.conf? If it is, comment it; it will help a bit.
56
57
58 >> try a --limit-rate (or --rate-limit; I can't never get it right) in wget.
59 > I presume this is what you mean (taken from "man iptables"):
60
61 nope. wget's --limit-rate.
62
63
64 > This looks as if I can limit the rate at which my linux box talks on my
65 > LAN - but this isn't what I need to do. Interestingly, long downloads
66 > from two competing WinXp boxes don't cause a problem - but both will
67 > max-out my available download capacity... suggesting to me that fixed
68 > rate-limiting is not what is called for...
69
70 Nope. "fixed rate limiting" is not the answer. You need QoS at the
71 router level, but if it doesn't support it, you'll need to change how
72 your Linux box talks and listen to internet packages. That's what I
73 said -more or less- on my first reply.
74
75 Let's make an experiment:
76
77 1. Terminate all downloads and activity on the internet.
78 2. Restart your bind (so it flushes its cache)
79 3. in XP1 download something huge (an ISO image) from one souce in the
80 internet and wait 'til it is at full speed (does it go up to 0.5Mb??)
81 4. in XP2 start to ping different sources. Does XP2 lost packets?
82
83 Regards,
84 Norberto
85
86 ----------------------------------------------------------------
87 This message was sent using IMP, the Internet Messaging Program.

Replies

Subject Author
Re: [gentoo-user] Rate limiting TCP connections... gentoo_steve@×××××××.uk