Forum Discussion

Craig_13855's avatar
Craig_13855
Icon for Nimbostratus rankNimbostratus
Apr 02, 2009

Redirect Traffic Based on Source Address

First of all, thanks to all you wizards out there that take the time to answer questions for us who are a little slower in the TCL world. I have found some great solutions on this site in the past but I cannot find my answer for this issue, which, to me, seems like would be straight forward.

 

 

I have 100's of clients hitting an URL which points to a VS on the BigIP. I don't want to go to each client and change the URL they go to based on what pool i want them to hit. What i would like to do is have an IRULE that states if the source subnet is subnet abc.efg OR hij.klm OR nop.qrs use this pool, otherwise (else) use this pool.

 

 

Can one of you wizards wave your wand and show me an example of how that would look?
  • I think this is what you might be looking for

     
     class myIPs {  
      host abc.efg  255.255.255.0 
      host hij.klm 255.255.255.0 
      host nop.qrs 255.255.255.0 
     }  
     

     
     when CLIENT_ACCEPTED { 
       if { [matchclass [IP::client_addr] equals $::myIPs] } { 
          pool my_pool 
      } else { 
          pool alternate 
     } 
     } 
     

    Hope this helps

    CB

  • Thanks for your quick reply. I tried that and got the following error;

     

     

    line 1: [undefined procedure: class] [class myIPs {

     

    host 10.1.0.0 255.255.0.0

     

    host 10.2.0.0 255.255.0.0

     

    }]
  • Never mind...i believe i have figured it out. I created the subnet list under the irules data group list. The irule took then.