Building a VMware vSphere Virtual Lab with VMware Fusion - Part 1: Installing ESXi

Learning VMware vSphere, practising for a certification, testing planned upgrades and demonstrating features are just some of the reasons you might want to build a Virtual Lab. This tutorial will show you how to build one on a MacBook Pro in easy to follow steps.

Overview

It would take a huge post to explain how to build a complete Virtual Lab because there are lots of steps involved. For this reason, I’m going to split the task into a series of smaller tutorials, with the first explaining how to prepare your Mac and install ESXi.

Other parts in this series:

Before we begin, let me show you a diagram and describe what we’re going to build.

Figure 1: Diagram of vSphere Virtual Lab

Figure 1: Diagram of vSphere Virtual Lab

The diagram is not the clearest, so let me try to explain. First of all, we have a MacBook at the bottom which is running VMware Fusion and has two custom networks (vmnet10 and vmnet11).

The green network (vmnet10) is a private network used for managing ESXi hosts, vCenter Server (vc01), the pfSense firewall (fw01) and the iSCSI storage server (us01).

The red network (vmnet11) is a separate private network which has NAT enabled so that VMs can access the internet through the MacBook. This network will be used to simulate a WAN connection coming into your lab. Traffic on this network will go through the virtual pfSense firewall running on an ESXi machine.

There will be four VMs running on VMware Fusion. These machines simulate what would be physical machines in a production environment. They are the ESXi hosts and the storage servers.

The VMs at the top of the diagram will run on the virtual ESXi hosts. These are the pfSense firewall, vCenter Server and a demo web server. Notice the web server is on a different subnet to the management machines (10.1.2.0), this is because it will be on its own network (DMZ) that is segregated by VLANS. Traffic from the DMZ will need to go through the pfSense firewall.

The diagram also shows two iSCSI networks with different VLANS. The traffic from iSCSI and any other vSphere network traffic will run through the same virtual switch (vmnet10) as the management network and we’ll use VLANS to segregate it. You can think of this switch as being a simulation of a stacked 10 GB physical switch.

Prerequisites

Since we’ll be using nested virtualization, we’ll need a modern Mac which has a CPU that supports hardware virtualizaion and at least 16 GB of RAM. You’ll also need to download and install VMware Fusion* because it allows the hardware assisted virtualization feature of the CPU to be used in a virtual machine.

The following steps have been tested on a 2017 MacBook Pro that has 16 GB of RAM running Mojave and VMware Fusion 11.5*.

Software required for this tutorial:

OK, so you’ve got a modern Mac, installed VMware Fusion and downloaded vSphere ESXi, we’re now ready to create the custom VMware Fusion networks then build our first ESXi VM.

Step 1: Create VMware Fusion Networks

The first thing we need to do is create the custom VMware Fusion networks and then add some data to our Mac hosts file.

Close VMware Fusion and edit the VMware Fusion networking config file.

sudo vim /Library/Preferences/VMware\ Fusion/networking

Add the following and save the file.

answer VNET_10_DISPLAY_NAME vSphere
answer VNET_10_HOSTONLY_NETMASK 255.255.255.0
answer VNET_10_HOSTONLY_SUBNET 10.1.1.0
answer VNET_10_VIRTUAL_ADAPTER yes
answer VNET_11_DHCP no
answer VNET_11_DISPLAY_NAME WAN
answer VNET_11_HOSTONLY_NETMASK 255.255.255.0
answer VNET_11_HOSTONLY_SUBNET 198.18.0.0
answer VNET_11_NAT yes
answer VNET_11_NAT_PARAM_UDP_TIMEOUT 30
answer VNET_11_VIRTUAL_ADAPTER yes

The next time we open VMware Fusion, we should have two new custom networks named vSphere and WAN. We will use these custom networks when creating our ESXi and iSCSI VMs.

Step 2: Modify the Mac hosts file

The next step, is to edit the Mac hosts file so that we can access the ESXi hosts or vCenter Server using domain names in the web browser instead of by IP address.

Open up a terminal and run the following command to edit the hosts file.

sudo vim /etc/hosts

Add the following lines to the hosts file.

10.1.1.11  esxi01.graspingtech.com  esxi01
10.1.1.12  esxi02.graspingtech.com  esxi02
10.1.1.13  esxi02.graspingtech.com  esxi02
10.1.1.101 vc01.graspingtech.com    vc01
10.1.1.201 us01.graspingtech.com    us01
10.1.1.211 fw01.graspingtech.com    fw01

Save and close the file.

You can test to see if the domains map to the IP addresses by pinging either esxi01 or esxi01.graspingtech.com and notice what IP address the ping command tries to get a reply from.

$ ping esxi01
PING esxi01.graspingtech.lan (10.1.1.11): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2

Step 3: Create the ESXi VM

Now that we’ve created the custom networks and modified the hosts file, we’re ready to create the ESXi virtual machine and install the hypervisor.

I’ve already written a tutorial on: How to install ESXi 6.7 on a MacBook Pro with VMware Fusion. Open that link in a new tab, follow the steps in the tutorial and then move onto step 4 of this tutorial.

Step 4: Create network adapters and assign to custom networks

If you followed the tutorial in the link of the previous step, you should now have a VM called esxi01 with ESXi 6.7 installed. You will notice that there’s only one network adapter and it won’t be connected to any of the custom VMware Fusion networks we created. We need to add two new Network Adapters to the VM.

Right click on the esxi01 VM and click Settings…

Screenshot (VMware Fusion Settings)

Click Add Device… and then add two new Network Adapters, so there are three like shown in the image below.

Screenshot

Configure the first two so they are connected to the vSphere network.

Screenshot

And the last one so its connected to the WAN.

Screenshot

While you’re in the settings screen, change the memory so that it has 10 GB. We’ll need this much for the first host when deploying the vCenter Server appliance in Part 3 of the series.

Screenshot

Step 5: Modify the ESXi management network

The last step in this tutorial is to configure the management network so that it uses two network adapters for redundancy and the correct IP and DNS configuration.

Login to the ESXi host, navigate to the Configure Management Network screen, then click Network Adpaters.

Assign vmnic0 and vmnic1 then press Enter.

Screenshot

Navigate to the IP configuration screen and make sure the IP address is the same as esxi01 in Figure 1 (10.1.1.11). And make sure the gateway is the same as the IP address of the firewall (10.1.1.251).

Screenshot

Navigate to the DNS configuration screen and for the primary DNS server use the same IP address as the firewall.

Screenshot

Finally, navigate to the Custom DNS suffixes screen and enter your domain name.

Screenshot

That should be it. If everything has been configured correctly, you should be able to view the login page of the ESXi host by entering the FQDN into a browser.

Screenshot

Conclusion

After working through the steps in this first tutorial we are now on our way to building a fully functional vSphere Lab on a MacBook that’s portable. We’ll soon be able to test out some of the best features of vSphere, things like VMotion, Storage VMotion and high availability etc.

Before going onto the next tutorial, I’d like you to repeat all of the steps in this tutorial again for the remaining two ESXi hosts. You should have three hosts in total with the IP addresses and hostnames specified in the diagram pictured in Figure 1.

Coming next

The next tutorial in the series will show you how to deploy a pfSense VM onto the first ESXi host and configure it so that DNS requests from the management network are resolved by the firewall. This will be required when we come to install the vCenter Server appliance in Part 3.

Read Next - Part 2: Deploy and Configure a pfSense VM

Further reading

As I’m sure you’re aware, there’s only so much information that can go into a blog post, which is why you might want to check out the book titled Mastering VMware vSphere 6.7* (Marshall, Brown, Fritz, Johnson) to get a more in depth understanding of vSphere.

Written by Tony

I'm a blogger, software developer and sysadmin, with a degree in applied computing and 16+ years experience managing IT systems. Get in touch: tony@graspingtech.com

Tags: ESXi Fusion