Forum Discussion
Macaron
Nimbostratus
Jun 27, 2016iRule - Source Port persistence for a specific subnet else only source addr persistence
 Hi, 
    I need an iRule help. I want to apply source port persistence on a specific subnet (10.1.1.0/24) and for all the other traffic coming to the same VIP, I just want to Source address persisten...
Vijay_E
Cirrus
Jun 27, 2016I am assuming that you are using the iRule in an UIE persistence profile that is attached to the VS.
In the iRule example that I have provided, persistence is based on "Client IP & Client Port" if the client IP matches the "datagroup_dg" and for client IP not matching the datagroup, persistence is based on just the "Client IP"
In the else statement use
persist uie [IP::client_addr]
 when CLIENT_ACCEPTED {
   if {[class match [IP::client_addr] equals "datagroup_dg"]} {
     set client_ip_port "[IP::client_addr]:[TCP::client_port]"
     persist uie $client_ip_port
   }
   else {
     persist uie [IP::client_addr]
   }
}
When you add information for the "value" field (seen in GUI) within the data group, you will be able to see the "data" keyword in the CLI within the datagroup like this:
ltm data-group internal CLASS-IP-DATA {
    records {
        10.10.10.0/24 {
            data abcd
        }
    }
    type ip
}
Datagroup format:
ltm data-group internal CLASS-IP-DATA {
    records {
        1.1.1.1/32 { }
    }
    type ip
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects