Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

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

Curious1
Cirrus
Cirrus

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 1

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 "" } {