To restore the configuration of a virtual distributed switch (vDS) from the existing switch, select the existing switch and click: Actions -> Settings -> Restore Configuration.
The "[vDS name] - Restore Configuration" wizard appears.
Click the button: Browse.
Select the previously exported zip file and click Open.
Choose:
In our case, we select: Restore distributed switch and all port groups.
Source : Restore a vSphere Distributed Switch Configuration - VMware Docs.
Confirm the restoration of the previously exported configuration by clicking Finish.
In Recent Tasks, you will see several tasks appear for your virtual distributed switch (vDS), as well as the port groups it contains (if applicable).
As expected, NetFlow settings were restored on our Virtual Distributed Switch (vDS).
The health check has been re-enabled.
NIOC has also been reactivated.
And limiting network traffic of our virtual machines through traffic shaping settings has also been restored.
If desired, you can also export the configuration of a virtual distributed switch (vDS) and its port groups (if applicable) from the command line using VMware PowerCLI.
To do this, open VMware PowerCLI and type this command if you are using a self-signed or invalid certificate (in the case of a lab, for example).
This will allow you to ignore the error that blocked access to VCSA due to the invalid or self-signed certificate.
Note that by default, VCSA is "secure" with a self-signed certificate.
Plain Text
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
Next, connect to your VMware vCenter Server (VCSA) using this command:
Plain Text
Connect-VIServer vcsa.informatiweb.lan
A "Specify Credential" login window will appear.
Authenticate as "administrator@vsphere.local".
Once logged in as "administrator@vsphere.local", this will appear in the console:
Plain Text
Name Port User ---- ---- ---- vcsa.informatiweb.lan 443 VSPHERE.LOCAL\Administrator
View information about your virtual distributed switch (vDS) by replacing "MyDSwitch" with the name of your virtual switch.
Plain Text
Get-VDSwitch -Name "MyDSwitch"
Plain Text
Name NumPorts Mtu Version Vendor ---- -------- --- ------- ------ MyDSwitch 32 1500 6.6.0 VMware, Inc.
To export the configuration of your virtual distributed switch (vDS), along with its port groups, use the command below.
Note: to only export the configuration of the switch and ignore that of the port groups it contains, add the "-WithoutPortGroups" parameter at the end of the command below.
Plain Text
Get-VDSwitch -Name "MyDSwitch" | Export-VDSwitch -Description "Bak config vDS MyDSwitch" -Destination "c:\vds_backup.zip"
Plain Text
Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 16-08-22 21:09 9179 vds_backup.zip
In the desired location on your hard drive, you will find the "zip" file exported via VMware PowerCLI.
As before, this zip file contains a "data" folder with the configuration of your distributed virtual switch ([unique identifier].bak) and that of each port group (dvportgroup-xx.bak) that it contains.
To import the previously exported configuration by creating a new virtual distributed switch (vDS), use the command below:
Plain Text
New-VDSwitch -BackupPath "c:\vds_backup.zip" -Name "Imported_VDS" -Location (Get-Datacenter "DC-Bruxelles")
Wait while the new virtual distributed switch (vDS) is created and the configuration is imported.
However, note that if you import the configuration on the same vCenter Server, an error will occur since you cannot create multiple port groups with the same names, even if they belong to different virtual switches.
Anything that does not conflict with your current configuration will still be imported.
To restore the existing virtual distributed switch (vDS) configuration (as we did previously from the GUI), simply use the command below specifying the name of the existing virtual switch and the path of the backup that had been created previously.
Note: to restore only the virtual distributed switch (vDS) configuration without changing the configuration of the port groups it contains, simply add the "-WithoutPortGroups" parameter to the end of the command below.
Plain Text
Get-VDSwitch -Name MyDSwitch | Set-VDSwitch -BackupPath "C:\vds_backup.zip"
This will be displayed in the console:
Plain Text
Restoring vSphere distributed switch configuration - Switch name: 'MyDSwitch', Switch version: 6.6.0, Number of port groups: 4, Number of resource pools: 0, Number of uplinks: 1, Notes: Bak config vDS MyDSwitch. Name NumPorts Mtu Version Vendor ---- -------- --- ------- ------ MyDSwitch 32 1500 6.6.0 VMware, Inc.
As you can see, our distributed virtual switch configuration has been successfully restored from the backup.
Hence the reappearance of the 3 icons (mentioned previously at the start of the tutorial).
Traffic shaping settings have also been restored to our "DPortGroup_VMs" port group.
Sources :
VMware 10/7/2022
VMware 1/10/2025
VMware 4/5/2024
VMware 2/23/2024
Pinned content
Contact
® InformatiWeb-Pro.net - InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.
Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.
No comment