RE: TC Hashing Filters

Linux Advanced Routing and Traffic Control

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

 



The reason I asked about if you were doing this for an ISP is that I worte an app to
 track IP's and the bandwidths associated with them,  and it will generate the TC
commands for you.  It uses HTB though.

Adam Towarnyckyj (adamt@xxxxxxxxxxxxx) wrote:
>
>zoop@xxxxxxxxxxx wrote:
>>>	# Create filter to hash out last octet and link to hash table 2:
>>>	tc filter add dev eth1 protocol ip parent 1:1 prio 5 u32 ht
>>>800:: match ip src 216.19.49.0/24 hashkey mask 0x000000ff at 12 link
>2:
>>
>>
>>I think this needs to be attached to the root.
>>parent 1:0
>
>Catalin BOIE (util@xxxxxxxxxxxxxxx) wrote:
>>> 	# Create root qdisc
>>> 	tc qdisc add dev eth1 root handle 1:0 cbq bandwidth 200Mbit
>avpkt 1000
>>> 	# Create a "transit class"
>>> 	tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth
>200Mbit
>>> rate 200Mbit allot 1514 weight 2Mbit prio 8 maxburst 10 avpkt 1000
>>> 	# Create hash table attached to transit class
>>> 	tc filter add dev eth1 parent 1:0 handle 2: protocol ip u32
>divisor 256
>>> 	# Create filter to hash out last octet and link to hash table 2:
>>> 	tc filter add dev eth1 protocol ip parent 1:1 prio 5 u32 ht
>>> 800:: match ip src 216.19.49.0/24 hashkey mask 0x000000ff at 12 link
>2:
>>> 	# Create class for 128Kbit limit
>>> 	tc class add dev eth1 parent 1:0 classid 1:2 cbq bandwidth
>>
>>I think here is parent 1:1, right?
>>
>>> 200Mbit rate 128kbit allot 1514 prio 5 maxburst 20 avpkt 1000 bounded
>>> 	# Create filter for IP I'm limiting
>>> 	tc filter add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 2:8c
>
>>> match ip src 216.19.49.140 flowid 1:2
>
>
>	I have tried both of your suggestions and it is still allowing
>all traffic to pass through. Thank you for the help though. Here is what
>I have now:
>
># Create root qdisc
>tc qdisc add dev eth1 root handle 1:0 cbq bandwidth 200Mbit avpkt 1000
>
># Create transit class
>tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 200Mbit rate
>200Mbit allot 1514 weight 2Mbit prio 8 maxburst 10 avpkt 1000
>
># Create hash table and attach to transit class
>tc filter add dev eth1 parent 1:1 handle 2: protocol ip u32 divisor 256
>
># Create filter to hash out last octet and link to hash table 2:
>tc filter add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 800:: match
>ip src 216.19.49.0/24 hashkey mask 0x000000ff at 12 link 2:
>
># Create class for 128Kbit limit
>tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 200Mbit rate
>128kbit allot 1514 prio 5 maxburst 20 avpkt 1000 bounded
>
># Create filter for IP I'm limiting
>tc filter add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 2:8c match
>ip src 216.19.49.140 flowid 1:2
>
>	If anyone can still see anything I'm doing wrong, I'd appreciate
>it if you pointed it out. I've tried many different scenarios with
>different parents and they still don't work. And as for the question
>earlier about if I was doing this for an ISP, yes I am. If you would
>like some help, and if I can get this to work, I plan on writing a How
>To and posting it to a website so people can easily set this up
>themselves. I find the lack of documentation on the subject quite
>frustrating at times. Thanks all for your help.
>
>Adam Towarnyckyj
>
>_______________________________________________
>LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
>http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>

--
When dealing with a slow pipe, never underestimate the throughput of the postal system.


_______________________________________________
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