• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

HTB dynamic configuration

Lets have this example:

10 users sharing 1Mbit connection to Internet.
I want an example configuration of HTB (using tc) to implement this task:
When one user is downloading it must use the whole bandwidth, when there are two users they must share the link equally (500Kbit each) and so on.
0
CyberGod
Asked:
CyberGod
  • 2
1 Solution
 
mbarbosCommented:
Here is the manual. the example is a little bit more complicated than you requested, but I hope it'll do.

If there is anything unclear, please say so.
0
 
mbarbosCommented:
0
 
GilmorCommented:
Here is my litle sample, but better is use htb.init
http://sourceforge.net/projects/htbinit

This sample is only for one way (download/upload). for both way is need this apply to other interface.

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1 htb default 999

tc class add dev eth1 parent 1: classid 1:2 htb rate 1024Kbit ceil 1024Kbit

tc class add dev eth1 parent 1:2 classid 1:10 htb rate 100Kbit ceil 1024Kbit burst 2K
tc qdisc add dev eth1 parent 1:10 handle 10 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip dst 10.10.10.10 classid 1:10

tc class add dev eth1 parent 1:2 classid 1:11 htb rate 100Kbit ceil 1024Kbit burst 2K
tc qdisc add dev eth1 parent 1:11 handle 11 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip dst 10.10.10.11 classid 1:11

tc class add dev eth1 parent 1:2 classid 1:12 htb rate 100Kbit ceil 1024Kbit burst 2K
tc qdisc add dev eth1 parent 1:12 handle 12 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip dst 10.10.10.12 classid 1:12

.
.
.
.

tc class add dev eth1 parent 1:2 classid 1:20 htb rate 100Kbit ceil 1024Kbit burst 2K
tc qdisc add dev eth1 parent 1:20 handle 20 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip dst 10.10.10.20 classid 1:20


tc class add dev eth1 parent 1:2 classid 1:999 htb rate 32Kbit burst 2K
tc qdisc add dev eth1 parent 1:999 handle 999 sfq perturb 10
0
 
CleanupPingCommented:
CyberGod:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now