I created different datagroup (list of TCP ports) and based on this setting, selecting the correct pool within my irule.
ltm data-group internal DG_TCP-010901-10902 { records { 10901 { } 10902 { } } type string }
when CLIENT_ACCEPTED { switch [TCP::local_port] { DG_TCP-010901-10902 { pool P_010901-10902 } etc etc default { reject } } }
Unfortunatly, it doesn’t work…
If I change the irule to the following it works… when CLIENT_ACCEPTED { switch [TCP::local_port] { “10901” { pool P_010901-10902 } “10902” { pool P_010901-10902 } etc etc default { reject } } }
Regards,
I prefer to use the switch command instead of if commands and using datagroup to avoid mistake when editing irule…
when CLIENT_ACCEPTED {
switch [TCP::local_port] {
"10901" -
"10902" { pool P_010901-10902 }
default { reject }
}
}
or use a data group containing pool name as value
ltm data-group internal DG_TCP {
records {
10901 {P_010901-10902}
10902 {P_010901-10902}
XXXX {P_XXXX}
}
type string
}
when CLIENT_ACCEPTED {
if {[set pool [class match -value [TCP::local_port] equals "DG_TCP"]] ne ""} {
pool $pool
} else {
reject
}
}
One last question… Can I use datagroup to reference some URLs (sometimes with wildcard) and based on the result, select the correct pool ?? Example : if the uri match /000552/1743* then select the pool P_0005521743 What’s the irule looks like ??