linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* traffic shaping with tc
@ 2005-02-23  8:58 urgrue
  2005-02-23 17:30 ` Andreas Unterkircher
  0 siblings, 1 reply; 2+ messages in thread
From: urgrue @ 2005-02-23  8:58 UTC (permalink / raw)
  To: admin

is there some neat way to restrict each user to a certain amount of 
bandwidth? instead of the usual setup of restricting them all to a 
certain _shared_ bandwidth?
for example, i have 200 users on my network and i want _each_ to get 
only 512kbps.
in my limited understanding of tc this would normally mean creating 200 
queues of 512kbps and piping each individual IP to its own queue.
isnt there some saner way to do this?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: traffic shaping with tc
  2005-02-23  8:58 traffic shaping with tc urgrue
@ 2005-02-23 17:30 ` Andreas Unterkircher
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Unterkircher @ 2005-02-23 17:30 UTC (permalink / raw)
  To: admin; +Cc: urgrue

does this mean you have an 100mbit connection (200*512) or the complete 
user-traffic from your LAN to internet should not be much more then 
512kbit? :)

if all your clients are for example on the same network (ex. 
172.16.0.0/16), you can make this with tcng like this:

#include "fields.tc"
#include "ports.tc"

dev eth0 {
        egress {
                class ( <$only512> )    if ip_src == 172.16.0.0;

                htb () {
                        class ( rate 768kbps, ceil 768kbps ) {
                                $only512 = class ( rate 512kbps, ceil 
512kbps ) { sfq; } ;
                        }
                }
        }
}

the tc rules:

tc qdisc del dev eth0 root

# ================================ Device eth0 
================================

tc qdisc add dev eth0 handle 1:0 root dsmark indices 2 default_index 0
tc qdisc add dev eth0 handle 2:0 parent 1:0 htb
tc class add dev eth0 parent 2:0 classid 2:1 htb rate 96000bps ceil 96000bps
tc class add dev eth0 parent 2:1 classid 2:2 htb rate 64000bps ceil 64000bps
tc qdisc add dev eth0 handle 3:0 parent 2:2 sfq
tc filter add dev eth0 parent 2:0 protocol all prio 1 tcindex mask 0x1 
shift 0
tc filter add dev eth0 parent 2:0 protocol all prio 1 handle 1 tcindex 
classid 2:2
tc filter add dev eth0 parent 1:0 protocol all prio 1 u32 match u32 
0xac100000 0xffffffff at 12 classid 1:1







urgrue wrote:

> is there some neat way to restrict each user to a certain amount of 
> bandwidth? instead of the usual setup of restricting them all to a 
> certain _shared_ bandwidth?
> for example, i have 200 users on my network and i want _each_ to get 
> only 512kbps.
> in my limited understanding of tc this would normally mean creating 
> 200 queues of 512kbps and piping each individual IP to its own queue.
> isnt there some saner way to do this?
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-23 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-23  8:58 traffic shaping with tc urgrue
2005-02-23 17:30 ` Andreas Unterkircher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).