[stordis-toc]
Introduction
Welcome to the STORDIS Support Portal guide!
This article explains how to run SONiC Virtual Switch (VS) in VMWare ESXi. Running SONiC VS in a virtual environment is ideal for testing, learning, and lab scenarios, allowing you to experiment with SONiC features without dedicated hardware.
Prerequisites
- A VMWare ESXI VE host (version 7.0 or later recommended)
- Downloaded SONiC VS image
- UNIX like workstation / Virtual machine
- Network connectivity and basic ESXi administration access
Download the SONiC-VS Image
SONiC Virtual Switch images are published as builds. The most important is that we need to download the SONiC .vhdx image.
Please refer to article at our support side how to download pre-built SONiC image -
Where to download the SONiC Virtual Switch (VS) community pre-built image?
Step-By-Step Guide
Follow these steps to import the SONiC VS image into VMWare ESXi:
STEP 1: In unix workstation You need to download qemu-img packages and convert .image file to .vmdk
sudo apt update
//apt package manager
sudo apt install qemu-utils
//dnf package manager
sudo dnf install qemu-img
// pacman package manager
sudo pacman -S qemu-img
// verification
qemu-img --version
//download image file your preferable way
//conversion command
qemu-img convert sonic-vs.img -O vmdk -o adapter_type=lsilogic sonic-vs-esxi.vmdkNote!
In general it is not possible to directly convert a generic *.image file (which is a raw disk image) to *.vmdk using a single command inside the ESXi terminal. ESXi lacks the standard conversion tools found in Linux (like qemu-img).
Its native tool, vmkfstools, is designed to manage existing VMDKs, not import raw foreign formats.
STEP 2: Import converted image to ESXi datastore
Navigate to datastore You choose and then go into Datastore browser
Pick folder Of Your choice and then press Upload -> Import new converted image
Note it may take couple minutes to fully upload image
STEP 3: Prepare vmdk image
Use command below
vmkfstools -i sonic-vs-esxi.vmdk sonic-fixed.vmdk -d thinPlease be patient as this process may also take a longer time.
This command clones the source virtual disk into a new, thin-provisioned VMDK file, ensuring proper file structure compatibility for ESXi while optimizing storage usage.
STEP 4: Create new Virtual machine
STEP 5: turn on virtual machine
Navigate in left-hand bar to Virtual Machines and find Your machine
Press Monitor widget to see output of terminal
Now Your SONiC on VMWare ESXi is ready!
Troubleshooting
Not enough memory for swap partition
If You encounter issue with not enough memory check mark like I will show you in screenshots below:
STEP 1: go into edit setting of virtual machine:
In Virtual Hardware section please expand Memory option and check mark for Reserve all guess memory (all locked)
Congratulations!
You have successfully set up SONiC Virtual Switch in VMWare ESXi. Your virtual switch is now ready for testing, learning, and experimentation.
Happy Networking!
Comments 0
Comments
Please sign in to leave a comment.