RE: TC Hashing Filters

Linux Advanced Routing and Traffic Control

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

 



	Gideon was an incredible help with all of this. He solved my
little problem I was having. It was such a simple solution and I
completely missed it. You see, when I changed the src to dst (which is
what I'm trying to accomplish because I'm shaping the download rates of
our customers, not upload rates) I forgot that in the IP Header, bit 12
is the source address. Since I was shaping incoming traffic, I want the
destination IP. Gideon was so kind to point this out to me. I knew it
was something very small and obvious...

	So, here are the completed commands that work great for anyone
who is attempting to do this themselves. I will also post to this list
with this same subject the link to the How To as soon as I get it
created.

# Delete current qdisc wiping the slate clean
tc qdisc del dev eth1 root

# Create root qdisc
tc qdisc add dev eth1 root handle 1: cbq bandwidth 200Mbit avpkt 1000

# Create "transit class"
tc class add dev eth1 parent 1: classid 1:2 cbq bandwidth 200Mbit rate
200MBit allot 1514 weight 2Mbit prio 8 maxburst 20 avpkt 1000

# Create hash tables (256)
tc filter add dev eth1 parent 1: handle 2: protocol ip u32 divisor 256

# Create hash filter to separate traffic going TO 216.19.49.0/24 using
the last octet
tc filter add dev eth1 protocol ip parent 1: u32 match ip dst
216.19.49.0/24 hashkey mask 0x000000ff at 16 link 2:

# Create the 128Kbit class for limiting
tc class add dev eth1 parent 1: classid 1:3 cbq bandwidth 200Mbit rate
128Kbit allot 1514 prio 5 maxburst 20 avpkt 1000 bounded

# Filter per IP into the hash tables
tc filter add dev eth1 protocol ip parent 1: u32 ht 2:8c: match ip dst
216.19.49.140 flowid 1:3

(Note: The last filter will need to be done for each IP you want to
limit. Also note that you can create multiple classes for different
rates you would like to limit. You'll just need to point the last
filter's flowid to that class)

Thanks, once again, to everyone for their help and the pointing out of
my obvious mistakes. If anyone has any questions about how to do this or
anything, please feel free to ask. I'll answer to the best of my
abilities.

Adam Towarnyckyj

_______________________________________________
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