Forum Discussion
silver
Nimbostratus
May 19, 2014Nested 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 CLI...
What_Lies_Bene1
Cirrostratus
May 22, 2014OK, so can you try using this, I've just adjusted the spacing to make things clearer and added appropriate logging, plus a final else to catch any cases that don't match your test expressions;
switch [IP::client_addr] {
192.168.100.1 { if ([TCP::local_port] >= 5566) && ([TCP::local_port] <= 5580) } {
node 172.16.100.1
snat 10.0.0.10
log local0. "Client 192.168.100.1 used a port between 5566 and 5580"
} elseif { [TCP::local_port] == 4412 } {
node 172.16.200.20
snat 10.0.0.10
log local0. "Client 192.168.100.1 used port 4412"
} elseif { [TCP::local_port] == 5000 } {
node 172.16.100.5
snat 10.0.0.10
log local0. "Client 192.168.100.1 used port 5000"
} else {
log local0. "Client 192.168.100.1 didn't use a port we tested for"
}
}
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