VMWare Workstation - how to automate or script changes to the virtual network configuration
Solution 1
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.
Solution 2
great job, thanks mustaccio. To raise the dead ...
VMware Player 5 outline:
- VNET_# = 0 to 9 (VMnet# i.e. for VMnet1: VNET_1)
- HASH is a 40 digit hex number
File -- Start
File Header:
VERSION=1,0
bridge mode -- other than standard (see addition below)
answer VNET_#_DHCP no
answer VNET_#_VIRTUAL_ADAPTER no
Host-only with DHCP
answer VNET_#_DHCP yes
answer VNET_#_DHCP_CFG_HASH [enter_hash]
answer VNET_#_HOSTONLY_NETMASK 255.255.255.0
answer VNET_#_HOSTONLY_SUBNET 192.168.0.0
answer VNET_#_VIRTUAL_ADAPTER yes
Host-only without DHCP
answer VNET_#_DHCP yes
answer VNET_#_DHCP_CFG_HASH [enter_hash]
answer VNET_#_HOSTONLY_NETMASK 255.255.255.248
answer VNET_#_HOSTONLY_SUBNET 173.239.151.176
answer VNET_#_NAT no
answer VNET_#_VIRTUAL_ADAPTER yes
NAT
answer VNET_#_DHCP yes
answer VNET_#_DHCP_CFG_HASH [enter_hash]
answer VNET_#_HOSTONLY_NETMASK 255.255.255.0
answer VNET_#_HOSTONLY_SUBNET 192.168.1.0
answer VNET_#_NAT yes
answer VNET_#_VIRTUAL_ADAPTER yes
Non-standard bridge mode (i.e. not Auto) Number at the end is VMnet#
answer VNL_DEFAULT_BRIDGE_VNET -1
add_bridge_mapping eth0 0
add_bridge_mapping eth1 1
File --- End
I found that when I run service vmware start
some processes failed. Also, associated & required files were not added or updated, as I had hoped.
FIX: Uninstall VMware Player and then reinstall. Vmware player will use your /etc/vmware/networking file to create a new network setup
To unistall:
vmware-installer -u vmware-player *version.build*
(version.build = Product Version i.e. 5.0.4.1945795; see vmware-installer -l
or the bundle file name for your info)
Note: Standard auto bridge mode does not have an entry, VMnet0, when in bridge (either auto or assigned), is presumed and not included in the file declaration
Solution 3
This should be doable using vmware-config.pl
: http://www.vmware.com/support/ws5/doc/ws_install_vmware-config.html.
Related videos on Youtube
mustaccio
Updated on September 18, 2022Comments
-
mustaccio over 1 year
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?
-
mustaccio over 10 yearsThanks, it was close, but no cigar.
vmware-config.pl
was removed in Workstation 7 and onwards. There is a replacement of sorts,vmware-modconfig
, but it only deals with kernel modules. However, your suggestion prompted more searching on my side, which produced some results.