Forum Discussion
mr_evil_116524
Nimbostratus
Jan 10, 2014Source destination irule
Hello All,
I am trying to do source to destination iRULe not sure what I am doing below is my iRULE:
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr] equals vm1 ] || [IP::addr [IP::client_addr] equals vm2 ] && [IP::addr [IP::local_addr] equals remote ip] } {
if { [matchclass [TCP::local_port] equals tcp_DG ] || [matchclass [UDP::local_port] equals udp_DG] } {
snat using this source address
snatpool Public_internet_pool
log local0. "SNATed, [IP::client_addr]:[TCP::client_port] --> [IP::local_addr]:[TCP::local_port]"
Exit this event to avoid disabling SNAT below
return
}
}
Default action is to not SNAT
snat none
log local0. "Not Allowed to SNATed , [IP::client_addr]:[TCP::client_port] --> [IP::local_addr]:[TCP::local_port]"
}
Any help will be great.
Thanks
5 Replies
- uni_87886
Cirrostratus
You need brackets in your if statement, as the && takes precedence over the ||. Could that be your problem?
if { ([IP::addr [IP::client_addr] equals vm1 ] || [IP::addr [IP::client_addr] equals vm2 ] ) && [IP::addr [IP::local_addr] equals remote ip] } {
- uni_87886
Cirrostratus
PS, if you're posting code, highlight it and click the Preformatted Code button. It makes it much easier to read
- uni
Altocumulus
You need brackets in your if statement, as the && takes precedence over the ||. Could that be your problem?
if { ([IP::addr [IP::client_addr] equals vm1 ] || [IP::addr [IP::client_addr] equals vm2 ] ) && [IP::addr [IP::local_addr] equals remote ip] } {
- uni
Altocumulus
PS, if you're posting code, highlight it and click the Preformatted Code button. It makes it much easier to read
- mr_evil_116524
Nimbostratus
Thanks UNI, that seemed to work BTW I try to format earlier but didnt work. I have fixed that.
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