Load Balancing with LVS to Linux & Windows Servers
Building Load Balanced Services using Linux Virtual Server (LVS) configured using Direct Routing (DR) with both Linux and Windows Real Servers (RS). Can it be done? Yes it can! I had a requirement. I had to build a bunch of load balanced services running on a combination of
Linux Servers and Windows Servers. Now most configurations you read about like this are using
LVS configured with NAT to do the packet routing, as it's pretty simple and straight forward to get
working. However we wanted to use Direct Routing (DR) rather than NAT.
Now if you are just using Linux based real servers then you will find that it's been done before and is pretty straight forward. It's basically a case of configuring the loopback adapter on the Linux box with the IP address of the virtual service, so that the linux box will accept packets destined for the virtual service. Configure LVS to accept and forward packets for the virtual service (on the virtual IP address) to the Linux Real Servers they will accept and process packets as desired.
When it comes to using Windows servers as the real servers it becomes a little more tricky.
The concept is, however, exactly the same as configuring the
Linux Real Servers. That is, you need to configure a loopback adapter on the Windows nodes
with the IP address of the virtual service.
The trick with the configuration of the windows nodes is that windows will not
let you create an IP address on the loopback adapter with a /32 netmask, while Linux will. So you need
to create the IP address on the loopback adapter with a /30 netmask. This enforces
a restriction on the allowed IP address you can use for your virtual services. You can no longer use
consecutive IP addresses for different virtual services, but must use IP addresses that fall within the
ranges defined by /30 subnet mask