Forum Discussion

LillyM_9417's avatar
LillyM_9417
Icon for Altostratus rankAltostratus
Dec 22, 2011

IRULE - IP::client_addr

Hello,

 

 

I want to ask a question about "IP::client_addr". I write the following irule:

 

When client has the X.X.X.3 ip address, it goes to the first "if" thats okey and I see from the ltm log ( I opened a debug..) , but the connection is not forwarded to the Pool x it is forwarded to the default Pool, I also see from the log file that the same connection is also forwarded to the default pool. How can it be possible? What is wrong in this irule?

 

 

if { [IP::addr [IP::client_addr] equals x.x.x.0/24]}{

 

pool X

 

}

 

if { [IP::addr [IP::client_addr] equals y.y.y.0/24]}{

 

pool Y

 

 

}

 

else {

 

default pool

 

}

 

  • have you forgotten else between the first and second if statement?

    e.g.

    if {[IP::addr [IP::client_addr] equals x.x.x.0/24]} {
       pool X
    } elseif {[IP::addr [IP::client_addr] equals y.y.y.0/24]} {
       pool Y
    } else {
       pool default
    }
    
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    This is an excellent example of the way that the pool command actually works in an iRule. It's effectively updating a pointer that is used to route traffic. I think this one deserves a Tech Tip, adding it to my list for the iRules Concepts series to do some more digging on.

     

     

    Colin