Forum Discussion

Kalpesh_48932's avatar
Kalpesh_48932
Icon for Nimbostratus rankNimbostratus
Jun 04, 2014

how to use irule to customize use of persistence profile

Hello All,

 

I want to use irule to allocate persistence profile for some subnets and have to exclude some subnets.

 

can you please suggest how i can use switch command for this?

 

when CLIENT_ACCEPTED { switch -glob [IP::client_addr] { "10.123.123.70/32" { persist source_addr} "10.122.122.47/32" { persist none } default { persist source_addr} } }

 

6 Replies

  • it is going to be string comparison, so you do not need /32.

    when CLIENT_ACCEPTED { 
      switch [IP::client_addr] { 
        "10.123.123.70" { persist source_addr } 
        "10.122.122.47" { persist none } 
        default { persist source_addr } 
      } 
    }
    
  • what if I need to exclude complete subnet from persistence? say I don't want 10.124.124.0/24 use persistence.

     

    how I can update it in iRule.

     

  • I believe you can do:

    when CLIENT_ACCEPTED {
    switch -glob [IP::client_addr] {
        "10.124.124.*" { persist none }
        default { persist source_addr }
    }
    }
    

    I didn't get a chance to test, but this should work.

  • Thanks Brad. it works, however still I want to customized it.

     

    how I can define perticular subnet like. 1.1.1.0/30 ?

     

  • You would just have to use the string rule, as IP::client_addr is a string value, so you could make the rules like

    when CLIENT_ACCEPTED {
    switch -glob [IP::client_addr] {
        "10.124.124.*" -
        "10.124.123.*" { persist none }
        default { persist source_addr }
    }
    }
    

    I'm really not a pro at this, but this is the way that I do it.