Forum Discussion

CGI's avatar
CGI
Icon for Altostratus rankAltostratus
Sep 27, 2013

ftp vip with multiple destinations based on user account

Hi iam looking for way to use on vip address and depending on the username (s1, s2, s3, s4) send the traffic to the specific node. I found the begining to the irule in the forum, but this is for two nodes. I would need this to work for 4 nodes (not load balancing but sending the traffic to a specific host depending on the username used, is there anyway to do this that is more simple ?

 

/Craig

 

when CLIENT_DATA { set user [regexp -inline {(?:USER\ )(\S+)} [TCP::payload]] if { [string length $user] > 2 } { if { [string match -nocase {s1.*} $user] > 0} { username started with s1, go to node 1 pool FTP_prod_pool member 10.x.x.1 } else { username didn't start with s1-, must be s2-, go to node 2 pool FTP_prod_pool member 10.x.x.2 } } TCP::release }

 

1 Reply

  • I'll knock up a much improved version shortly but this will suffice for now;

    when CLIENT_DATA { 
        set user [regexp -inline {(?:USER\ )(\S+)} [TCP::payload]] 
         if { [string length $user] > 2 } { 
            if { [string match -nocase {s1.*} $user] > 0 } { 
                username started with s1, go to node 1
                pool FTP_prod_pool member 10.x.x.1 } 
            elseif { [string match -nocase {s2.*} $user] > 0 } { 
                username started with s1, go to node 1
                pool FTP_prod_pool member 10.x.x.1 } 
            elseif { [string match -nocase {s3.*} $user] > 0 } { 
                username started with s1, go to node 1
                pool FTP_prod_pool member 10.x.x.1 } 
            elseif { [string match -nocase {s4.*} $user] > 0 } { 
                username started with s1, go to node 1
                pool FTP_prod_pool member 10.x.x.1 } 
            else {
                username didn't start with s1-, must be s2-, go to node 2 
                pool FTP_prod_pool member 10.x.x.2 } 
         } 
         TCP::release
    }