Forum Discussion
daveclark_20228
Nimbostratus
Jun 03, 2009Trying to get a SNAT irule to work
Hello all , i am hoping of you very helpful people will be able help me get this working. I am not a programmer , and only just starting to learn about TCL and Irules.
I have a irule i want to use to snat a server (same a vip bounce back but i need to match on port as well)
here is my irule it excepts the syntax but does not work.
when CLIENT_ACCEPTED {
if {[matchclass [IP::client_addr] equals $::UAT_Symba_SNAT1] and ([matchclass [TCP::local_port] equals $::UAT_Symba_Port])}{
snat x.x.x.175
} elseif {[matchclass [IP::client_addr] equals $::UAT_Symba_SNAT2] and ([matchclass [TCP::local_port] equals $::UAT_Symba_Port])}{
snat x.x.x.176
} else {
don't do any source address translation
forward
}
}
I have modified this rule which works fines as two irules i am looking for a way of combining the two irules below , in to one.
when CLIENT_ACCEPTED {
check if client_addr = any in the class
if { [matchclass [IP::client_addr] equals $::XAT_Symba_SNAT1]} {
check if the class contains the server_port requested
if { [matchclass [TCP::local_port] equals $::XAT_Symba_Port]} {
snat using this snat pool
snat X.X.X.175
} else {
don't do any source address translation
forward
}
}
}
when CLIENT_ACCEPTED {
check if client_addr = any in the class
if { [matchclass [IP::client_addr] equals $::XAT_Symba_SNAT2]} {
check if the class contains the server_port requested
if { [matchclass [TCP::local_port] equals $::XAT_Symba_Port]} {
snat using this snat pool
snat X.X.X.176
} else {
don't do any source address translation
forward
}
}
}
Thanks for any help or advice
- The_Bhattman
Nimbostratus
What aboutwhen CLIENT_ACCEPTED { if {([matchclass [IP::client_addr] equals $::UAT_Symba_SNAT1]) && ([matchclass [TCP::local_port] equals $::UAT_Symba_Port])}{ snat x.x.x.175 } elseif {([matchclass [IP::client_addr] equals $::UAT_Symba_SNAT2]) && ([matchclass [TCP::local_port] equals $::UAT_Symba_Port])}{ snat x.x.x.176 } else { don't do any source address translation forward } }
- daveclark_20228
Nimbostratus
Thanks
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