Author Archives: Stephan

Adding an Identity Source (LDAP) – Username Format Error

I recently needed to validate some permissions using LDAP as an identity source. I hadn’t actually had a need to add an identity source to my Lab until now, so I set about adding my lab domain as a source, but hit the following error when trying to add it.

‘Check the network settings and make sure you have a network access to the identity source’

To start, I looked at connectivity, firewall rules, DNS forward and reverse lookup zones but still had the issue. It was none of these…

The issue? It was the format of the username… I originally used the format ‘domain\user‘. This doesn’t work. You need to use ‘user@domain‘ !

As soon as I changed the format, the source added successfully.

Some VMware links on setting up identity sources if you need some extra info –

https://docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.psc.doc/GUID-B23B1360-8838-4FF2-B074-71643C4CB040.html

https://docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.psc.doc/GUID-B23B1360-8838-4FF2-B074-71643C4CB040.html

Hopefully this is useful to anyone facing this problem!

Thanks for reading.

Deploying Custom Virtual Standard Switches for Management

I have been rebuilding my lab hosts a lot lately! Once because I fiddled too much with my vSAN cluster and killed it… Another more interesting occasion being the release of VCF 4.0 on VMUG and beginning the deployment of this!

I prefer to use Standard vSwitches for my management network in my labs and needed a quick and easy way to get the hosts back online with minimal effort. One thing I don’t like is seeing vSwitch0… I prefer seeing useful and descriptive naming, like I’m sure many others do!

Below are a few lines of PowerCLI to quickly and easily create a new vSwitch using a spare VMNIC (you should be using more than one physical NIC for resiliency), then migrate the Management VM Kernel adapter and original VMNIC over to it, followed by a clean up of vSwitch0.

#Variables
<#ESX Host to target#> $ESXHost = "ESX102.lab.local"
<#Name of the Management Switch#> $ManagementSwitchName = "vSS_Management"
<#vmnic to be used for Management Switch#> $ManagementSwitchNIC = "vmnic1"
<#MTU size for Management Switch#> $ManagementSwitchMTU = "1500"
<#Name of the Portgroup for the VMKernel Adapter#> $ManagementVMKPortGroupName = "vSS_VMK_Management"
<#Name of the PortGroup for VM's#> $ManagementPGSwitchName = "vSS_PG_Management"
 
<#Management VMKernal Nic to be migrated#>$vNic = "vmk0"
<#Management VMKernel assosiated pNic#>$PhysiscalNic = "vmnic0"
<#Old vSwitch#> $OldvSwitch = "vSwitch0"
 
#New Standard Management Switch
$NewSwitch1 = New-VirtualSwitch -VMHost $ESXHost -Name $ManagementSwitchName -Nic $ManagementSwitchNIC -mtu $ManagementSwitchMTU
$NewSwitch1 | New-VirtualPortGroup -Name $ManagementVMKPortGroupName -VLanId 0
$NewSwitch1 | New-VirtualPortGroup -Name $ManagementPGSwitchName

Once the new vSwitch is in place, the next block of code migrates the Management VM Kernel adapter and the VMNIC over to it.

#Migrate Mangement VMKernel Adapter
$mgmt_vmk = Get-VMHostNetworkAdapter -VMHost $ESXhost -Name $vNic
$pnic = Get-VMHostNetworkAdapter -VMHost $esxhost -Name $PhysiscalNic
Add-VirtualSwitchPhysicalNetworkAdapter -VirtualSwitch $NewSwitch1 -VMHostPhysicalNic $pnic -VMHostVirtualNic $mgmt_vmk -VirtualNicPortgroup $ManagementVMKPortGroupName -Confirm:$false

Now the clean up block. This removes the now redundant vSwitch0.

#Remove Original vSwitch0
Remove-VirtualSwitch -VirtualSwitch (Get-VirtualSwitch -VMHost $ESXHost  | Where-Object {$_.Name -eq $OldvSwitch}) -Confirm:$false

Note: If you have more than two VMNIC’s associated with the vSwitch, you will need to adjust this to include them.

Thanks for reading.

Home Lab – Equipment and Software: Part 1

Thanks for coming back! If you missed the first post in my Home Lab series you can find it here.

In this post I will begin drilling into the equipment and software that makes up my Home Lab and my reasoning for these choices.

I’m going to skip the original Raspberry Pi, there are enough blogs covering the use cases for them and begin at the first significant device; my MacBook Pro (late 2013). I wanted something mobile to start with so I could take it to work, use it on commutes to other offices etc. The MacBook came with an Intel i7 2.3Ghz Quad core chip, 16GB of memory and a 512GB SSD. This wasn’t going to be able to run everything, but its enough to run what I need when I’m away from home.

Before I dive into the VM’s and nested hosts, lets look at the networking configuration I used in VMware Fusion. I created four custom networks in total. One being a Management network for my ESXi Hosts and my VCSA. The second for vMotion and the other two as guest VM networks. None of these networks are NAT’d or have DHCP enabled, however I have selected the ‘Connect the host Mac to this network option in the VMware Fusion Preferences for the management network.

There are two ways to set these custom networks up. The first being the UBER Network Fuser and the second, editing the VMWare Fusion network file. In ‘/Library/Preferences/VMWare Fusion’, you will find the file called ‘networking’.

There are guides already available if you search google for either option so I won’t go into this further. This is the one I used – https://tinyurl.com/y7cjkhky.

Now onto the virtual machines. Running directly on VMware Fusion, I have a Windows Domain Controller / DNS Server, a PFSense firewall and two 6.7 ESXi hosts. They all use local storage, including the ESXi Datastores. My PFSense virtual firewall provides my layer 3 routing and eventually interfaces with my physical firewall. The Domain Controller/DNS Server is a ‘standard’ deployment, nothing special. The two ESXi hosts are the standard 6.7 image available from the VMUG Advantage subscription. Check out the last post for more on VMUG.

Then within ESXi, there’s my vCenter Appliance and the DR node of my vSphere Replication Appliances. At this point you might be wondering how I have fit this into 16GB of memory…

To start with, I built the first ESXi host with 12GB of memory and deployed my vCenter appliance on this (the tiny appliance requires 10GB). Once I had successfully deployed the appliance, I reduced the vCenter memory to 6GB and then followed this by reducing the ESXi host to 7GB.

I then created the second ESXi host, which also has has 7GB allocated. Its a tight squeeze but it allows me the basics I need when I’m not at home and there’s still enough room for some small VM’s with the nested ESXi hosts if needed.

One final thing… To ease the starting and suspension of this lab, I use the following script that I run from PowerShell on the Mac.

Lab_Start_Up

Write-Host "Starting PFSense Firewall"
vmrun start "/Users/<Path_to_VM>/PFSense.vmwarevm" nogui
Write-Host "Starting DC01"
vmrun start "/Users/<Path_to_VM>/DC01/DC01.vmwarevm" nogui
Write-Host "Starting ESX01"
vmrun start "/Users/<Path_to_VM>/ESX01/ESX01.vmwarevm" nogui
Write-Host "Starting ESX02"
vmrun start "/Users/<Path_to_VM>/ESX02/ESX02.vmwarevm" nogui

Write-Host "Start Up Complete!"

Lab_Supend

vmrun suspend "/Users/<Path_to_VM>/ESX02/ESX02.vmwarevm"
vmrun suspend "/Users/<Path_to_VM>/ESX01/ESX01.vmwarevm"
vmrun suspend "/Users/<Path_to_VM>/DC01/DC01.vmwarevm"
vmrun suspend "/Users/<Path_to_VM>/PFSense.vmwarevm"

Write-Host "Suspension Complete!"

That wraps up the high level MacBook Pro setup. Thanks for reading!

Downgrading VM Hardware Version

Having to downgrade a VM’s hardware version or compatibility level is something that comes up now and again.  There are many reasons you may need to do this; being it moving a VM to an environment with an older version of vSphere, or having issues following a planned upgrade that you now no longer have a snapshot for.

There are 3 VMware supported ways to downgrade which you can find in this VMware KB – https://kb.vmware.com/s/article/1028019

Let’s take a look at the options.

Revert to a previous snapshot.

Now this is only of use if you took a snapshot in the first place… If this is a planned upgrade, I would hope one was taken! However, you could have performed the upgrade and removed the snapshot before discovering the defect which is leading you to return to a lower hardware version.

If you do have an appropriate snapshot, reverting to it is a viable option.  You can achieve this by the usual means.  Right click the VM, hover over the Snapshot option and either select revert to snapshot, or manage snapshots if you have more than one or aren’t sure.

VMware vCenter Converter.

Another option is the VMware vCenter Converter.  This is a free tool available from VMware that can perform a number of conversion tasks.  One of these is the ability to copy the original VM to ‘another’ but allowing changes to the VM ‘hardware’ such as the hardware version, disk sizes, disk provisioning (Thick or Thin), CPU and memory changes and much more. (more info here —-). You also get the option to power off the original and power on the new as it completes.  This method reduces downtime but can be heavy going with high IO machines , in fact I wouldn’t do it with high IO machines.

Once your conversion is complete, you can then delete original. This is a great option with a simple to follow wizard, however it can take a fair amount of time to complete depending on the size of the VM.

Original VM, Hardware Version 14.

During the conversion you will need to have either renamed the original VM inventory name, or use a temporary name during the conversion, which, you can return to the original name once you delete the original.

You have the option to select any hardware version

Now power off, rename back to the original name and perform a storage vMotion to rename the files on the datastore.

Detaching and Re-Attaching the disks.

This is my personal preferred method! If I only need to modify the VM hardware version, this is my go to.  This involves creating a new VM with no hard disks and then attaching the disks from the original VM. This approach is particularly useful when your VM has large disks.  Lets go through the process.

Create a New Virtual Machine giving it a temporary name, the required hardware version, and  matching CPU, memory, SCSI controllers and network adapters.  One additional setting you will need to take care with is that you match the Firmware option.  Don’t worry about adding any hard disks. NB: If you have any dependencies for the original MAC addresses, if you take this route, you will need to note them and manually assign them to the new adapaters.

Now, ensure you have a backup, as you should do before any work, and take a snapshot the original VM to give you a fast rollback should you need it (quiesce the memory if you so wish). Power off the VM and rename it, <name>_old for instance.

Edit the VM settings and note the location of the disk(s).

Detach the hard disk(s), ensuring NOT to tick the option to delete from datastore (that will ruin your day…) 

Now edit the new VM settings and attach an existing disk

Browse to the disk(s) location and attach the disks starting with the OS disk first.

Power on and you have now downgraded the hardware version. If you are using static IP addresses, be prepeared to reassign these.

So we now have a bit of cleaning up to do… The inventory name is incorrect and the disks aren’t stored with the VM.  

You now need to power the VM off, rename it to the original name and perform a storage vMotion to rename and move all the VM files and disks into a single folder on the datastore.

When conducting any change, always ensure you have a backup and a valid rollback should something not go as planned!

Thanks for reading.

Home Lab – The Beginning

Home Labs are a fantastic way to do all manor of things from the comfort of your home. Ranging from home automation, file storage, home media streaming, learning how to build a website, learning a new operating system or exploring new technologies. My lab is mainly an VMware testing and learning lab.

Home Labs can come in many forms and sizes. From Raspberry PI’s to a full rack setup with a horrible electricity bill! Home Labs are the sort of thing that start small, but grow and evolve over time as your thirst for knowledge does.

In this Home lab blog I will be sharing my Home Lab journey in the hope it inspires others to begin their own journeys.

Like many others, my humble lab began with an Original Raspberry Pi many years ago until recently, in the last 6 months, I have invested in various bits of additional kit. The hardware has ranged from a late 2013 MacBook Pro that I use when I’m mobile (not so much at the minute!) to rack mount servers with both physical and virtual firewalls and switches, to tie it all together.

There are endless combinations of hardware, software, resources and subscriptions out there to suit each individuals goals.

Over the course of a series of posts in the Home Lab blog, I will share with you my Home Lab including hardware, software, subscriptions and learning resources I have used to to get me to the point I am at today.

I’d like to end this introduction post sharing with you, possibly, my most valued tool: My VMUG Advantage Subscription. This subscription provides you with access to online events and communities, money off training/exams and VMWorld tickets but, most importantly, access to non-production VMware licences!

As a VMUG Advantage member you get access to loads of VMware products to use in your Home Lab. Among the titles are vSphere, vCenter, vSAN, NSX, VCF and also the latest vSphere 7! This does how ever come at a cost… $200.

There is often a prompt for 10% off (code ADVNOW) which meant my subscription cost roughly £140 for 365 days of labbing! Now I appreciate not everyone may be able to afford this, in which case it is worth trying to ask your employer if they can cover the costs as a professional subscription?

This, without a doubt, has been one of the BEST resources I have had access to. Whether you are just wanting to get familiar with a new technology, dig deeper into a technology you already use, or prepare for a VMware certification, this is really an invaluable resource to have! Do take note, this cannot be used in a production environment!

Interested? Head over to the VMUG membership page to learn more!

Thanks for reading, I hope this has been useful. In the next post I will cover the equipment and software that makes up my Home Lab. See you then!

Installing PowerCLI using Install-Module

I was asked recently ‘Do we have PowerCLI downloaded?’.  Yes, we may, but it could be anywhere and it is likely an outdated version.

There is no need to download the installer! You can install PowerCLI using the Install-Module cmdlet in Windows PowerShell. (Providing you have an internet connection!) Below we will look at the steps required to install the latest version of PowerCLI on your system.

From an elevated PowerShell prompt run the following –

Install-Module VMware.PowerCLI.

If you don’t already have it installed, you will be prompted to install the NuGet Provider. Type ‘y’ and enter to continue.

You will get a further prompt to confirm you are happy to install a module from the ‘PSGallery’. Again, ‘y’ and enter to continue.

The PowerCLI Module will then begin to install. It will cycle through installing multiple dependent packages which will take a few minutes. Sit back and wait…

Once returned to the prompt, you can confirm the installation by running –

Get-Module VMware.PowerCLI -List Available | FL

You have now installed PowerCLI version 12.0.0.15947286. You will likely end up installing a later version.

Last step, load the module for use

Import-Module VMware.PowerCLI

You’re ready to go! But…

Not every system you need to use this module on will have internet access. In this, case the ‘Save-Module’ cmdlet is your friend.

Save-Module -Name VMware.PowerCLI -Path <Path to directory>

The module will then proceed to be downloaded into the directory you have specified and will look like this –

On your target server, you will need to confirm your module paths. You can do this by using the following command. You may have more than one path.

$env:PSModulePath

Now copy the directory that contains the module you have saved, to a module path on the target server. Likely ‘C:\Programfiles\WindowsPowerShell\Modules’ on a Windows System.

Now the Module is on your system, all that’s left is to import the module as above –

Import-Module VMware.PowerCLI

Thanks for reading! Hope this has been of use and catch you in the next post.

Recent Entries »