Forum Discussion

lago_53253's avatar
lago_53253
Icon for Nimbostratus rankNimbostratus
Aug 20, 2008

Port Forwarding

Hi there,

i need an iRule for Port Forwarding.

All Request to Virtual-Server:80 had to go to Pool:81

Something like this:

 
 when CLIENT_ACCEPTED { 
  
  if { [TCP::local_port equals 80] } { 
      pool My_Pool member "ALL_Member" 81 
  } 
 } 
 

Thanks for your Help

  • Patrick_Chang_7's avatar
    Patrick_Chang_7
    Historic F5 Account
    What you want to do does not require an iRule. Just set up a pool of servers listening on port 81 and assign that pool to the virtual server listening on port 80. If you really must use an iRule, your example makes it look like you want to pick a specific member of the pool. If you want to just select the pool use the command:

     

    pool my_pool

     

    where my_pool is the name of the pool. When you set up the pool, you specify the port each pool member is listening on.
  • Hi,

    This is done automatically when you create a VS on port 80 and a pool with pool members listening on port 81.

    The port translation is automatically handled by the BIGIP.

    Even if you have something like this:

    vs port any -> default pool port any

    if you use an iRule that specify this:

     
      when CLIENT_ACCEPTED {  
           if { [TCP::local_port equals 80] } {  
               pool My_Pool  
           }  
      }  
     

    where My_Pool are members listening on port 81
  • Sometimes it is so easy...

     

    I did not see this.

     

     

    Thank you...