For VMware Fusion on MacOS
Add custom domain names and DNS servers in dhcpd.conf
/Library/Preferences/VMware\ Fusion/networking
Edit this networking
file for custom DHCP subnet for the NAT network.
After updating, run the vmnet-cli
commands to refresh the dhcpd.conf file.
VMNET_1
is for the Host-only network config.
VMNET_8
is for the NAT network config.
% cat /Library/Preferences/VMware\ Fusion/networking
VERSION=1,0
answer VNET_1_DHCP yes
answer VNET_1_DHCP_CFG_HASH 6F9F0D5B42DF4B1CD96ABA0FAC47C832F734E086
answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
answer VNET_1_HOSTONLY_SUBNET 172.16.130.0
answer VNET_1_HOSTONLY_UUID E7240614-CDF8-4C68-985E-9EC49AA10A2C
answer VNET_1_VIRTUAL_ADAPTER yes
answer VNET_8_DHCP yes
answer VNET_8_DHCP_CFG_HASH 952DFC97E625D4EDDB55B21440DCC1FD758EE523
answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
answer VNET_8_HOSTONLY_SUBNET 192.168.255.0
answer VNET_8_HOSTONLY_UUID C1F9A403-6906-4B52-AA3A-19F01BA7B418
answer VNET_8_NAT yes
answer VNET_8_VIRTUAL_ADAPTER yes
These parameters are not well documented, however examining the strings in the binary, I was able to extract some potential parameters that can be used to automatically configure the dhcpd.conf file.
Add the necessary answer VMNET_8_
infront of it.
Run the vmnet-cli --configure
command to regenerate the dhcpd.conf file.
% strings '/Applications/VMware Fusion.app/Contents/Library/vmware-vmx' | grep -i ^DHCP_ | sort | uniq
DHCP_CFG_HASH
DHCP_PARAM_BROADCAST_ADDR
DHCP_PARAM_DEFAULT_LEASE_TIME
DHCP_PARAM_DNS_ADDR
DHCP_PARAM_DOMAIN_NAME
DHCP_PARAM_LEASE_END_IP
DHCP_PARAM_LEASE_START_IP
DHCP_PARAM_MAX_LEASE_TIME
DHCP_PARAM_NETBIOS
DHCP_PARAM_ROUTERS
DHCP_PARAM_SUB_DEFAULT_LEASE_TIME
DHCP_PARAM_SUB_MAX_LEASE_TIME
DHCP_PROGRAM
Refresh the dhcpd.conf and other files
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
Updating the dhcpd.conf for custom DNS servers and other options
The file is located in the subfolder vmnet8
.
Update the dhcpd.conf file as necessary. Add customizations after the 'DO NOT MODIFY' section.
This is because when runing the vmnet-cli commands, it will erase any customization within that block.
After update, run the vmnet-cli start and stop commands.
% ls -lha /Library/Preferences/VMware\ Fusion/vmnet8/
total 40
drwxr-xr-x 7 root wheel 224B Apr 8 09:53 .
drwxr-xr-x 8 root wheel 256B Apr 8 09:51 ..
-rw-r--r-- 1 root wheel 1.6K Apr 8 09:01 dhcpd.conf
-rw-r--r-- 1 root wheel 1.6K Apr 8 09:01 dhcpd.conf.bak
-rw-r--r-- 1 root wheel 1.6K Apr 8 09:01 nat.conf
-rw-r--r-- 1 root wheel 1.6K Apr 8 09:01 nat.conf.bak
-rw-r--r-- 1 root wheel 18B Apr 8 09:02 nat.mac