1

I'm new to using tc/htb and I've just copy/pasted the script at ...

http://lartc.org/howto/lartc.cookbook.ultimate-tc.html

... to run on the office gateway. The reason is to prevent large downloads, uploads, p2p and videos from making SSH connections and web browsing too slow. The network looks like:

LAN -> (eth0) linux gateway (eth1) -> DSL modem

The gateway also does NAT for LAN clients.

At the top of the script you set your uplink and downlink speeds (in kilobits) and the device. Our ADSL is 1.5m DL / 256k UL. So I've set the values as follows:

DOWNLINK=1000
UPLINK=220
DEV=eth1

All I know for sure is these values are supposed to be 'somewhat' less than the full DSL bandwidth but I don't know how to calculate an optimal value. I assume if the value is too low I'm going to overly restrict the total throughput and if it's too high I'm going to prevent proper queuing.

My question is: What tools, rules of thumb or calculations do I use find the optimal values for the rate parameter?

SpliFF
  • 394
  • 2
  • 8
  • 24

1 Answers1

0

I implemented tc last week using that same script as a base.

(some of this advice is specific to that script)

For starters, it says it's set to 90 for his line uprate of 128. my uprate is 320, which is 2.5 times more, so i started with it being 90*2.5 = 225. I ended up with it at 240 or 260 i think, but it works pretty well.

One thing i didn't allow for that may be an issue for you also is that the script limits based on $DEV, but my machine only had one interface so it also limited lan traffic. To fix that i stopped pool 26 (slowest) being the default catch-all class (remove the word "default") and put a final rule in that anything outbound that's not with a destination of my lan subnet should be class 26.

In my case i also removed all the downstream rate limiting lines of code, because the only large downstream i do is torrents and it's limited on the client application anyhow. It makes the whole script a lot more manageable to understand and in my use case still works great. Besides, the webpage itself says that you can only really throttle the upload speed with any real certainty.

In my case it was uploads of 75% of my bandwidth would lower my download speed to a fraction of its full speed, and things like remote ssh in would be unusable. Its all fixed now and im pretty happy with it tbh.

Hope that helps.

edit: Oh, and i also removed the mtu 1000 line, because the interface in my case also carries gigabit lan traffic.

Sirex
  • 5,499
  • 2
  • 33
  • 54
  • Trouble is I don't know what rationale the script author used to come up with that value. It might be optimised for aspects of his setup or it might be plucked from a tutorial or guessed. It may not even be a fraction of the total as you have assumed but a fixed Kb window that stays constant as the line speed changes. If I'm going to use a rule-of-thumb I'd at least like to know why. I appreciate the case-study but I'm looking for a more scientific answer. – SpliFF Sep 15 '11 at 23:12
  • i suspect "suck it and see" is about as scientific as your going to get when variable rate bandwidth lines are concerned. What's best for me may not be best for you when the neighbours all start using the net. Tweak it a bit and see how it works out. So far its been really good here though, wouldn't go back to before. – Sirex Sep 16 '11 at 20:52