Forum Discussion

Eugene_Wu_10813's avatar
Eugene_Wu_10813
Icon for Nimbostratus rankNimbostratus
Jan 23, 2007

irule for simple forwarding

Hi all,

 

 

Sorry, I am quite new to using iRules. I actually need to do something quite simple, but not sure how to implement.

 

 

We are upgrading one of our servers that has multiple applications running on it. We are planning to migrate the application to the new server in stages.

 

 

Basically, I just want the F5 to forward traffic for migrated applications to the new server, and continue sending non-migrated traffic to the old server.

 

5 Replies

  • Hi,

     

     

    will this irule work?

     

     

    when CLIENT_ACCEPTED {

     

    if { [matchclass [TCP::server_port] equals $::TEST_ports] } {

     

    pool A_pool

     

    } else {

     

    pool B_pool

     

    }

     

    }

     

     

     

     

    A_pool contains my New server, B_pool contains the old server. I basically want any traffic that matches TEST_ports to be directed to the new server, and everything else to go to the old server. Thanks!
  • Do you mean for the contents of TEST_ports to represent the port on the F5 to which the user connected? I'm not clear on exactly how you're wanting to migrate them, but I wonder if you might mean to use TCP::local_port instead of TCP::server_port. Or maybe it doesn't matter if the ports are the same anyway.
  • Hi Colin,

     

     

    Thanks for your reply.

     

     

    Basically, we are migrating the applications in stages. We should be able to identify the traffic by the port.

     

     

    For example:

     

     

    'Telnet' application is migrated to the new server. So, we want to forward all port 23 traffic to the new server and all other traffic to the old server. As time passes, 'ftp' is also migrated so both '21 and 23' are migrated to the new server while everything else goes to the old server.

     

     

    Thanks again!
  • Couldn't you just change the VIP and pool defintions on the LTM to accomodate what you're looking for?

     

     

    I'm assuming that today you have a VIP with a wildcard port (0). Just add new VIPs with the same IP and the specific port you want. I.E. from 192.168.1.10:0 to 192.168.1.10:23 for telnet and 192.168.1.10:21 for ftp. Then you just need to associate a pool containing the new server address(es) with the new vips.

     

     

    The LTM matches a VIP with a specific port before it matches the wildcard, so conections on 21 would get sent to the port 21 VIP, 23 to the 23 VIP, and the rest to your existing VIP.

     

     

    Dave
  • thanks for your suggestion. we have already explored this idea, but unfortunately, the number of ports (and therefore virtual servers) is about 700. We're looking at using the irules to simplifying the migration process (just load up the ports into a data group).