[VMwareLAB] – 3.the design

Time for the fun stuff šŸ˜€

On my previous posts (here and here) I talked about what made me decide to go for a physical server, the parts that I selected considering my budget and the lowest noise possible and today I will talk about the logical design behind the lab.

I will use my physical server mainly to host nested environments as I have plenty of resources for that. I can run multiple versions of the same product, destroy and recreate everything without having the need to reinstall the whole lab.

Without further ado, this is my lab

homelabv1

Now that you’ve seen it let’s talk a little bit about every component and why I do have them.

vCenter Server: vCenter Server Appliance with embedded PSC and it serves the purpose of being able to use instant clones and to clone VMs;

Windows Domain Controller: it serves as DNS/AD/DHCP for the first layer of VMs and for the nested environment;

Logical Router: using pfSense for routing and protection (firewall) the NESTED environment;

Automation VM: Ubuntu with Terraform/Ansible. Will be used for deploying the NESTED Env as well as some Kubernetes clusters;

Network-Attached Storage:Ā running Free-NAS to provide storage for the NESTED Env

NESTED Env: Instant clones from ESXi prebuilt and prepared for it, you can read all about that in VirtuallyGhettoĀ Later I will migrate the deployment from PowerCLI to Terraform.

Now for the network configuration

network

I know that this looks very simple for the great majority of you guys but if you are just starting and have no bases on how VMware works I hope this helps. With that being said let me explain the setup.

I have two switches right now switch0 and switch1.

vStandard switch 0 is for management, has one uplink, accommodates all the management VMs and it’s connected to the internet.

vStandard switch 1 serves the NESTED Env with no uplink so everything inside it is isolated from the outside world. Besides this, there are two VMs connected to it as well, Windows Domain Controller and Logical Router. The Logical Router, as the name suggests acts as a router between the NESTED Env and everything else if needed (internet, vCenter, network-attached storage…). I connected the Windows Domain Controller directly to this switch because I want for it to serve as a DHCP/DNS server for the NESTED Env which have a different IP range (172.21.30.0) from all the other VMs (192.168.0.0). In the future, I am thinking about letting the Logical Router do the DHCP part and disconnect the Windows Domain Controller but for now, let’s keep it like this.

And this covers the basic setup of the environment. On my next posts, I’ll show you guys how I installed and configure some of the components.

As always,

Have fun and KISS

Advertisements

[VMwareLAB] ā€“ 2.hardware

Now that I made my choice (good or bad only the future will tell) on my previous post and you can read all about it hereĀ it’s time to start the hunt for the hardware. At the end of the post, I’ll have the components list and the prices for each.

Because I want to keep the lab build the most budget effective as possible my main “shop” will be eBay šŸ˜€

First things first, the motherboard. After talking with some colleagues and doing some research I decided to go for the SUPERMICROĀ  X9DRi-LN4F+Ā mainly because it’s dual CPU, can go up to 1.5TB of RAM, has IPMI and supports vShpere 6.7U3. eBay was kind enough to provide me with a seller for this board with two passive coolers.

Now that I have the motherboard selected it’s time for the CPUs. I wanted to get some Intel Xeon E5 V2 Low Voltage version. A quick search on eBay led me to the E5-2650L v2 10Cores 1.7GHz, more than enough for what I need. And because I wanted to fill the sockets I bought two (the seller was selling a pack)

Time for the memory. Again Low Voltage one and preferably one of the ones from the compatibility list. Sk Hynix PC3L-10600R DDR3 1333MHz, ECC, HMT42GR7MFR4A-H9 was the ones I went for mainly because of value. I got 16 modules of 16GB (256GB) at a very nice price, at least I think it was.

So, the main components are already bought, nice job!!! Now the missing parts šŸ™‚

For disks, I selected theĀ WD Blue 3D SSD 500GB mainly because my local shop had a nice sale on them, got 2 (1TB SSD)

Because I’ll install this board on a “normal” ATX case, mainly because of noise reduction I had to select a power supply that would fit this case and becauseĀ  I didn’t want to get short, I got one Zalman ZM1000-GVM – 1000W and now I realize it’s bit overkill.

And now the thing that took the longest to find, the case. Because this board does not have a regular size EE-ATX (Enhanced Extended ATX) I was not able to find a “normal” desktop case that could hold this board and had without any tweaking. After researching for quite some time I went for the Corsair Carbide Quiet Air 740 High Airflow, it was a low noise, high airflow case and it could hold the EE-ATX, had to do some extra holes but all fits quite nice.

So, to sum it all up here is the list of the components I bought

Motherboard: SUPERMICRO X9DRi-LN4F+ Server Motherboard LGA 2011 +2 HEATSINKS – 243EUROS
CPU: Set of 2x IntelĀ® XeonĀ® Processor E5-2650L v2 25M Cache, 1.70 GHz – 90EUROS
RAM: 256GB Sk Hynix (16x16GB), 2Rx4 PC3L-10600R DDR3 1333MHz, ECC, HMT42GR7MFR4A-H9 – 223EUROS
Disk:Ā x2 WD Blue 3D SSD NAND 500GB – 2*65,5 =Ā 131EUROS
Power Supply: Zalman ZM1000-GVM – 1000W – 116EUROS
Case: Corsair Carbide Quiet Air 740 High Airflow – 132EUROS

In the end, everything was around 935EUROS

Considering that I have “enough hardware” for the upcoming years the price it’s not that high.

I hope I was able to make some light to some of you.

Next post I’ll show the assembly process and the fist my logical setup of the Lab itself.

As always,

Have fun and KISS

[VMwareLAB] – 1.first thoughts

A lot of has been written about building your own VMware LAB, nevertheless, I just wanna share my personal experience and maybe still help someone šŸ™‚

As a VMware enthusiast you, at some point in time had the need to test new products or features from VMware and found yourself without options for it.

Like many of you, I started with VMware workstation on my desktop, building a nested environment to try out simple features but soon realized the resources were just not there and that was the trigger to start thinking about alternatives.

There were a couple of options:

  1. Rent a physical server from an IaaS provider
  2. Use my friend’s lab (I have really nice friends)
  3. Upgrade my desktop to be used as a lab
  4. Buy dedicated hardware

Next step, defineĀ the Pros and Cons for each option.

1. Rent a physical server from an IaaS provider

PROS:

  • No need to worry about hardware
  • No electric bill
  • Easy and fastest setup times

CONS:

  • Not budget-friendly, even the cheapest one was too expensive
  • Limited hardware options (RAM, CPU, Disks)

2. Use my friend’s lab

PROS

  • Free or close to free (shared electrical bill)
  • Able to influence hardware upgrades

CONS

  • Be dependent on my friend’s goodwill
  • Don’t have full control of the Lab

3. Upgrade my desktop to be used as a Lab

PROS

  • Full control of hardware
  • Cheaper compared to 1st option
  • Just missing RAM

CONS

  • Hardware limitation (max 64GB RAM)
  • DDR4 it’s very expensive
  • Limit scalability

4. Buy dedicated hardware

PROS

  • Scalability
  • Customizable
  • Dedicated for the Lab

CONS

  • Big initial investment
  • Electic/Internet bill

Verdict

After breaking my piggybank I went for the 4th option.

Next steps are to actually select the hardware and assemble everything…

As always,

Have fun andĀ KISS

App Volumes – Office 365

appvolumes

After installing Office 365 32bits in a Windows 7 64bit everything seemed to work as expected.

But after attaching a writable volume to the VM, Macros on Office stopped working even if it was a cleanĀ writable volume (not used before).

VMware KB provided a walk aroundĀ for environments that use snapvol.cfg in Writable Volumes or in Appsatcks, but after trying to implement it, nothing changed, as soon as a writable volume is attached to the VM, Macros on Office365 stop working.

KB2145079(I will be using the Writable Volumes option but the same applies to Appstacks):

Writable volumes:
1. Attach writable volumes to a virtual machine.
2. Log in to the virtual machine as the administrator.
3. Open the computer management on the Windows machine.
4. Go toĀ StorageĀ >Ā DiskĀ Management.
5. Right-clickĀ CVWritableĀ and clickĀ Change Drive Letter and Paths.
6. Assign a drive letter to the CVWritable.
7. Copy theĀ snapvol.cfgĀ file fromĀ the root folder of CVWritable and paste it on other location, such as desktop.
8. Open theĀ snapvol.cfgĀ file using a text editor.
9. Add this entry:
################################################################
# Office 365 Virtual Registry exclusions
################################################################
exclude_registry=\REGISTRY\MACHINE\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY
10. Save and close theĀ snapvol.cfgĀ file.
11. Zip theĀ snapvol.cfgĀ file.
12. Go to the App Volumes Manager.
13. In the Volumes tab, clickĀ WritablesĀ tab and clickĀ UpdateĀ Writables.
14. Upload theĀ snapvol.cfg.zipĀ file to Update Writable volume.

After reading the walk around I noticed two things:

  1. Office 365 it’s not on 15.0 but instead on 16.0
  2. The path for the exclude_registry does not fully exist

After a quick search, I found that the REGISTRY folder is not under

\REGISTRY\MACHINE\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY

but instead

Ā \REGISTRY\MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY

So after changing:

exclude_registry=\REGISTRY\MACHINE\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY

to (removing the 15.0)

exclude_registry=\REGISTRY\MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY

log off and log on again, Office 365 Macros are working as they are intended to.

I hope this helps someone that is facing the same issue!

Script – Get VMs created, deleted or modified on vCenter

powercli

A while back someone asked me if i could tell him who deleted a vm and when.

I was able to get the information but it took me quite some time digging in the events.

After this request I was asked to create a script that would send an email every day with the VMs that were created, deleted or modified.

So this is what I came up with:

Connect-VIServer localhost
$Yesterday = (Get-Date).AddDays(-1).ToString('MM-dd-yyyy')
$Yesterday2 = (Get-Date).AddDays(-2).ToString('MM-dd-yyyy')
Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(-1) |where {$_.Gettype().Name-eq "VmRemovedEvent" -or $_.Gettype().Name-eq "VmCreatedEvent" -or $_.Gettype().Name-eq "VmReconfiguredEvent"} |Sort CreatedTime -Descending |Select CreatedTime, UserName,FullformattedMessage | Export-Csv D:\Scripts\VMReport\$Yesterday.csv -NoTypeInformation
#defining file
$file = "D:\Scripts\VMReport\$Yesterday.csv"
$att = New-Object Net.Mail.Attachment($file)
$smtpServer = "smtpServerName.com"
$smtpFrom = "VMware Report <vmware_report@domain.com>"
$smtpTo = "e-mail address 1 <emailaddress1@domain.com>, e-mail address 2 <emailaddress2@domain.com>"
$messageSubject = "Changes on VMs"
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.IsBodyHTML = $true
$message.Body = "VMs created, deleted or modified on VCenter"
$message.Attachments.Add($att)
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)
Remove-Item D:\Scripts\VMReport\$Yesterday2.csv

Now the explanation

Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(-1) |where {$_.Gettype().Name-eq "VmRemovedEvent" -or $_.Gettype().Name-eq "VmCreatedEvent" -or $_.Gettype().Name-eq "VmReconfiguredEvent"} |Sort CreatedTime -Descending |Select CreatedTime, UserName,FullformattedMessage | Export-Csv D:\Scripts\VMReport\$Yesterday.csv -NoTypeInformation

Get-VIEvent from the vCenter from the day before where the event is equal to removed (VmRemovedEvent), created (VmCreatedEvent) or modified (VmReconfiguredEvent)VMs

The result is sorted by date and it’s exported to a csv file named with the date of a day before.

And this is it from VMware side.

The next part is to send the file by email Ā (normal powershell scripting)

$file = "D:\Scripts\VMReport\$Yesterday.csv"
$att = New-Object Net.Mail.Attachment($file)
$smtpServer = "smtpServerName.com"
$smtpFrom = "VMware Report <vmware_report@domain.com>"
$smtpTo = "e-mail address 1 <emailaddress1@domain.com>, e-mail address 2 <emailaddress2@domain.com>"
$messageSubject = "Changes on VMs"
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.IsBodyHTML = $true
$message.Body = "VMs created, deleted or modified on VCenter"
$message.Attachments.Add($att)
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)
Remove-Item D:\Scripts\VMReport\$Yesterday2.csv

In the end it removes the file from two days back.

I hope this helps you in some way.

 

AppStack packages migration

appvolumes

App Volumes by VMware provides, in the fly, application delivery to virtualized desktop environments.

This application delivery system allows applications to be delivered to virtualized desktop environments based on profiles using VMDK virtual disks without modifying the Virtual Machine or applications themselves.

App Volumes v. 2.xx has some issues when you try to migrate AppStack packages from one site to another using vSAN storage.

1. Find the AppStack you want to move and Copy the name of the package

1

For you to be able to migrate the AppStack packages from one site to another you need inĀ the original site to create a VM, name it exactly as the AppStack package and attach the VMDK file of the AppStack package you want to migrate as a new disk.

3

After this process is completed you need to clone the machine to the new datacenter and use the same name as the previous one.

4

Now that you have the new VM on the new the VMDK file needs to be copied to VSAN.

To do this you’ll need to run the following command on the destination ESXi that has the VM


vmkfstools -d thin -i /vmfs/volumes/VSAN_FOLDER/NAME_OF_THE_APPSTACK_PACKAGE/NAME_OF_THE_APPSTACK_PACKAGE.vmdk /vmfs/volumes/VSAN_FOLDER/cloudvolumes2/apps/NAME_OF_THE_APPSTACK_PACKAGE.vmdk

You should get an output

Clone: 100% done.

You also need to copy the metadata from the original VSAN storage to the destination VSAN storage

After this procedure is completed you are able to Import the AppStack package to App Volumes on the new site

5

6

Congratulations you now have replicated an AppStack Package stored in vSAN between two sites.

Now it’s time to delete the VMs you have just created.

On the new site just delete the VM and the disk because you have copied it to a new location.

On the original site detach the disk and delete the VM.

I hope this was clarifying enough.

Get VM name with specific MAC Address

-Recently I got a request to get a virtual machine (vm) name using only the network interface MAC Address.

After search for some scripts I could not find one that really worked for me so I put my brain to work and this is what I came up:

get-vm | get-networkadapter | Where-Object { $_.macaddress -eq "00:50:56:XX:XX:XX"} | select parent, macaddress

A brief description on how it’s working

get-vm -> gets all VMs on the vSphere server.

get-netwrokadapter -> gets the nertwork adapter properties as name, type, macaddress…

$_.macaddress -eq -> for each networkadapter it is going to compare the MACs and if they are equal it is going to be printed out

The output should be something like this:

55a15d7e5c007131