Forum Discussion

Fawad_29089's avatar
Fawad_29089
Icon for Nimbostratus rankNimbostratus
Jun 04, 2013

irule based on source ip not working..plz help!

I am running LTM v 11.1. I am defining irule based on source IP address to select a specific pool. I am getting some syntax and not supported command like error messages for the first few lines. The error message is probably for the class i created. Can somebody help with this!

 

 

class ip_subnets_class {

 

{

 

network 120.36.32.0 mask 255.255.240.0

 

network 172.20.0.0 mask 255.255.0.0

 

network 172.31.0.0 mask 255.255.0.0

 

network 149.2.0.0 mask 255.255.0.0

 

network 149.237.0.0 mask 255.255.0.0

 

}

 

}

 

when HTTP_REQUEST {

 

if { [matchclass [IP::client_addr] contains ip_subnets_class }

 

 

{ pool VDI_TEST_pool

 

 

} else { pool VDI_TEST_POOL_INT}

 

 

}

 

6 Replies

  • Can you try this and reply back with the specific error messages you see when trying to save the iRule?

    
    when CLIENT_ACCEPTED {
       if { [class match [IP::client_addr] equals ip_subnets_class] }{
        pool VDI_TEST_pool
      } else {
        pool VDI_TEST_POOL_INT
      }
    }
    

    Aaron

  • I tried what you suggest with class and got following message :

     

    01070151:3: Rule [/Common/VDI_TEST_REDIRECT] error:

     

    line 1: [command is not valid in the current scope] [class ip_subnets_class {

     

    {

     

    network 36.36.32.0 mask 255.255.240.0

     

    network 172.20.0.0 mask 255.255.0.0

     

    network 172.31.0.0 mask 255.255.0.0

     

    network 18.2.0.0 mask 255.255.0.0

     

    network 18.237.0.0 mask 255.255.0.0

     

    }

     

    }]

     

  • I tried what you suggest with class and got following message :

     

    01070151:3: Rule [/Common/VDI_TEST_REDIRECT] error:

     

    line 1: [command is not valid in the current scope] [class ip_subnets_class {

     

    {

     

    network 36.36.32.0 mask 255.255.240.0

     

    network 172.20.0.0 mask 255.255.0.0

     

    network 172.31.0.0 mask 255.255.0.0

     

    network 18.2.0.0 mask 255.255.0.0

     

    network 18.237.0.0 mask 255.255.0.0

     

    }

     

    }]

     

  • The data group should be defined separately in the GUI under Local Traffic | iRules | Data group tab.

     

     

    I also edited the iRule in my first post slightly. Can you try that once you have the data group created?

     

     

    Aaron
  • Finally I was able to do it using data group. So the class map for defining IP addresses does not work. Thanks hoolio and all for helping me out!