VMWare – Automate or Script Changes to Virtual Network Configuration in VMWare Workstation

configurationnetworkingvirtual-machinesvmware-workstation

VMWare Workstation (I'm using V8 on Linux) provides a GUI tool, Virtual Network Editor (vmware-netcfg) to edit the virtual network adapter settings for use by the VMs on the system. I'm dealing with mass changes and semi-automated deployment of preconfigured VMs on a number of machines with VMWare Workstation and would like to find a way to script or otherwise automate modifications to the vmnet* adapters. It's not practical to use the GUI when changing the configuration on 30+ machines at a time.

Does anyone know if VMWare provides a command-line utility for this, or may be the location of the file where the configuration is stored so that I could script changes to that file?

Best Answer

I was able to find the answer for myself. The virtual network configuration, at least on Linux, is stored under /etc/vmware. The file /etc/vmware/networking contains basic virtual network configuration, e.g.

# cat /etc/vmware/networking
VERSION=1,0
answer VNET_1_DHCP no
answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
answer VNET_1_HOSTONLY_SUBNET 192.168.1.0
answer VNET_1_VIRTUAL_ADAPTER yes
answer VNET_8_DHCP yes
answer VNET_8_DHCP_CFG_HASH EEBDA048FBC09F9BC2227D19AABD86B443D88BA0
answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
answer VNET_8_HOSTONLY_SUBNET 172.16.54.0
answer VNET_8_NAT yes
answer VNET_8_VIRTUAL_ADAPTER yes

None of this is documented, as usual, but with sed, some googling, and a little bit of luck I should be able to modify it according to my requirements.

Note that after editing /etc/vmware/networking one needs to vmware-networks --stop, then vmware-networks --start to update the running configuration.