Search
Join the Technical Preview Program
See how NVMe-oF removes iSCSI
bottlenecks in your HCI
The Best Hyperconverged
Infrastructure
(HCI) for Enterprise
ROBO, SMB & Edge
The Best Virtual SAN
for Enterprise ROBO, SMB & Edge

PowerCLI: Fast Virtual Network Setup for VMware ESXi 8.0

  • June 3, 2024
  • 9 min read
StarWind Storage and Virtualization Engineer. Volodymyr specializes in solution architecture and data protection. With a technical background in applied physics, he provides unique analytical leadership in building resilient IT infrastructure. Volodymyr delivers expert guidance on optimizing virtualized environments, disaster recovery, and enterprise-scale storage systems.
StarWind Storage and Virtualization Engineer. Volodymyr specializes in solution architecture and data protection. With a technical background in applied physics, he provides unique analytical leadership in building resilient IT infrastructure. Volodymyr delivers expert guidance on optimizing virtualized environments, disaster recovery, and enterprise-scale storage systems.

Configuring virtual networks across multiple ESXi hosts doesn’t have to be a manual and repetitive process. PowerCLI, VMware’s PowerShell-based automation tool, makes it easy to script and apply consistent network configurations quickly. It’s especially helpful when managing environments with more than a couple of hosts — where doing things through the GUI becomes both error-prone and tedious.

This article walks through setting up a dedicated high-speed 10 GbE network between two ESXi 8.0 Update 1 hosts using PowerCLI. The setup is aimed at isolating traffic like vMotion, vSAN, or other backend workloads.

Test Environment

  • Hosts: Two identical ESXi 8.0 U1 hosts (N201 and N202)
  • Management node: Windows Server 2022 (N200) with PowerCLI 13.x installed
  • Network setup: Each host has a 1 GbE NIC for management and an unused 10 GbE NIC for the new high-speed link
  • VMs for testing: VM-01 on N201 and VM-02 on N202, both running Windows Server 2022
  • Target subnet: 10.0.0.0/24 — isolated, no gateway, no DNS, used only for private traffic

Why PowerCLI? Because it removes the “click fatigue” from repetitive setup steps. And once you build a working script, you can reuse or tweak it easily in the future — whether you’re adding new hosts or rebuilding a lab.

Steps

1. Connect to the Hosts with PowerCLI

On the management server (N200), open PowerCLI and connect to each host:

Connect-VIServer -Server 192.168.1.201 -User root

Connect-VIServer -Server 192.168.1.202 -User root

You should see confirmation messages for successful logins. If needed, use Get-VMHost to list all connected hosts.

2. Check Current Network Config

Before creating anything, see what’s already there:

Get-VirtualSwitch -VMHost N201

Get-VMHostNetworkAdapter -VMHost N201 -Physical

To get full details (speed, MACs, link status):

$esxcli = Get-EsxCli -VMHost N201 -V2

$esxcli.network.nic.list.Invoke()

Look for a NIC with 10000 Mb/s that isn’t attached to any vSwitch — that’s your candidate (e.g., vmnic2). It’s especially helpful if you’re dealing with commodity hardware where naming isn’t consistent.

3. Create a vSwitch with Jumbo Frames

Create a dedicated switch for the 10 GbE NIC and enable jumbo frames:

New-VirtualSwitch -VMHost N201 -Name vSwitch1 -Nic vmnic2 -MTU 9000

New-VirtualSwitch -VMHost N202 -Name vSwitch1 -Nic vmnic2 -MTU 9000

MTU 9000 is optional but recommended for performance. Just make sure the entire path — virtual switch, physical NICs, guest OS — supports it.

4. Add a VM Port Group

This port group is where VMs will attach for private 10 GbE traffic:

New-VirtualPortGroup -VirtualSwitch vSwitch1 -Name "10G-VM-Network"

Repeat for both hosts. The port group name should match across hosts for simplicity.

5. Create VMkernel NICs for Host Communication

VMkernel NICs (vmk interfaces) are used by hosts for internal functions like vMotion and vSAN.

New-VMHostNetworkAdapter -VMHost N201 -VirtualSwitch vSwitch1 -PortGroup "VMkernel_10G" -IP 10.0.0.1 -SubnetMask 255.255.255.0 -MTU 9000

New-VMHostNetworkAdapter -VMHost N202 -VirtualSwitch vSwitch1 -PortGroup "VMkernel_10G" -IP 10.0.0.2 -SubnetMask 255.255.255.0 -MTU 9000

If you’re setting this up for a specific use case, like vMotion:

Get-VMHostNetworkAdapter -VMHost N201 -VMKernel -PortGroupName "VMkernel_10G" | Set-VMHostNetworkAdapter -VMotionEnabled $true

In lab setups, you might skip enabling services. But in production, don’t forget to toggle vSAN or vMotion support on the right vmk.

6. Add NICs to VMs

Let’s give each VM access to the new network:

New-NetworkAdapter -VM "VM-01" -NetworkName "10G-VM-Network" -Type vmxnet3 -StartConnected:$true

New-NetworkAdapter -VM "VM-02" -NetworkName "10G-VM-Network" -Type vmxnet3 -StartConnected:$true

VMXNET3 is the best choice here. It’s paravirtualized, fast, and supports jumbo frames. Just make sure VMware Tools is installed in the guest OS, or the driver won’t be available.

7. Configure Guest OS

Inside the Windows Server 2022 VMs:

  • Assign static IPs: 10.0.0.3 (VM-01), 10.0.0.4 (VM-02)
  • Leave default gateway blank
  • Enable jumbo frames in the adapter properties (usually 9014)
  • Turn off Windows Firewall or allow ICMP + iperf3 (for testing only — lock it down in prod)

Testing the Setup

Ping Test with Jumbo Frames

ping -f -l 8000 10.0.0.4

If MTU isn’t properly set somewhere, this will fail. If all’s well, you’ll get sub-millisecond replies.

Throughput Test with iPerf3

On VM-02:

iperf3.exe -s -p 911

On VM-01:

iperf3.exe -c 10.0.0.4 -p 911 -w 1024K

Expect ~10 Gbit/s. If you’re not hitting full speed, try -P 4 to use multiple streams. Sometimes single-threaded tests are CPU-bound.

Run the reverse test too to confirm bidirectional performance:

iperf3.exe -s -p 911 # on VM-01

iperf3.exe -c 10.0.0.3 -p 911 -w 1024K # on VM-02

Wrap-Up

PowerCLI takes out the guesswork and repetition from VMware network configuration. Once you’re familiar with the cmdlets, you can do in minutes what would otherwise take hours in the GUI — and without risking inconsistencies. This example focused on a simple point-to-point 10 GbE network, but you can adapt the same logic for larger setups, automation pipelines, or DR labs.

Want to get fancy? Add loops to configure multiple hosts, use JSON or CSV to pull IP assignments, or wrap the whole thing into a function. PowerCLI gives you the control, and once scripted, the same config can be rolled out again and again without human error.

The best part? You’re not locked into any one interface or process. You can still jump into the vSphere UI to view or tweak what you scripted — but now you’ve got repeatable, testable, version-controlled infrastructure at your fingertips.

Found Volodymyr’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!