cancel
Showing results for 
Search instead for 
Did you mean: 

SNAT Issue

mbamusa_59409
Nimbostratus
Nimbostratus

Hi Evrey one ,

 

 

i have virtual server created to load balance the outgoing traffic to 3 links and i applied the LB_Select Irule along with SNAT Irule as following :

 

ltm rule /Common/SNAT_ALL_IRULE_TEST {

 

when LB_SELECTED {

 

if { [LB::server addr] equals "1.1.1.1" } {

 

 

log local0.info "Selected ISP01 Snat for Client [IP::client_addr]"

 

snatpool ISP01_SNAT_POOL

 

} elseif { [LB::server addr] equals "2.2.2.2" } {

 

 

 

log local0.info "Selected ISP02 Snat for Client [IP::client_addr]"

 

 

snatpool ISP02_SNAT_POOL}

 

else {

 

 

 

log local0.info "Selected ISP03 Snat for Client [IP::client_addr]"

 

 

snatpool ISP03_SNAT_POOL

 

}

 

}

 

 

ltm rule /Common/Source_NAT_Irule_test {

 

when CLIENT_ACCEPTED {

 

log local0.info "iRule source NAT - CLIENT ACCEPTED - ip addr = [IP::client_addr]"

 

if {[IP::addr [IP::client_addr] equals 10.10.10.10]}{

 

snat 1.1.1.30

 

pool Gateway_POOL member 1.1.1.1

 

}

 

}

 

 

when the above irules applied on same VS the snat command in the second irule (Client_ACCEPTED) will not work but if we apply the second irule only it works .

 

if anyone could help me on this i would be greatful .

 

 

thank you

 

Mohammed A. Bamusa

 

 

2 REPLIES 2

nitass
F5 Employee
F5 Employee

can you try this?

 

 

[root@ve10:Active] config b rule SNAT_ALL_IRULE_TEST list

 

rule SNAT_ALL_IRULE_TEST {

 

when LB_SELECTED {

 

if { [LB::server addr] equals "1.1.1.1" } {

 

if {[IP::addr [IP::client_addr] equals 10.10.10.10]} {

 

snat 1.1.1.30

 

} else {

 

snatpool ISP01_SNAT_POOL

 

}

 

} elseif { [LB::server addr] equals "2.2.2.2" } {

 

snatpool ISP02_SNAT_POOL

 

} else {

 

snatpool ISP03_SNAT_POOL

 

}

 

}

 

}

 

[root@ve10:Active] config b rule Source_NAT_Irule_test list

 

rule Source_NAT_Irule_test {

 

when CLIENT_ACCEPTED {

 

if {[IP::addr [IP::client_addr] equals 10.10.10.10]}{

 

pool Gateway_POOL member 1.1.1.1

 

}

 

}

 

}

 

 

mbamusa_59409
Nimbostratus
Nimbostratus
Dear Nitass ;

 

 

It works fine with your IRULE ,I really do appreciate your kind assistance and wish you all the best .

 

 

Regads

 

Mohammed A. Bamusa