Re: traffic shaping with tc

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

 



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?
-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html


-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux