Forum Discussion

Techgeeeg_28888's avatar
Techgeeeg_28888
Icon for Nimbostratus rankNimbostratus
Aug 02, 2013

iRule correct or not

I have a link controller setup and i want the server1 and server2 to be translated to separate snat pools and go out via different gateway pool and the rest of the traffic should go out via default snatpool and gateway pool. So i have written the below iRule can some one comment if this is correct or there is some problem in the coding?

when CLIENT_ACCEPTED {
if { [class match [IP::client_addr] equals "Server1"]} {
                 snatpool snat_proxy1
                 pool GW_ISP1_Pool
} elseif {[class match [IP::client_addr] equals "Server2"]} {
                 snatpool snat_proxy2
                 pool GW_ISP2_Pool
 }else {
                   snatpool Default
                   pool gateway_pool
        }
}

1 Reply

  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus

    If Server1 is a single IP address, you can change your statement to

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

    If it represents several IP addresses, create a data-group (such as server1_ip_class) with the IP addresses in it, and change your test to

    if { class match [IP::client_addr] equals server1_ip_class } {