Forum Discussion

alexm376_3470's avatar
alexm376_3470
Icon for Nimbostratus rankNimbostratus
Mar 07, 2012

iRule Error

 

Hi all,

 

 

 

need urgent help,I have the iRule below ,but it gives me errors,please advice

 

 

 

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

 

line 5: [command is not valid in the current scope] [class Hosts {

 

 

 

 

class Ports {

 

50

 

51

 

500

 

}

 

class Hosts {

 

host 217.65.39.4

 

}

 

 

when CLIENT_ACCEPTED {

 

 

if { not [matchclass [IP::client_addr] equals $::Hosts]}{

 

forward

 

}

 

elseif { [matchclass [[UDP::client_port] or [TCP::client_port]] equals $::Ports]}{

 

forward

 

}

 

elseif { [matchclass [IP::client_addr] equals $::Hosts]}{

 

pool INTERNET_013_014

 

}

 

}

 

 

 

 

 

 

 

 

 

 

  • The "class" sections look more like a bigip.conf configuration component. The "when CLASS_ACCEPTED" section is the iRule though.

     

     

    You'll want to create your classes either in the GUI, TMSH, or via iControl and then just include the when section in the iRule.
  • Hello,

    The following code is not supported in an irule :

     

    class Ports {
        50
        51
        500
    }
    class Hosts {
        host 217.65.39.4
    }        
    

     

    You need to define 2 data-groups (Local Traffic >> Irules >> Datagroups)

    Then, in your irule, you are using a deprecated command "matchclass". Use class match instead.