Manually Add and Remove VMware Fusion Virtual Adapters

Friday, October 18, 2013

VMware Fusion exposes command line options that make it easy to add or remove virtual adapters manually.

In this post, I will be adding and removing virtual adapter vmnet7. A fresh install of VMware Fusion does not include this virtual adapter.

Manually Add VMware Fusion Virtual Adapter

The following commands will create vmnet7, a VMware Fusion host only virtual adapter assigned to network 192.168.240.0/24:

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgadd VNET_7_DHCP no
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgadd VNET_7_HOSTONLY_SUBNET 192.168.240.0
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgadd VNET_7_HOSTONLY_NETMASK 255.255.255.0
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgadd VNET_7_VIRTUAL_ADAPTER yes

Restart VMware Fusion networking to apply the changes:

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --configure
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start

Perhaps you also want that network to route out to the internet via NAT. No problem, simply run the following command or include it with the other commands above:

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgadd VNET_7_NAT yes

Once again, to apply the change, restart VMware Fusion networking with the three vmnet-cli commands above.

The vmnet-cfgcli command will modify entries in /Library/Preferences/VMware\ Fusion/networking. This file can also be edited by hand and any changes can be applied by restarting VMware Fusion networking with the three vmnet-cli commands above.

Manually Remove VMware Fusion Virtual Adapter

To remove the vmnet7 VMware Fusion virtual adapter, you can edit /Library/Preferences/VMware\ Fusion/networking, remove all lines containing VNET_7, and restart VMware Fusion networking, or you can use the following commands and then restart VMware Fusion networking:

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgremove VNET_7_DHCP
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgremove VNET_7_HOSTONLY_SUBNET
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgremove VNET_7_HOSTONLY_NETMASK
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgremove VNET_7_VIRTUAL_ADAPTER

If you configured vmnet7 to use NAT, also run the following command and then restart VMware Fusion networking:

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli vnetcfgremove VNET_7_NAT

References

Tip #3: Adding additional networks to VMware Fusion 4/5

comments powered by Disqus