Hi all,
I am a newbie and I have not played a lot with tc utility. I have red maybe
everything that has to do with massive filtering (maybe not everything). If you
can help me on this I would appriciate that very much. I use tc utility with
iproute2-ss040831.
I want to limit bandwidth for the 192.168.0.0/16 subnet using this script.
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:2 htb rate 100Mbit ceil 100MBit
tc filter add dev eth0 parent 1:2 handle 2: protocol ip u32 divisor 256
tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.0/16
hashkey mask 0x000000ff at 12 link 2:
tc class add dev eth0 parent 1:2 classid 1:3 htb rate 128Kbit ceil 128Kbit
j=0;
while [ $j -le 254 ]
do
i=0;
while [ $i -le 254 ]
do
hexi=`echo "obase=16; $i" | bc`
tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi:
match ip dst 192.168.$j.$i flowid 1:3
i=$((i+1))
done
j=$((j+1))
done
somewhere at 192.168.8.7/32 it appears on the screen this message
RTNETLINK answers: File exists
We have an error talking to the kernel
Can you tell me please what am I doing wrong.
Thank you in advance
Valton
On Wed, Jan 12, 2005 at 01:27:18PM +0100, Valton Hashani wrote:> Hi all, > I am a newbie and I have not played a lot with tc utility. I have red maybe everything that has to do with massive filtering (maybe not everything). If you can help me on this I would appriciate that very much. I use tc utility with iproute2-ss040831. > I want to limit bandwidth for the 192.168.0.0/16 subnet using this script. > > > tc qdisc del dev eth0 root > tc qdisc add dev eth0 root handle 1: htb > tc class add dev eth0 parent 1: classid 1:2 htb rate 100Mbit ceil 100MBit > tc filter add dev eth0 parent 1:2 handle 2: protocol ip u32 divisor 256 > tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.0/16 hashkey mask 0x000000ff at 12 link 2:change to: tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.0/24 hashkey mask 0x000000ff at 16 link 2:> tc class add dev eth0 parent 1:2 classid 1:3 htb rate 128Kbit ceil 128Kbit > > j=0; > > while [ $j -le 254 ] > > do > i=0; > > while [ $i -le 254 ] > do > hexi=`echo "obase=16; $i" | bc`add hiere: echo tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi: match ip dst 192.168.$j.$i flowid 1:3 and show us results.> tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi: match ip dst 192.168.$j.$i flowid 1:3 > i=$((i+1)) > done > > j=$((j+1)) > done > > somewhere at 192.168.8.7/32 it appears on the screen this message > > RTNETLINK answers: File exists > We have an error talking to the kernel > > Can you tell me please what am I doing wrong.-- Tomasz Paszkowski
Hi,
with a Tomasz suggestions I tried with the setup below but it appears at the
same place, the same error.
RTNETLINK answers: File exists
We have an error talking to the kernel
Is there any other way?
Regards,
Valton
-------------------------
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:2 htb rate 100Mbit ceil 100MBit
tc filter add dev eth0 parent 1:2 handle 2: protocol ip u32 divisor 256
#tc filter add dev eth0 protocol ip parent 1: u32 match ip dst
192.168.0.0/16 hashkey mask 0x000000ff at 12 link 2:
tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.0/24
hashkey mask 0x000000ff at 16 link 2:
tc class add dev eth0 parent 1:2 classid 1:3 htb rate 128Kbit ceil 128Kbit
j=0;
while [ $j -le 254 ]
do
i=0;
while [ $i -le 254 ]
do
hexi=`echo "obase=16; $i" | bc`
echo tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi:
match ip dst 192.168.$j.$i flowid 1:3
tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi: match
ip dst 192.168.$j.$i flowid 1:3
i=$((i+1))
done
j=$((j+1))
done
----- Original Message -----
From: "Tomasz Paszkowski" <tomasz.paszkowski@e-wro.pl>
To: "Valton Hashani" <valton@ipko.net>
Cc: <lartc@mailman.ds9a.nl>
Sent: Wednesday, January 12, 2005 2:11 PM
Subject: Re: [LARTC] hashing filters
On Wed, Jan 12, 2005 at 01:27:18PM +0100, Valton Hashani
wrote:> Hi all,
> I am a newbie and I have not played a lot with tc utility. I have red
maybe everything that has to do with massive filtering (maybe not
everything). If you can help me on this I would appriciate that very much. I
use tc utility with iproute2-ss040831.> I want to limit bandwidth for the 192.168.0.0/16 subnet using this
script.>
>
> tc qdisc del dev eth0 root
> tc qdisc add dev eth0 root handle 1: htb
> tc class add dev eth0 parent 1: classid 1:2 htb rate 100Mbit ceil 100MBit
> tc filter add dev eth0 parent 1:2 handle 2: protocol ip u32 divisor 256
> tc filter add dev eth0 protocol ip parent 1: u32 match ip dst
192.168.0.0/16 hashkey mask 0x000000ff at 12 link 2:
change to:
tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.0/24
hashkey mask 0x000000ff at 16 link 2:> tc class add dev eth0 parent 1:2 classid 1:3 htb rate 128Kbit ceil
128Kbit>
> j=0;
>
> while [ $j -le 254 ]
>
> do
> i=0;
>
> while [ $i -le 254 ]
> do
> hexi=`echo "obase=16; $i" | bc`
add hiere:
echo tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi: match
ip dst 192.168.$j.$i flowid 1:3
and show us results.> tc filter add dev eth0 protocol ip parent 1:2 u32 ht
2:$hexi: match ip dst 192.168.$j.$i flowid 1:3> i=$((i+1))
> done
>
> j=$((j+1))
> done
>
> somewhere at 192.168.8.7/32 it appears on the screen this message
>
> RTNETLINK answers: File exists
> We have an error talking to the kernel
>
> Can you tell me please what am I doing wrong.
--
Tomasz Paszkowski
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
On Wed, Jan 12, 2005 at 07:08:03PM +0100, Valton Hashani wrote: change te script to: i=0; while [ $i -le 254 ] do hexi=`echo "obase=16; $i" | bc` tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi: match ip dst 192.168.$j.$i flowid 1:3 i=$((i+1)) done connected with modifications from previous mail it should work. -- Tomasz Paszkowski Administrator Miejskie Sieci Informatyczne e-wro http://www.e-wro.pl
On Wed, Jan 12, 2005 at 07:08:03PM +0100, Valton Hashani wrote:> j=0; > > while [ $j -le 254 ] > > do > i=0; > > while [ $i -le 254 ] > do > hexi=`echo "obase=16; $i" | bc` > echo tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:$hexi: > match ip dst 192.168.$j.$i flowid 1:3 > tc filter add dev eth0 protocol ip parent 1:2 u32 ht $j:$hexi match > ip dst 192.168.$j.$i flowid 1:3 > i=$((i+1)) > done > > j=$((j+1)) > done