Forum Discussion

Matthew_WV_1894's avatar
Matthew_WV_1894
Icon for Nimbostratus rankNimbostratus
Feb 25, 2015
Solved

new to iRules

Hello, I am trying to create an iRule that uses a specific persistence profile if the incoming IP address is a member of a datagroup. I created the datagroup of type address and added my IPs. I'm trying to now create the iRule to use a hash persistence if the incoming IP address is a member of the data group and to use a source_addr persistence profile if not. Below is my iRule definition based on a datagroup of ABC:

 

when CLIENT_ACCEPTED { if { [matchclass [IP::remote_addr] equals $::ABC]} { persist hash } else { persist source_addr } }

 

When I try to save the iRule, I get the following error: 01070151:3: Rule [/ABC/ABC] error: /ABC/ABC:3: error: ["unexpected end of command;expected argument spec:ANY_CHARS"][persist hash]

 

what am I doing wrong? Thanks in advance

 

5 Replies

    • Brad_Parker_139's avatar
      Brad_Parker_139
      Icon for Nacreous rankNacreous
      Also, unless you are using BigIP v9 I suggest using class match instead of matchclass and calling your datagroup by name, i.i "/Common/ABC". Both are deprecated and in v11 calling at datagrou via $:: will actually throw TCL errors. https://clouddocs.f5.com/api/irules/class.html
  • Thank you, much appreciated. That clears up why I was getting TCL errors as soon as I tested this rule:) Working now, thanks for the help.