09-08-2014 08:20 AM
Hi! I have the following question based on a new site requirement. The following sites use the same back end servers. Names changed to protect the innocent and my finger fumbling with pretty names for my actual config.
I have two real servers being load balanced: 10.0.0.1 and 10.0.0.2
They have:
Site A URL= www.testsite.com:80
Site B URL= www.newstuff.com:81
I want Site B answering on port 81 for anything referencing the URL match for either port :80, and :81, then redirect to :81 anything that is on :80.
I want Site A answering on port 80 for anything not referencing the Site B URL.
How do I split the traffic coming in while also redirecting if only needed for the one site?
Also, one further question, how do I handle monitoring the ports up for each as validation for the VIP? If either port goes down is that going to take both of them offline?
Solved! Go to Solution.
09-08-2014 08:48 AM
Hi,
Since they are two different URL's, they would be resolving to two different VIPs. You can create two serverfarms with same servers but listening on ports 81 and 80 and create a class-map for different IP's or even same IP, listening on port 81 and 80. Any client coming with port 80 as destination would be loadbalanced to serverfarm_80 and any client coming on port 81 as destination would be loadbalanced to serverfarm_81.
class-map match-all Test_80
2 match virtual-address 10.1.1.1 tcp eq www
class-map match-all Test_81
3 match virtual-address 10.1.1.2 tcp eq 81
rserver r1
ip address 10.0.0.1
inservice
rserver r2
ip address 10.0.0.2
inservice
serverfarm_80
rserver r1 80
inservice
rserver r2 80
inservice
serverfarm_81
rserver r1 81
inservice
rserver r2 81
inservice
policy-map type loadbalance http first-match http
class class-default
serverfarm serverfarm_80
policy-map type loadbalance http first-match http_81
class class-default
serverfarm serverfarm_81
policy-map multi-match Test
class Test_80
loadbalance vip inservice
loadbalance policy http
loadbalance vip icmp-reply active
class Test_81
loadbalance vip inservice
loadbalance policy http_81
loadbalance vip icmp-reply active
Let me know if you have any questions.
Regards,
Kanwal
Note: Please mark answers if they are helpful.
09-08-2014 11:29 AM
Hi,
Was thinking there:) Please add the below configuration to above and see if that is what you are looking for. Basically we are redirecting any request which will come on second URL with port 80 to 81.
class-map match-all Test_81_redirect
4 match virtual-address 10.1.1.2 tcp eq www
rserver redirect REDIRECT
Webhost-redirection http://%h%p:81
Serverfarm redirect Redirect
rserver REDIRECT
inservice
policy-map type loadbalance http first-match http_81_redirect
Class Test_81_redirect
Serverfarm Redirect
policy-map multi-match Test
Class Test_81_redirect
loadbalance vip inservice
loadbalance policy http_81_redirect
class Test_80
loadbalance vip inservice
loadbalance policy http
loadbalance vip icmp-reply active
class Test_81
loadbalance vip inservice
loadbalance policy http_81
loadbalance vip icmp-reply active
Regards,
Kanwal
Note: Please mark answers if they are helpful.
09-08-2014 08:48 AM
Hi,
Since they are two different URL's, they would be resolving to two different VIPs. You can create two serverfarms with same servers but listening on ports 81 and 80 and create a class-map for different IP's or even same IP, listening on port 81 and 80. Any client coming with port 80 as destination would be loadbalanced to serverfarm_80 and any client coming on port 81 as destination would be loadbalanced to serverfarm_81.
class-map match-all Test_80
2 match virtual-address 10.1.1.1 tcp eq www
class-map match-all Test_81
3 match virtual-address 10.1.1.2 tcp eq 81
rserver r1
ip address 10.0.0.1
inservice
rserver r2
ip address 10.0.0.2
inservice
serverfarm_80
rserver r1 80
inservice
rserver r2 80
inservice
serverfarm_81
rserver r1 81
inservice
rserver r2 81
inservice
policy-map type loadbalance http first-match http
class class-default
serverfarm serverfarm_80
policy-map type loadbalance http first-match http_81
class class-default
serverfarm serverfarm_81
policy-map multi-match Test
class Test_80
loadbalance vip inservice
loadbalance policy http
loadbalance vip icmp-reply active
class Test_81
loadbalance vip inservice
loadbalance policy http_81
loadbalance vip icmp-reply active
Let me know if you have any questions.
Regards,
Kanwal
Note: Please mark answers if they are helpful.
09-08-2014 08:56 AM
I think I hosed up my description a bit. My apologies, Kanwal.
Those two servers are a load balanced pair. They answer for both URL's, but the destination port differs based on the URL. And anything for the Site B url on the wrong port :80, should get redirected to the right port :81.
I've done redirects before, but this one is more complicated as I have two different URLs being handled, and a different destination port based on the URL.
09-08-2014 11:29 AM
Hi,
Was thinking there:) Please add the below configuration to above and see if that is what you are looking for. Basically we are redirecting any request which will come on second URL with port 80 to 81.
class-map match-all Test_81_redirect
4 match virtual-address 10.1.1.2 tcp eq www
rserver redirect REDIRECT
Webhost-redirection http://%h%p:81
Serverfarm redirect Redirect
rserver REDIRECT
inservice
policy-map type loadbalance http first-match http_81_redirect
Class Test_81_redirect
Serverfarm Redirect
policy-map multi-match Test
Class Test_81_redirect
loadbalance vip inservice
loadbalance policy http_81_redirect
class Test_80
loadbalance vip inservice
loadbalance policy http
loadbalance vip icmp-reply active
class Test_81
loadbalance vip inservice
loadbalance policy http_81
loadbalance vip icmp-reply active
Regards,
Kanwal
Note: Please mark answers if they are helpful.
09-15-2014 05:26 AM
Kanwal,
Sorry for the late reply, I had to wait until our cutover window to try to apply this. For the most part, your configuration worked. In my rush to get things configured, I missed that you specified the port within the serverfarm definition. Without out that, it took some time for me to spot what I had missed.
Thank you again for the assistance and help, VERY much appreciated. I'm marking your answers complete now.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide