silver
May 19, 2014Nimbostratus
Nested if Condition Not working while using switch
Hi,
Am using the outbound connection from a host and based on the destination port the traffic needs to be routed to respective nodes and SNAT to be used.
I have use the below iRule.
when CLIENT_ACCEPTED {
switch [IP::client_addr] {
192.168.100.1 { if { [TCP::local_port] >= 5566 <= 5580 } {
node 172.16.100.1
snat 10.0.0.10
} elseif { [TCP::local_port] == 4412 } {
node 172.16.200.20
snat 10.0.0.10
} elseif { [TCP::local_port] == 5000 } {
node 172.16.100.5
snat 10.0.0.10
}
}
} }
When i use the above iRule, the first condition only works and am able to connect properly to the destination with the SNAT enabled. But if i try to connect based on the second condition "Port 4412" it is not using the mentioned node as "172.16.200.20" rather than it is using the node as "172.16.100.1" which is stated in the first condition.
Am using the VS IP as my SNAT IP for this connection.
My VS : 10.0.0.10
I have verified using it by loging the TCP connection.
Can anyone help on why the condition is not working as expected.