I recently had a requirement to build a non-persistent VMware View desktop pool that acted as if the linked-clone virtual desktops had static computer names with static IP addresses. The reason was that the vendor of a particular clinical application ties its licensing to both the computer name and its IP address. If they don’t match a predefined table, the client application won’t launch.
Try DHCP Reservations
By default, VMware View non-persistent (floating) desktop pools rely on DHCP. My first idea was to build a new DHCP scope for this desktop pool that made use of DHCP Reservations (DHCP reservations are permanent lease assignments that are used to ensure that a specified client on a subnet can always use the same IP address).
My problem was that DHCP Reservations work by configuring a specific IP address to a specific MAC address. Unfortunately, non-persistent desktops receive a new MAC address upon rebuild or recompose — which ruled out this option.
Try Scripting the Solution
After toying with the idea of using Group Policy Preferences with Item Level Targeting that references the NetBIOS Name, I decided it would be easier just to script the solution.
In VMware vCenter, I gave my parent virtual machine a second vNIC that I’ll use for the static IP and scripting solution. The first vNIC will remain DHCP.
When building a desktop pool in VMware View there is an option to run a Post-Synchronization Script. The solution I ended up going with was to create a script that will change the IP address of the virtual machine after it is built via the NETSH command. The script has to reside on your Parent Virtual Machine.
I created a .BAT file that looks something like this (each IF should begin a new line):
IF %computername%==VDI-GETRAIN-1 NETSH interface ip set address name="Local Area Connection" static 18.104.22.168 255.255.255.0 22.214.171.124 1 IF %computername%==VDI-GETRAIN-2 NETSH interface ip set address name="Local Area Connection" static 126.96.36.199 255.255.255.0 188.8.131.52 1 IF ... etc ...
Summary of Static IP Addresses in a VMware View linked clone pool
Here is what happens when VMware View builds a new desktop in this pool:
- VMware View names the desktop VDI-GETRAIN-1 to VDI-GETRAIN-20 as defined in VMware View
- Desktop receives a new virtual MAC address as normal
- Desktop receives a new IP address as determined by the DHCP server
- VMware View is done building the desktop and then runs the Post-Synchronization Script
- The Post-Synchronization Script changes the virtual machine’s IP address to a value that matches its computer name
- The computer name and IP address are now consistent and remain unchanged each time the desktop or pool is refreshed or recomposed
- Now that computer name and IP appear to be static, the vendor’s application meets the licensing requirements and launches properly
If you have also needed static IP addresses in a floating VMware View linked clone desktop pool but engineered a different solution, I’d like to know.