Shaping weirdness

Linux Advanced Routing and Traffic Control

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

 



I've been following the HOWTO, and reading mailing list discussions
about throttling bandwidth, and have had some success, but I just want
to tie off some loose ends. Essentially what I am wanting to do is to
keep our bandwidth usage below 1megabit, because if we go over we get
charged for that traffic. I've used some of the examples from the
HOWTO to limit our bandwidth, but I find that it gets limited to
*half* what I specify. If I specify 256, bandwidth tests (using iperf)
show that things are clamped at 128, that makes me scared that I am
doing something right.

I'm using cbq, I've seen some people suggest using htb instead because
it is more reliable and easier to configure, but I thought i'd get
what the HOWTO says working first, and then investigate alternatives.

I've got a machine that sits in front of the network, has the internet
plugged into eth0 and the other side plugged into eth1, and I am doing
the following:

#!/bin/bash
LIMITDOWN=256
LIMITUP=256
DEV=eth0
DEV2=eth1

# clean up qdiscs
tc qdisc del dev $DEV root 2> /dev/null > /dev/null
tc qdisc del dev $DEV2 root 2> /dev/null > /dev/null

# limit up- and downlink
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit
tc qdisc add dev $DEV2 root handle 2: cbq avpkt 1000 bandwidth 100mbit

tc class add dev $DEV parent 1: classid 1:1 cbq rate ${LIMITDOWN}kbit \
        allot 1500 prio 5 bounded isolated
tc class add dev $DEV2 parent 2: classid 2:1 cbq rate ${LIMITDOWN}kbit \
        allot 1500 prio 5 bounded isolated

tc class add dev $DEV parent 1: classid 1:2 cbq rate ${LIMITUP}kbit \
        allot 1500 prio 5 avpkt 1000
tc class add dev $DEV2 parent 2: classid 2:2 cbq rate ${LIMITUP}kbit \
        allot 1500 prio 5 avpkt 1000

tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst \
        0.0.0.0/0 flowid 1:1
tc filter add dev $DEV2 parent 2: protocol ip prio 16 u32 match ip dst \
        0.0.0.0/0 flowid 2:1

tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip src \
        0.0.0.0/0 flowid 1:2
tc filter add dev $DEV2 parent 2: protocol ip prio 16 u32 match ip src \
        0.0.0.0/0 flowid 2:2

tc qdisc add dev $DEV parent 1:1 sfq perturb 10
tc qdisc add dev $DEV parent 1:2 sfq perturb 10

tc qdisc add dev $DEV2 parent 2:1 sfq perturb 10
tc qdisc add dev $DEV2 parent 2:2 sfq perturb 10
_______________________________________________
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