Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: "Matias Bjørling" <mb@nerdit.dk>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Hashing filters
Date: Wed, 14 May 2003 23:07:23 +0000	[thread overview]
Message-ID: <marc-lartc-105295431307473@msgid-missing> (raw)
In-Reply-To: <marc-lartc-105286793520703@msgid-missing>

Hey :) I have a few questions if you have a min :)

----- Original Message ----- 
From: "Gideon le Grange" <gideon@adept.co.za>
To: "Matias Bjørling" <mb@nerdit.dk>
Cc: <lartc@mailman.ds9a.nl>
Sent: Wednesday, May 14, 2003 8:05 AM
Subject: Re: [LARTC] Hashing filters


I have set this up using the information in
http://lartc.org/howto/lartc.adv-filter.hashing.html and it works
perfectly.How you design your rules depends on how you want to filter,
so it is a bit difficult to supply you with a better example. Do you
wish to filter per IP address? If so, I can help you:

# add htb as root queueing discipline for device. This is done once
tc qdisc add dev eth0 root handle 1: htb

# add a class with a 100Mbit rate. This is a 'transit' class, it does
# not do any shaping, you will see down below why we need it.
tc class add dev eth0 parent 1: classid 1:2 htb  rate 100MBit ceil
100MBit burst 0Kbit

# I create a hash table with 256 slots, call it 2: and attach it to 1:2
# which is my 'transit' class above
tc filter add dev eth0 parent 1:2 handle 2: protocol ip u32 divisor 256
# Classify packets matching 192.168.4.0/24 using the last byte of the
# IP address as index into the hash
tc filter add dev eth0 protocol ip parent 1: u32 match ip src
192.168.4.0/24 hashkey mask 0x000000ff at 12 link 2:

        Do i need to specify one for every subnet im going to do?
        Like 10.0.1.0, 10.0.2.0 and so on ? :)

# The bit below happens for each distinct traffic class. Multiple IP
# addresses can map into the same end class, but you can have one class
# per IP address. In the example, 192.168.4.100 gets sent to a class
# that shapes it down to 64Kbit. The class has it's own htb qdisc, but
# The experts may know better here

# add class for network 192.168.4.100/32
tc class add dev eth0 parent 1:2 classid 1:3 htb  rate 64Kbit ceil
64Kbit burst 0Kbit

        Do i need to add a class for every host on one of the subnets?

# Filters to allocate packets for 192.168.4.100/32
# Now this is the trickier bit. I only map one IP into class 1:3, and
# here is where. I attach a filter to hash table 2 slot 0x64 to map to
# class 1:3. NOTE: 64 is hex, means 100 decimal which matches IP .100
tc filter add dev eth0 protocol ip parent 1:2 u32 ht 2:64: match ip src
192.168.4.100 flowid 1:3

        When i have made 254 lines of thoes, then every "host" have 64kbit
each they can use until the         root bandwidth have been used?, am i
right?

        Why is it then that i only need one class of 192.168.4.100?, and not
for all the other hosts?

This is not perfect, and the average number of evaluations is n/2 + 1
where n is the number of class C networks. So on 4000 addresses you are
looking at 16/2 + 1 = approx 9 evaluations vs n/2 = 2000 on your current
setup (4000 = 16 class C)

Gideon

        Thank you for your time :)

On Wed, 2003-05-14 at 01:17, Matias Bjørling wrote:
> Hey
>
> A wise man said to me that Hashing filters was my solution to rock the
> world, and making my life alot easier. When applying 4000 rules, the
system
> had to check them all for match. But with hassing it would only require
1-2
> checks.
>
> Even though when i had read the lartc on the subject i was no less that a
> question mark.
>
> If anyone have played with it, and have a working, logic configuration and
> can tell me how it works and why i would be greatly grateful.
>
> Regards
>
> Matias Bjørling

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  parent reply	other threads:[~2003-05-14 23:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-13 23:17 [LARTC] Hashing filters Matias Bjørling
2003-05-14  6:05 ` Gideon le Grange
2003-05-14 23:07 ` Matias Bjørling [this message]
2003-05-24 17:01 ` [LARTC] Hashing Filters Matias Bjørling
2005-01-12 12:27 ` [LARTC] hashing filters Valton Hashani
2005-01-12 13:11 ` Tomasz Paszkowski
2005-01-12 18:08 ` Valton Hashani
2005-01-13  9:06 ` Tomasz Paszkowski
2005-01-14 10:21 ` Tomasz Paszkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-105295431307473@msgid-missing \
    --to=mb@nerdit.dk \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox