Forum Discussion

Meshal_119384's avatar
Meshal_119384
Icon for Nimbostratus rankNimbostratus
Jul 09, 2015

forward traffic to multi pools and add x port to original port

Hi all , I need to have migration from x load balancer to new f5 ltm , I have on old one 180 VIPs with different ports , i need to simplify the migration by not create 180 VIPs ,so i have an idea to create irule and attached with VIP contain any ports , but i have an issue , my configuration is : 3 pools 11 nodes the connection will be : clientIP ----VIP:1000 ------ node:11000

 

so every clients have port assume it is from 1000 to 1180 nodes have ports from 11000 to 11180

 

how can we do this by irule , to add the 1 to client connection

 

BR ,

 

4 Replies

  • The easiest way to add a digit to a port is simply concatenating the number:

    when CLIENT_ACCEPTED {
        node 10.70.0.2:1[TCP::local_port]
    }
    

    For example, that will send a client request on port 1000 to port 11000.

  • You'd use the pool command to forward traffic to a load balanced pool, and the node command to send traffic to a specific IP and port. Your original description sounded like you just needed to add a 1 to the incoming port. If you simply forward traffic to different pools, port translation in the virtual server will change the port to the port of the selected pool member.

     

    Do you just need to send traffic to specific pools, or do you need to send traffic to specific members within pools?

     

  • Okay, so I'm not accounting for how you make a pool selection here, but the following is a very simple way to choose a pool member and then forward traffic to that member on a derived port. This assumes of course that the pool members are all listening on multiple ports and that the VIP is listening on multiple (all) ports.

    when HTTP_REQUEST {
    
         select the pool (your pool selection will differ)     
        pool pool1
    
         force an early load balancing decision and store the chosen server IP in a variable
        set srv [lindex [LB::select] 3]
    
         direct the request to the chosen pool member on the derived port (1[TCP::local_port])
        node $srv:1[TCP::local_port]
    }