For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Curious1's avatar
Curious1
Icon for Cirrus rankCirrus
Jun 22, 2022

LTM iRule help : assign client to SNAT IP based on datagroup match

Hi Everyone,

I would like to assgn the client IP to a SNAT IP from a Datagroup match, any help woul dbe appreciated.  Something like the following is what we have so far but TCL error occurring with line "if { $mapped_snat ne "" } then {"

when CLIENT_ACCEPTED {
set sourceip [IP::client_addr]
set mapped_snat [class match $sourceip equals DataGroup]
if { $mapped_snat ne "" } then {
snat $mapped_snat
}
# log local0. "SNAT for $sourceip choose SNAT $mapped_snat"
}

1 Reply

  • If you want the value from datagroup key, you can use the following, it checks the datagroup and assign the value in one line.

    if { [set mapped_snat [class match -value -- $sourceip equals DataGroup]] ne "" } {