Forum Discussion

samir_110997's avatar
samir_110997
Icon for Nimbostratus rankNimbostratus
Oct 29, 2007

Redirect traffic based on tcp port

 

Hi,

 

 

please can any one help me to create a i-rules so as to:

 

 

1. Redirect user http and ftp traffic to routeur ISP1

 

2. Redirect vpn traffic and smtp traffic to routeur ISP 2

 

3. Load balance the other traffic between the two isp (ISP1, ISP2)

 

 

 

thanks for you help

 

3 Replies

  • Typically, you would create virtual servers to handle this functionality. You can create a pool each for the ISP1 and IPS2 routers. You can then reference those pools in specific port virtual servers. To handle the remaining traffic not destined for a specific port virtual server, you can create a pool of both routers (each defined on port 0) and create a wildcard virtual server pointing to that pool.

     

     

    You might be create an iRule to do all of this, but it's simpler to use virtual servers.

     

     

    You can take a look at the LTM config guide for your version on AskF5 for details on configuring pools and virtual servers.

     

     

    Aaron
  • hi hoolio

     

    Thank you very mush for your reply, but please can you tell me how to resolve this using i-rules?

     

     

    thanks you in advance

     

     

  • You would still define the same pools and then use switch on TCP::local_port to select which pool to send the request to. Here's a simple example:

    
    when CLIENT_ACCEPTED {
        Check the requested port
       switch [TCP::local_port] {
          21  { pool isp1_router_pool }
          25  { pool isp2_router_pool }
          80  { pool isp1_router_pool }
          443 { pool isp1_router_pool }
          default { pool isp1_isp2_router_pool }
       }
    }

    This might not handle FTP traffic though if the server needs to open a data connection back to the client. This is handled automatically with a VIP and FTP profile though.

    Aaron