Forum Discussion

schmal_111133's avatar
schmal_111133
Icon for Nimbostratus rankNimbostratus
Nov 22, 2012

How I can do shaping based on client IP?

Hi,

 

I need to do shaping to subscribers that browsing through my F5 LTM, for .

 

The task is to shape each client to 512 Kbps, for all my researching here I found only way to do shape for all the subscribers together.

 

The best idea that I have for now is to create 254 rate classes and implement the irule below:

 

 

when CLIENT_ACCEPTED {

 

set octets [split [IP::client_addr] "."]

 

set rclass [concat class[lindex $octets end]]

 

log local0. "[IP::client_addr] being sent to rateclass $rclass ---- $octets ---- [lindex $octets end]"

 

rateclass $rclass

 

}

 

 

But still this is not a solution since I relay here on the last octet of IP address and I need to do shaping each client/connection separately.

 

 

Do you guys have any idea how to implement the above?

 

 

Many Thanks.

 

2 Replies

  • Hi schmal,

     

     

    There are several discussions requesting this same type of functionality (I would suggest opening up a case with F5 for a feature request addition to the RateClass ability to give you the option to make it per client or per Virtual Server since having the option would be a nice feature and several people seem to want it).

     

     

    One discussion you may find interesting is here: Limit traffic per client ip?.

     

     

    Perhaps you could create a RateClass for the subnets that you want to restrict at the maximum amount of bandwith that you want that block of IP Addresses to have and assign it dynamically with a combination of the example on the RateClass and a Data Group (Class) that contains a list of all of the Subnets that you want restricted.

     

     

    If you are wanting to take a more granular approach to police the individual clients that are assigned to this RateClass you could do that using another iRule that you could also incorporate.

     

     

    Simple traffic shaping

     

     

    Hope this helps.

     

  • Hi Michael,

     

    Thanks for the reply.

     

    the case is the following, I have thousands of users that browsing through my system, I have a server that receive all the traffic and based on if this user finished his quota my server redirect it to the F5, and based on that I need to shape this user traffic to be 512 Kbps.

     

     

    the thing here is that I have no idea what is the user subnet (I have thousands of users) and the maximum that I can do is create predefined 254 rate class and based on the last ocetet assign the user to the rate class, bus still this solution not provide me a security that each user that finished the quota will receive 512 Kbps.

     

     

    There is any way to configure rate class dynamically and automatically on real time (based on the user IP)? I think for now that this is the only way to accomplish what I need.

     

     

    Thanks.