Forum Discussion

Nick_67035's avatar
Nick_67035
Icon for Nimbostratus rankNimbostratus
Feb 24, 2010

Client Source routing to virtual servers/pools

Hello All

 

 

I have a weird request for F5 and was wondering if anyone here could help me with getting it going.

 

 

Basically, a single URL for users to get access to an application whether they are inside the organization (private IP) or outside (public IP). I want to have a single virtual server for load balancing the pool of servers on the backend, but based on whether the user is coming from an internal address or an external address, I want to send the user to different pools on the backend. The internal pool of servers has some additional content and functionality not available to outside users but would like to keep the same host name. Not sure if there is a way to do source-address routing to virtual servers and pools, but any help you can give would be appreciated

 

 

Nick

6 Replies

  • sure thing. Something like this will address your needs:

     
     when HTTP_REQUEST { 
       if { [IP::addr [IP::client_addr]/24 equals "192.168.1.0"] } { 
         pool internal 
       } else { pool external } 
     } 
     

    If you have ranges of internal addresses, you can configure a datagroup and match against that. Welcome to the forums!
  • Citizen_Elah

     

     

    Thanks for the help with this. So, if I use the datagroup and create a list of the internal IP's, would the logic go some thing like:

     

     

    If client address=datagroup then send to pool 1 else send to pool 2

     

     

    Just want to make sure I get it right.

     

     

    Thanks
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Yes, that's exactly the logic in elah's iRule. If the IP matches the string (or the data group if you replaced the static string with a data group), then send to pool "internal". Otherwise, send to pool "external".

     

     

    Colin
  • Awesome...let me test it out and will let you know how it works. I appreciate the help guys.
  • Hey Guys

     

     

    This worked...had to do some tweaking to get it working, but everything is running. Thanks for the help with this. Here is the final code I used.

     

     

    when HTTP_REQUEST { if { [matchclass [IP::client_addr] equals $::CLASS] } { pool Internal } else { pool External } }

     

     

    Thanks
  • it doesn't matter on LTM VE, but you won't want to use the $:: designation on datagroups for CMP systems as it will demote the vip your iRule is attached to.

     

     

    Glad you got it working.