Re: Bandwidth Limiting using HTB?

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Thanks for the reply. I guess it would be best to provide a little more detail on the problem.

I've got 100+ users. Each of these users have a particular level/speed of service. These range from 128kbit to 1024kbit. I need a way to set a limit for each user based on their level/speed of service. My initial approach was to use 2 machines set up as bridges. One would handle limiting and the other would do shaping. There are currently 2 T1s supporting this.

I did the following:

WAN_IFACE="eth0"
WAN_RATE="3mbit"

# add root qdisc
tc qdisc add dev $WAN_IFACE root handle 1: htb default 1:2

# add main link ( I assume this will slow the interface down to 3mbit? )
tc class add dev $WAN_IFACE parent 1: classid 1:1 htb rate $WAN_RATE

# typical user
tc class add dev $WAN_IFACE parent 1:1 classid 1:2 htb rate 128kbit
...

tc filter add dev $WAN_IFACE parent 1:1 protocol ip prio16 u32 match ip src 192.168.1.1 \ flowid 1:2
...


If my understanding is correct this should limit the bandwidth of ip address 192.168.1.1 to 128kbit?

Any other unclassified traffic should also be limited to 128kbit?

I'm new to this. Do the above lines look correct?

Thanks,
Gerry


Adrian Vasile wrote:


There are 2 ways:
1. as you said, each ip has its own class. this approach is used by an
ISP that I know and works great (if you have the bandwidth).
2. you classify traffic. each type with its own class (eg. http class,
ftp class and so on). here we have a (small) problem. if you have
bandwidth hogs (p2p) it is possible that they'll eat up most of the
bandwidth or other services (eg http) be confused with p2p traffic. and
all this match-making would consume some cpu.

I'm open to suggestions. which is better 1 or 2?



------------------------------------------------------------------------


Subject:
 Bandwidth Limiting using HTB?
From:
Gerry Weaver <gerryw@xxxxxxxxxxxxxx>
Date:
Sun, 23 May 2004 18:47:34 -0500
To:
lartc@xxxxxxxxxxxxxxx

To:
lartc@xxxxxxxxxxxxxxx



Hello All,



I've been playing around with HTB and reading the various lists for information on how to limit bandwidth on a particular ip or mac address. If I understand correctly, in order to use HTB for this, I would have to create a separate root class for each ip address that I wanted to limit. I have tried this and it seems to work. This seems okay for a few ips, but seems excessive for 100+ addresses. Especially if you wanted to add some interactive traffic shaping. Is this how it's done or is there a better approach?



Thanks in advance,

Gerry


_______________________________________________ LARTC mailing list / LARTC@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


-- Gerry Weaver

IT-Pro Corp.

Office: (254) 883-9040
Mobile: (512) 663-9550
Fax   : (254) 883-9041

_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux