intelligent SNAT generate errors

Dear all,

I write a iRule as the following:

when CLIENT_ACCEPTED {

if { [matchclass [IP::local_addr] equals $::Uni_class]} {

pool Uni_first_pool

}

elseif { [matchclass [IP::local_addr] equals $::CRT_class]} {

pool CRT_first_pool

}

else {

pool Default_gateway_pool

}

}

when LB_SELECTED {

if {[IP::addr [LB::server addr] equals 11.10.10.254] and [IP::addr [IP::client_addr] equals 10.6.3.4] } {

snat snat_uni_pool

}

elseif {[IP::addr [LB::server addr] equals 11.10.10.254] and [IP::addr [IP::client_addr] equals 10.6.3.5] } {

snat snat_uni_pool

}

elseif {[IP::addr [LB::server addr] equals 10.10.10.254] and [IP::addr [IP::client_addr] equals 10.6.3.4] } {

snat snat_crt_pool

}

elseif {[IP::addr [LB::server addr] equals 10.10.10.254] and [IP::addr [IP::client_addr] equals 10.6.3.5] } {

snat snat_crt_pool

}

else {

snat automap

}

}

however, that genertat some errors when I update with Webgui, just like the picture, I don’t know what is wrong, thank you for you help!

Hi,

The error indicates you were using ‘snat pool snat_crt_pool’. The command to specify a SNAT pool is snatpool (without a space).

Can you try this if you want to use SNAT pools and automap?

when CLIENT_ACCEPTED { 
    if { [matchclass [IP::local_addr] equals $::Uni_class]} { 
       pool Uni_first_pool 
    } elseif { [matchclass [IP::local_addr] equals $::CRT_class]} { 
       pool CRT_first_pool 
    } else { 
       pool Default_gateway_pool 
    } 
 } 
 when LB_SELECTED { 
    if {([IP::addr [IP::client_addr] equals 10.6.3.4] or [IP::addr [IP::client_addr] equals 10.6.3.5]) and \ 
       [IP::addr [LB::server addr] equals 11.10.10.254]}{ 
       snatpool snat_uni_pool 
    } elseif {([IP::addr [IP::client_addr] equals 10.6.3.4] or [IP::addr [IP::client_addr] equals 10.6.3.5]) and \ 
       [IP::addr [LB::server addr] equals 10.10.10.254]}{ 
       snatpool snat_crt_pool 
    } else { 
       snat automap 
    } 
 }

Aaron

thank you very much Aaron, I will try that!

hey Aaron,

I have tried that iRule, It should now include the “\”, the following is okay :

when CLIENT_ACCEPTED {

if { [matchclass [IP::local_addr] equals $::Uni_class]} {

pool Uni_first_pool

}

elseif { [matchclass [IP::local_addr] equals $::CRT_class]} {

pool CRT_first_pool

}

else {

pool Default_gateway_pool

}

}

when LB_SELECTED {

if {([IP::addr [IP::client_addr] equals 12.10.10.1] or [IP::addr [IP::client_addr] equals 12.10.10.2]) and [IP::addr [LB::server addr] equals 10.10.10.254] } {

snatpool snat_uni_pool

}

elseif {([IP::addr [IP::client_addr] equals 12.10.10.1] or [IP::addr [IP::client_addr] equals 12.10.10.2]) and [IP::addr [LB::server addr] equals 11.10.10.254] } {

snatpool snat_crt_pool

}

else {

snat automap

}

}

The backslash just escapes the newline character and allows you to break up long lines. Functionally, you can remove it with no difference.

Aaron