Forum Discussion

pvaughan's avatar
pvaughan
Icon for Nimbostratus rankNimbostratus
Jun 24, 2013

Irule to redirect traffic to a pool with node that is out on the internet

Grettings Dev central, I have been asked to write an Irule to do the following. Client connects to www.company.com and gets directed to pool configured in virtual server as normal. Client connects to www.company.com/alternate and get sent to alternate_pool which has a host that is out on the internet via external vlan. I need the F5 to proxy this connection and not just redirect to the different URL. I have the following Irule and was hoping someone could look at it and tell me if it will work and what should be added.

 

 

Thanks

 

 

Assign a pool and SNAT based on HTTP URI

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::path ]] {

 

"/alternet*" {

 

select the pool and SNAT automap

 

pool alternet_pool

 

snat automap

 

}

 

}

 

}

 

4 Replies

  • This looks pretty good. You're sending the traffic to a pool of hosts that are external to your environment and enabling automap SNAT so that the remote host sees the self-IP of the BIG-IP. The most important aspect of this configuration is ROUTING. You must ensure that 1) the BIG-IP can route to these remote hosts, and 2) the remote host can route back based on the SNAT IP (which may or may not be required).

     

     

    You may also want to consider, depending on your software version, 1) enabling OneConnect and/or 2) setting a default action in your switch statement to go back to internal pool(s).
  • Kevin, how do I set a default action in the switch statement? I am new at this.

     

     

    Thanks
  • 
    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::path ]] {
            "/alternet*" {
                 select the pool and SNAT automap
                pool alternet_pool
                snat automap
            }
            default {
                pool local_pool
            }
        }
    }