Forum Discussion

sb_2323_80570's avatar
sb_2323_80570
Icon for Nimbostratus rankNimbostratus
Jan 26, 2010

iRule for port and pool redirection

Hi,

 

 

Apologies for asking a dumb questions, But I want to create an iRule that redirects based on the destination IP and port

 

 

eg when a connection comes in on 443 it hits pool 2000 + the destination IP

 

> 192.168.0.2:443 = pool2002 on tcp_2002

 

 

ad when a connection comes on 8443

 

> 192.168.0.2:8443 = pool2002 on tcp_3002

 

 

The first part of the iRule seems to work but its second part that is failing

 

 

when CLIENT_ACCEPTED {

 

if {[TCP::local_port] == 443}

 

{

 

set pool_id [expr {[lindex [split [IP::local_addr] "."] 3] + 2000}]

 

log local0. "Selecting pool by TCP listener: $pool_id"

 

pool "pool$pool_id"}

 

elseif

 

{[TCP::local_port] == 8443}

 

{

 

set pool_id [expr {[lindex [split [IP::local_addr] "."] 3] + 2000}]

 

set pool_id [expr {[lindex [split [IP::local_addr] "."] 3] + 3000}]

 

log local0. "Selecting pool by TCP listener: $pool_id"

 

pool "pool$pool_id:$port}

 

}

 

 

Any help would be greatly appreciated

12 Replies