Forum Discussion

Reginald_Sible1's avatar
Reginald_Sible1
Icon for Nimbostratus rankNimbostratus
Nov 19, 2014

iRule Source IP Re-direct to a different pool

What would be the right recommended way to Assign a custom iRule called els-es-clinicalpharmacology-ip-HCA, to be assign to these VIPs

 

virtual els-es-clinicalpharmacology_ip.com-443 virtual els-es-clinicalpharmacology_ip.com-80

 

This iRule will cause any traffic sourced from IPs in the Network group els-es-clinicalpharmacology-ip-HCA to be diverted from the original pool to the –HCA pool.

 

these are the IP's

 

165.214.11.0/24 165.214.12.0/24 165.214.4.0/24 165.214.14.0/24​

 

Please help!!!

 

3 Replies

  • Create an IRule data group list els-es-clinicalpharmacology-ip-HCA and place the ips as networks in it.

     

    Then create an irule as follows, replacing HCP_pool and Orginial_pool with your specific pool names.

     

    when CLIENT_ACCEPTED { if { [class match [IP::remote_addr] equals els-es-clinicalpharmacology-ip-HCA] } { pool HCA_pool } else { pool Original_pool } }

     

  • Brian thank so much. below is what I think you were saying but how would it look using a whole IP range. And how would port 443 be recognized

     

    when CLIENT_ACCEPTED { if { [class match [IP::165.214.11.0/24] equals els-es-clinicalpharmacology-ip-HCA] } { pool els-es-clinicalpharmacology-ip-HCA-http-80 } else { pool els-es-clinicalpharmacology-ip-http-80 } }

     

    I also have 198.185.18.0/24 Did I specify the subnet mask correctly?

     

  • In the Irule above remote_addr is not something you would change. It needs to stay in the Irule just like it reads. You add the 4 networks into the Irule data group list, not the irule itself.

     

    The port will be recognized based on what the virtual server and pools members are configured for. There is no configuration in the Irule for the port.

     

    I'll post some screenshots of where I've used this if you want.