Stretch isolated network between multiple ESXi servers
Setting up testing networks and lab networks have been very interesting to meย the past few weeks. ย When you are setting up Dev and Staging environments, the requirements may be to have multiple copies of production environments properly segmented and functioning to a degree that the VMs operate at a network level normally or semi-normally as they would in production. ย The requirements may include keeping the same IP address space. ย I have already written a couple of posts concerning creating these types of networks both with a purely Layer 2 model as well as Layer 3 connectivity.
Creating Lab Network Series:
Post 1 Layer 2 –ย Create isolated test environment same ips and subnet with VMware
Post 2 Layer 3 connectivity with same IP address space –ย Overlapping Subnets Lab Environment
Stretch isolated network between multiple ESXi servers
Withย the posts above, it was assumed that all VMs existed on a single ESXi host configured with anย isolated virtual switch. ย By “isolated” we generally mean that we don’t have any network cards assigned to the vSwitch. ย It will generally look something like this:
When virtual machines are connected to this type of switch, there is no where for the traffic to go or to be routed out, so you basically have one “layer 2” wire that you can connect virtual machines to. ย They will be able to communicate with each other but no one else. ย The idea works the exact same way as when you take a single physical switch, plug devices into it, but have no uplink to the switch. ย it is isolated.
This type of setup works great if you have one development or staging server that you host your VMs on. ย However, what if you want to scale out and provide multiple hosts to leverage compute and storage to the existing “isolated network”? ย Well, here is where we have to rethink the truly isolated switch.
As mentioned above, the isolated vSwitch has no network cards assigned. ย Obviously, to share the network between two hosts, we are going to have to extend the network between the two by connecting them in some form or fashion. ย This is exactly what we do. ย By leveraging aย physical switch and aย VLANย separate from production/management traffic,ย we can achieve the same objective here extending an “isolated” network between two or multiple hosts even though we have physical links connected to the vSwitch.
There are many ways that the vSwitch(es) can be configured. ย If you want to dedicate physical links to your isolated traffic, you can create a new vSwitch and use those specific uplinks for that particular network. ย If you are already using all your uplinks connected to a particular vSwitch, you can simply create a new port group on that vSwitch that is dedicated to your isolated traffic.
VLAN Configuration
There are a few different ways that we can tag the VLAN traffic that we have designated. ย However, for a lab environment, the easiest way and recommended way on many fronts is to use Virtual Switch Tagging or VST. ย This method tags all traffic on a particular vSwitch port group with a certain VLAN ID. ย Below, you can see an example of a portgroup where we have VST in place.
To “share” this network between the ESXi servers in question, we would simply make sure the VLAN tagged port group exists on every ESXi server that needs to have VMs see the particular network.
As you can see, the process for sharing an isolated network between multiple ESXi servers is really no different than sharing any VLAN’ed network between ESXi servers. ย The only real difference that exists between this type of network and a traditional VLAN backed network is that weย don’t trunk the network out of the physical switch throughout the network, so the traffic is basically isolated on the physical switch that aggregates the traffic between ESXi hosts.
The exception to the “no trunking” would be if the ESXi hosts you wanted to aggregate were on separate switches. ย In that case, you would need to trunk the VLAN between the switches so that tagged traffic would pass between them.
Use PowerCLI to change the network label on many VMs
What if you have tens or hundreds of VMs that need to be moved to the new “shared isolated network” on the ESXi hosts? ย You can easily do this with PowerCLI.
get-vm | get-networkadapter | where {$_.NetworkName -eq "Dev Isolated"} | set-networkadapter -NetworkName "Dev Isolated Shared" -confirm:$false
Final Thoughts
The need to stretch isolated network between multiple ESXi servers may come up if you are working with creating extended development environments. ย Hopefully, the information above will help with the details of how this can be accomplished.