Forum Discussion

sb_2323_80570's avatar
sb_2323_80570
Icon for Nimbostratus rankNimbostratus
Mar 06, 2009

Newbie PAT question

Hi,

 

 

Im new to writing iRules so apologies in advance, Im looking to write an iRule that redirects a client based on the last octet of a vserver to a particular port.

 

 

Eg

 

 

eq client >> vserver x.x.x.10 tcp_443 to a pool but the destination port is changed to tcp_10.

 

 

Any assistance would be greatly apreciated.

 

 

  • If I understand your scenario correctly, I think you could do this without an iRule. You can configure your VS on x.x.x.10:443 and the pool member(s) on port 10. Just make sure port translation on the VS is left at the default of enabled.

     

     

    Aaron
  • Hi,

     

     

    I want to use a wildcard vserver that will be a /23 network and only use two nodes listening on multiple ports to reduce on the amount IP address space allocated, So there will be multiple vservers pointing

     

     

    eg

     

    x.x.x.10 >> node A, node B tcp_10

     

    x.x.x.11 >> node A, node B tcp_11
  • I see. I haven't tested this, but I think you could use the default load balancing algorithm to choose the pool member IP address and then change the destination port based on the last octet of the requested IP address.

    LB_SELECTED is an event triggered when a load balancing decision is made. You can get details on the other commands on the iRule wiki (Click here).

     
     when LB_SELECTED { 
      
        log local0. "[IP::client_addr]:[TCP::client_port]: Request to VS [IP::local_addr]:[TCP::local_port]\ 
           Default selection: [LB::server]" 
      
         Use the node command to change the destination port of the selected pool member 
        node [LB::server addr] [getfield [IP::local_addr] "." 4] 
      
        log local0. "[IP::client_addr]:[TCP::client_port]: Changing to node:\ 
           [LB::server addr] [getfield [IP::local_addr] "." 4]" 
     } 
     

    Aaron