VMware
1 2 Previous Next 19 Replies Last post: Oct 5, 2009 7:43 AM by Rajeev S  

VDI: Free Connection Broker posted: Sep 19, 2006 8:34 AM

Click to view nick.couchman's profile Champion 4,969 posts since
Jan 13, 2006
This solution covers creating a VDI connection broker for a set of Windows XP VM's with tools provided in most standard Linux installations.

Here's are a list of assumptions and requirements:
1) Linux server, stock kernel with LVS/IPVS enabled.
2) IPVSADM installed on Linux server (check your package manager).
3) VM's set up on one or more servers in bridged mode.

How-To:
1) Create your VM's, set up in bridged mode, and assign them IP addresses.
2) Go to the server you're going to make the connnection broker, and use the IPVS admin tool to create a new virtual server service with a virtual IP and port number. If the virtual IP is different from this servers real IP address, the virtual IP will have to be added to the network card as an IP alias. For this document, we'll say that your connection broker and your virtual IP address are both going to be 192.168.10.10.
[code]
ipvsadm -A -t 192.168.10.10:3389
[/code]
This will create a new virtual service on port 3389 (the MS Terminal Services port) listening on the IP address associated with the connection broker.
3) In each of your XP VM's, go to the "Add Hardware" wizard, add a new device, and don't let XP search for the device (say that you'll specify the device). Select "Network Adapters" and then locate and select the "Microsoft Loopback Adapter." Once you've added this piece of hardware, go to the TCP/IP properties for the new network interface and assign a static IP address. The static IP should be the IP of your virtual service - in this case, 192.168.10.10.
4) On your connection broker machine, add each of the XP VM's to the IPVS table as real servers for this virtual service. In our case, we'll assume that the XP VM's have IP's 192.168.10.20 through 192.168.10.29. The commands would go something like this:
[code]
# ipvsadm -a -t 192.168.10.10:3389 -r 192.168.10.29:3389 -x 1
[/code]
Notice the "-x 1" on the end of each command. This option sets the "upper threshold" (maximum number of connections to the service) to "1" so that each of your XP VM's only gets 1 connection. Additional users that attempt to connect after all of the servers have 1 connection will be denied a connection.
5) All done - you should be able to open an RDP connection to 192.168.10.10 (insert your virtual IP address here) and get connected to one of the XP VM's. Use the "ipvsadm -l" command to see which of your real servers has a connection to it. Open multiple connections to see that you get placed on a different VM each time!

-Notes-
*) If you're familiar with other high-availability/load-balancing projects, like keepalived, you can use these programs to dynamically add and remove XP VM's from the list of available VM's as the VM's are brought online or taken offline. Also, many of these programs feature the ability to have multiple "connection brokers" that can back each other up in case one of them goes down (a good idea in a production environment).
*) This little how-to assumes a lot about knowledge of Linux and administration tasks of Linux. More detailed information on LVS/IPVS can be found at http://www.linuxvirtualserver.org. Information on keepalived can be found at http://www.keepalived.org. For Linux administration information of all kinds, see http://www.tldp.org.

Re: VDI: Free Connection Broker

1. Sep 19, 2006 1:30 PM in response to: nick.couchman
Click to view Ken.Cline's profile Champion 5,146 posts since
Jul 7, 2004
Nick - great information, thanks for sharing!

Re: VDI: Free Connection Broker

2. Dec 12, 2006 6:05 AM in response to: nick.couchman
Click to view tom howarth's profile Guru 7,322 posts since
Jul 25, 2005
Which flavour of Linux did you use for this?
can LVS\IPVS be clustered for HA.
and next question was the broker on a physical or virtual machine?

I am going to have a dabble at this to get upto speed. ;)

Re: VDI: Free Connection Broker

3. Dec 21, 2006 4:29 PM in response to: tom howarth
Click to view andy.mac's profile Hot Shot 329 posts since
May 5, 2005
And of course the obvious question:
Could you make this available as a Virtual Appliance?

Re: VDI: Free Connection Broker

4. Dec 23, 2006 2:38 PM in response to: nick.couchman
Click to view bertdb's profile Master 1,332 posts since
Sep 13, 2005
I love it ! Congratulations on the implementation, and thanks for sharing it with us !

Re: VDI: Free Connection Broker

5. Jan 15, 2007 8:04 PM in response to: andy.mac
Click to view GBromage's profile Expert 414 posts since
Jun 14, 2006
Amen to the Virtual Appliance idea!

But, thanks for your expertise in any case.

So, do the clients maintain the connection to the linux machine, which routes the packets, or are they talking directly to the hosted VDI machine?

Re: VDI: Free Connection Broker

6. Jan 16, 2007 1:53 AM in response to: GBromage
Click to view bertdb's profile Master 1,332 posts since
Sep 13, 2005
gbromage,
all packets sent between client and VM go through the Linux machine with this setup.

Re: VDI: Free Connection Broker

7. Jan 16, 2007 8:17 PM in response to: bertdb
Click to view GBromage's profile Expert 414 posts since
Jun 14, 2006
Thanks.

My concern was that this made the connection broker a single point of failure if it went down. (No comments/flamewars about Linux vs Windows stability, please - I already know!)

1) If it happend, presumably all of the clients would lose their connections?
2) What state would that leave the virtual desktops in? Given that RDP would try to auto-reconnect, with no guarentee it would reconnect to the same box?

Re: VDI: Free Connection Broker

8. Jan 22, 2007 10:00 PM in response to: nick.couchman
Click to view GBromage's profile Expert 414 posts since
Jun 14, 2006
I've been playing with this a bit more and come up with something which, in retrospect, is pretty obvious:

If, as in the example, the connection broker's virtual IP address is the same as the server's real IP address (192.168.10.10) then using keepalive, or any other ping/port checking stuff won't work.

Any attempt by the connection broker to ping the virtual machine directly will result in the packet going to the virtual machine, and the VM will try to respond via the Loopback adapter. So the reply packets will never get back to the broker.

Re: VDI: Free Connection Broker

9. Feb 13, 2007 9:38 PM in response to: nick.couchman
Click to view Jasemccarty's profile Champion 3,806 posts since
Apr 5, 2005
Now someone just needs to make a Virtual Appliance of it.

Re: VDI: Free Connection Broker

10. Feb 15, 2007 4:37 AM in response to: Jasemccarty
Click to view brithd's profile Lurker 3 posts since
Sep 3, 2006
I would offer but I have zero time at the moment...

Re: VDI: Free Connection Broker

11. Feb 15, 2007 5:20 AM in response to: Jasemccarty
Click to view tom howarth's profile Guru 7,322 posts since
Jul 25, 2005
looks like you just volunteered ;) go on you know you want too!!!

Re: VDI: Free Connection Broker

12. Feb 15, 2007 5:34 AM in response to: tom howarth
Click to view Jasemccarty's profile Champion 3,806 posts since
Apr 5, 2005
Well, I'm really rusty in Linux...

And with 3 jobs, it is a little hard to find extra time...

Re: VDI: Free Connection Broker

13. Feb 15, 2007 9:06 AM in response to: Jasemccarty
Click to view andy.mac's profile Hot Shot 329 posts since
May 5, 2005
LOL - I only have one (paid) job, but that's enough.
If my ISP has managed to get my DSL working at home I might have a look at it at some stage.

-No promises though...

Andy

Re: VDI: Free Connection Broker

14. Feb 21, 2007 6:57 AM in response to: nick.couchman
Click to view williaa's profile Lurker 2 posts since
Feb 21, 2007
I've been using that solution for awhile now. Works great, but I wonder how do you get around some of the limitations of using RDP in XP? Using this solution, if a user connects to XP with RDP, and later disconnects without logging out, the machine locks, the session closes, and the locked XP machine gets added back into the pool. If another user comes along, and is assigned that machine he won't be able to login (since it is locked), and if the original user comes back into the system looking for the locked machine, he will have to try several times before being assigned to it.

We addressed the issue with several scripts to monitor when connections are dropped and then remotely logout the XP VMs, but I'm wondering if you know a better way.

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities