Forum Discussion
SNAT based upon destination port
I have a requirement to load balance to a pool of IP address:ports and additionally present a dedicated IP source address based upon the destination port. I have a simple iRule that I thought would accomplish that but it isn't performing the SNAT function. It is load balancing to the correct destination ports but the source IP is the native IP of the client. Is there something wrong with my rule?
when LB_SELECTED {
if {[TCP::remote_port] equals 13261} {
snat 192.168.248.81
}
elseif {[TCP::remote_port] equals 13262} {
snat 192.168.248.82
}
elseif {[TCP::remote_port] equals 13263} {
snat 192.168.248.83
}
}
Thanks.
6 Replies
- sdoremus33_8277
Nimbostratus
Use different when clause - What_Lies_Bene1
Cirrostratus
Just to clarify, the snat Command is only available in these events: CLIENT_ACCEPTED, HTTP_REQUEST, SERVER_CONNECTED - Chris_Hotchkiss
Nimbostratus
Thanks for the clarification. I was following an example given in the iRule descriptions so I didn't do a whole lot of digging. https://devcentral.f5.com/wiki/iRules.LB_SELECTED.ashx
I'll try one of the others.
- What_Lies_Bene1
Cirrostratus
OK, great. - Chris_Hotchkiss
Nimbostratus
The actual fix was to change the 'if' check from TCP::remote_port to LB::server port. - What_Lies_Bene1
Cirrostratus
Hmmm, interesting.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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