Forum Discussion

For_saken_9071's avatar
For_saken_9071
Icon for Nimbostratus rankNimbostratus
Nov 25, 2008

Local Port Irule - Requires Ip Persistence

Hi All,

 

I have the below config that is running fine though I now want to specify different IP Persistence for each of the below pools. Currently I have set on the VIP a Persistence of 3600seconds - Source Address Affinity. I'm pretty new to irules so looking for some config that I could use.

 

 

 

 

 

 

when CLIENT_ACCEPTED {

 

log local0. [TCP::local_port]

 

if { [TCP::local_port] == 80 } {pool pool-testesttest-sotl}

 

elseif { [TCP::local_port] == 17024 } {pool pool-anothertest-sotl}

 

elseif { [TCP::local_port] == 19012 } {pool pool-extratest-sotl}

 

}

 

 

}
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi there,

    You could the if/elseif structure to a switch and then use the persist command (Click here😞

     
     when CLIENT_ACCEPTED { 
      
        switch [TCP::local_port] { 
           "80" { 
              pool pool-testtesttest-sotl 
              persist source_addr 255.255.255.255 3600 
           } 
           "17024" { 
              pool pool-anothertest-sotl 
              persist source_addr 255.255.255.255 120 
           } 
           "19012" { 
              pool pool-extratest-sotl 
              persist source_addr 255.255.255.255 240 
           } 
           default { 
                Take some default action? 
           } 
        } 
     } 
     

    Aaron