Forum Discussion
meena_60183
Nimbostratus
Jun 28, 2010Is this correct?
I am trying to write an irule where I perform snat based on the LB_SELECTED server address and this is what I have
when LB_SELECTED {
Check the CAS server and do SNAT
log...
hoolio
Cirrostratus
Jun 28, 2010Hi Meena,
You can use the IP::addr command to compare a single IP or network to another IP or network. Also, you should use local variables instead of global ones for this as they'll change with each connection.
when LB_SELECTED {
Check the CAS server and do SNAT
log local0. "LB server addr is [LB::server addr]"
if { [IP::addr [LB::server addr] equals 10.60.252.6] } {
snat 10.60.253.246
set cas_selected "10.60.252.6"
log local0. "selected CAS is $cas_selected"
forward
} elseif { [IP::addr [LB::server addr] equals 10.60.252.7] } {
snat 10.60.253.247
set cas_selected "10.60.252.7"
log local0. "selected CAS is $cas_selected"
forward
} elseif { [IP::addr [LB::server addr] equals 10.60.252.8] } {
snat 10.60.253.248
set cas_selected "10.60.252.8"
log local0. "selected CAS is $cas_selected"
forward
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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