cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6544
Views
5
Helpful
15
Replies

Load balance multiple URLs on single VIP

dpastor
Level 1
Level 1

Hello,

I have a fairly typical load balance configuration on a pair of ACE appliances running (A3)2.5 and now I need to load balance multiple URIs to these same servers on port 80 to the one VIP. Can someone direct me to a doc that shows a good example of this, or explain it below?

Thanks,

Dave

serverfarm host application

rserver webserver1 80

probe server-80-PROBE

inservice

rserver webserver2 80

probe server-80-PROBE

inservice

sticky ip-netmask 255.255.255.255 address source application-80-STICKY

replicate sticky

serverfarm application

class-map match-all application-80-CLASS

2 match virtual-address 1.1.1.1.1 tcp eq www

policy-map type loadbalance first-match application-80-POLICY

class class-default

sticky-serverfarm application-80-STICKY

insert-http X-Forwarded-For header-value "%is"

class application-80-CLASS

loadbalance vip inservice

loadbalance policy application-80-POLICY

loadbalance vip icmp-reply

nat dynamic 22 vlan 424

appl-parameter http advanced-options CASE_PARAM

1 Accepted Solution

Accepted Solutions

Okay, then.  You don't need a separate Layer-7 policy-map then.  You would do it something like this:

serverfarm host application-80
  rserver server1 80
    probe server-80-PROBE
    inservice
  rserver server2 80
    probe server-80-PROBE
    inservice
serverfarm host application-L7
  rserve rserver1 80
    probe server-80-PROBE
    inservice
  rserver server2 80
    probe server-80-PROBE
    inservice

class-map match-all application-80-CLASS
  2 match virtual-address 1.1.1.1 tcp eq www

class-map type http loadbalance match-any application-L7-CLASS
  3 match http url /uri1/
  4 match http url /uri2/uri2
  5 match http url /uri2/uri3.htm

policy-map type loadbalance first-match application-80-POLICY
  class application-L7-CLASS
    serverfarm application-L7

  class class-default
    sticky-serverfarm application-80-STICKY
    insert-http X-Forwarded-For header-value "%is"

policy-map multi-match POLICY-424
  class application-80-CLASS
    loadbalance vip inservice
    loadbalance policy application-80-POLICY
    loadbalance vip icmp-reply
    nat dynamic 22 vlan 424
    appl-parameter http advanced-options CASE_PARAM

This way, your three sites will be load-balanced to one serverfarm, and all the rest of the traffic would be load-balanced to the default serverfarm.

Hope this clears it up.  Let me know if it doesn't.

Sean

View solution in original post

15 Replies 15

Sean Merrow
Level 4
Level 4

Hi Dave,

Yes, you can load balance multiple URLs to the same VIP and serverfarm.  You can see how to configure this in the Defining a URL for HTTP Load Balancing chapter in the configuration guides.  I have also included an example below that may help get the concept across.

In this example, the client will be load balanced to the LOGIN-FARM if they come in requesting the URL /login, /register, or they are connecting to Host login.example.com.  If none of those match, we'll check to see if they have a suggestion by looking to see if they are looking for the /suggestions URL.  If so, they will be load balanced to SUGGESTION-FARM.  Lastly, if they don't match either of the first two, then they will be sent to the WWW-FARM.  I think the LOGIN class-map is what you are looking for where multiple URLs will be sent to the same farm.

serverfarm host WWW-FARM
  probe TCP
  rserver WWW_SERVER_01
    inservice
  rserver WWW_SERVER_02
    inservice
  rserver WWW_SERVER_03
    inservice

serverfarm host LOGIN-FARM
  probe TCP
  rserver LOGIN_SERVER_01
    inservice

serverfarm host SUGGESTION-FARM
  probe TCP
  rserver SUGGESTION_SERVER_01
    inservice

class-map match-all WWW-VIP
  2 match virtual-address 192.168.20.10 tcp eq www

class-map type http loadbalance match-any LOGIN
  2 match http url /login
  3 match http url /register
  4 match http header Host header-value login.example.com

class-map type http loadbalance match-any SUGGESTIONS
  2 match http url /suggestions

policy-map type loadbalance first-match SLB_LOGIC
  class LOGIN
    serverfarm LOGIN-FARM
  class SUGGESTIONS
    serverfarm SUGGESTION-FARM
  class class-default
    serverfarm WWW-FARM

policy-map multi-match CLIENT_VIPS
  class WWW-VIP
    loadbalance vip inservice
    loadbalance policy SLB_LOGIC
    loadbalance vip icmp-reply

Let me know if this answers your question.

Thanks,

Sean

Sorry, forgot to supply the link to the Defining a URL for HTTP Load Balancing chapter.

Sean

Sean,

Thanks.

So, if I have three known URIs, am I correct in saying that I should be able to use the one serverfarm and then the one class-map with the IP and then add the multiple uris to it?  Or, do I need to have a second serverfarm and class-map?

Thanks,

Dave

serverfarm host WWW-FARM
  probe TCP
  rserver WWW_SERVER_01
    inservice
  rserver WWW_SERVER_02
    inservice
 

class-map match-all WWW-VIP
  2 match virtual-address 192.168.20.10 tcp eq www

  3 match http url /site1
  4 match http url /site2
  5 match http url /site3

Hi,

your are mixing things up here. You cannot combine the matching of a VIP address with the mathing of an HTTP URI.

The class-map that matches a VIP address is a layer3/4 class-map. It maches IP Address + port numbers.

The class-map that matches HTTP URI or other HTTP headers for example is a layer7 class-map

You will need something like this:

serverfarm host WWW-FARM
  probe TCP
  rserver WWW_SERVER_01
    inservice
  rserver WWW_SERVER_02
    inservice

class-map match-all WWW-VIP-L3
  2 match virtual-address 192.168.20.10 tcp eq www


class-map type http loadbalance match-any WWW-VIP-L7

  3 match http url /site1
  4 match http url /site2
  5 match http url /site3


policy-map type loadbalance first-match WWW-VIP-PM

class  WWW-VIP-L7

serverfarm WWW-FARM


policy-map multi-match VIPS

class WWW-VIP-L3

  loadbalance vip inservice
  loadbalance policy WWW-VIP-PM
  loadbalance vip icmp-reply active

HTH,

Dario

Dario,

Thanks for straightening me out on that, I see it now.

Dave

Hi Dave,

In addition to Dario's comment, you mention multiple sites.  So with the example config you currently have from this thread, it would assume the following:

www.example.com/site1

www.example.com/site2

www.example.com/site3

However, if you truly have multiple sites, and not just multiple URLs representing a different site, such as:

www.site1.com

www.site2.com

www.site3.com

Then your layer-7 class-map might look something more like this:

class-map type http loadbalance match-any MULTI-SITE
  2 match http header Host header-value www.site1.com
  3 match http header Host header-value www.site2.com
  4 match http header Host header-value www.site3.com

HTH,

Sean

Sean,

I will be using the same FQDM just different /uris, so this is what I am configuring:

class-map type http loadbalance match-any WWW-VIP-L7

  3 match http url /site1
  4 match http url /site2
  5 match http url /site3

I also have a question about the class statement, do I add another class statement the same way you add another when using multplie ports to the same VIP?

class application-URL-80-CLASS

loadbalance vip inservice

loadbalance policy WWW-VIP-L7

loadbalance vip icmp-reply

nat dynamic 22 vlan 424

appl-parameter http advanced-options CASE_PARAM

Thanks again,

Dave

Hi Dave,

Your config will look like the one that Dario provided.  The classes added under the multi-match policy are your layer3/4 classes.  Your three sites are within a layer-7 class-map, which is used within a service policy (layer-7 policy-map), which is applied to the layer3/4 class-map.

I hope I haven't just confused you  ;- )

Thanks,

Sean

Sean,

Maybe a little confused.

I have built the new serverfarm, policy-map and class-map in bold, I am just not sure how it gets referenced. Do I add it to the multi-match class statement?  My complete config for this particular app is below.

Thanks,

Dave

serverfarm host application-80

  rserver server1 80

    probe server-80-PROBE

    inservice

  rserver server2 80

    probe server-80-PROBE

    inservice

serverfarm host application-L7

  rserve rserver1 80

    probe server-80-PROBE

    inservice

  rserver server2 80

    probe server-80-PROBE

    inservice

class-map match-all application-80-CLASS

  2 match virtual-address 1.1.1.1 tcp eq www

class-map type http loadbalance match-any application-L7-CLASS

  3 match http url /uri1/

  4 match http url /uri2/uri2

  5 match http url /uri2/uri3.htm

policy-map type loadbalance first-match application-80-POLICY

  class class-default

    sticky-serverfarm application-80-STICKY

    insert-http X-Forwarded-For header-value "%is"

policy-map type loadbalance first-match application-L7-POLICY

  class application-L7-CLASS

    serverfarm application-L7

policy-map multi-match POLICY-424

class application-80-CLASS

    loadbalance vip inservice

    loadbalance policy application-80-POLICY

    loadbalance vip icmp-reply

    nat dynamic 22 vlan 424

    appl-parameter http advanced-options CASE_PARAM

Hi Dave,

Is your newly added config going to the same VIP 1.1.1.1:80  ?

Sean

Sean,

Yes, same VIP.

Dave

Okay, then.  You don't need a separate Layer-7 policy-map then.  You would do it something like this:

serverfarm host application-80
  rserver server1 80
    probe server-80-PROBE
    inservice
  rserver server2 80
    probe server-80-PROBE
    inservice
serverfarm host application-L7
  rserve rserver1 80
    probe server-80-PROBE
    inservice
  rserver server2 80
    probe server-80-PROBE
    inservice

class-map match-all application-80-CLASS
  2 match virtual-address 1.1.1.1 tcp eq www

class-map type http loadbalance match-any application-L7-CLASS
  3 match http url /uri1/
  4 match http url /uri2/uri2
  5 match http url /uri2/uri3.htm

policy-map type loadbalance first-match application-80-POLICY
  class application-L7-CLASS
    serverfarm application-L7

  class class-default
    sticky-serverfarm application-80-STICKY
    insert-http X-Forwarded-For header-value "%is"

policy-map multi-match POLICY-424
  class application-80-CLASS
    loadbalance vip inservice
    loadbalance policy application-80-POLICY
    loadbalance vip icmp-reply
    nat dynamic 22 vlan 424
    appl-parameter http advanced-options CASE_PARAM

This way, your three sites will be load-balanced to one serverfarm, and all the rest of the traffic would be load-balanced to the default serverfarm.

Hope this clears it up.  Let me know if it doesn't.

Sean

Sean,

That definitely clears it up, I will add it to the ACEs and test it later today.  Thanks for all your help.

Dave

Additionally,  your URLs will only be matched if they are exactly what you have:

class-map type http loadbalance match-any application-L7-CLASS
  3 match http url /uri1/
  4 match http url /uri2/uri2
  5 match http url /uri2/uri3.htm

If your clients may start their connection to a URL that only begins with those listed above, then you may want to add wildcards to the end using regular expressions, as such:

class-map type http loadbalance match-any application-L7-CLASS
  3 match http url /uri1/.*
  4 match http url /uri2/uri2.*
  5 match http url /uri2/uri3\.htm

HTH,

Sean

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: