Please check that this bandwidth-limiting solution makes sense

Linux Advanced Routing and Traffic Control

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

 



I've done the follwing, for my ISP where all connections
are either 512k, 1Mbit or 2Mbit, but we sell accounts
as little as 128kb.

This perl script generates the bulk of my rate shaping setup.
The whole /24 subnet gets filters attached, but customers actuall
only range from 17 to 254.

#! /usr/bin/perl

my $i;
my $tc = '/sbin/tc';

print "$tc qdisc add dev eth0.10 root handle 1: htb default 0\n";
print "$tc filter add dev eth0.10 parent 1: prio 5 protocol ip u32\n";
print "$tc filter add dev eth0.10 parent 1: prio 5 handle 2: protocol ip u32 divisor 256\n";

for $i (1 .. 254) {
#for $i (165 .. 165) {
        printf "$tc filter add dev eth0.10 protocol ip parent 1: prio 5 u32 match ip dst 0/0 ht 2:%x: flowid 1:%d\n", $i, $i;
}

print "$tc filter add dev eth0.10 protocol ip parent 1: prio 5 u32 ht 800:: match ip dst {customer-subnet}/24 hashkey mask 0x000000ff at 12 link 2:\n";

Then when each customer dials in, our RADIUS server calls
the following with $1 as their IP address, and $2 as the kbits of
speed they are allowed:

#! /bin/bash
CLASS=`echo $1 | /usr/bin/cut -d. -f 4-`
if [ $# -eq 2 ]; then
        sudo /sbin/tc class del dev eth0.10 parent 1: classid 1:$CLASS || true
        sudo /sbin/tc class add dev eth0.10 parent 1: classid 1:$CLASS htb rate $2kbit || true
fi

The other problem is that some customers are killing the speed for
others using P2P software, I'm considering using the IMQ device
to prioritise and/or rate shape (using l7-filter from
http://l7-filter.sourceforge.net/ if neccessary) them away from
interfering with WWW/SMTP/POP etc support.

I'm also using the ADSL wonder-shaper on the uplink channel,
since I suspect ACKs are being drowned out at peak times.

I'd appreciate any advice or thoughts here, as I've read the
LARTC HOWTO a couple of times, and I _think_ I get it. I'd like
a little more surety than that though.

Thankyou very much!

--
=========================================================
Paul "TBBle" Hampson
Bubblesworth Pty Ltd (ABN: 51 095 284 361)
Paul.Hampson@xxxxxxxxx

On a sidewalk near Portland State
University someone wrote `Trust Jesus', and
someone else wrote `But Cut the Cards'.
---------------------------------------------------------
Random signature generator 3.0 by Paul "TBBle" Hampson
=========================================================

_______________________________________________
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