VMware Communities
Dan2112
Contributor
Contributor

VMWare Fusion 10.0 overwriting dhcp.conf file on reboot.

I customize the dhcp.conf to assign "static"/dhcp reservation ip addresses to my VMs.

For example adding host definitions after the "####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######"  line.

host devtest0 {

  hardware ethernet 00:0c:29:4a:45:69;

  fixed-address 172.16.25.5;

}

etc, etc.

I can then address the VMs via dns (/etc/hosts) file on the Mac.  

This worked great on previous versions of Fusion from 7 through 8 and is now broken in Fusion 10.

Additionally this breaks vagrant file properties such as:

hostname.ssh.host = '172.16.25.5'

v.vmx['ethernet0.addressType']= 'static'

v.vmx['ethernet0.address'] = ' 00:0c:29:4a:45:69'

On Fusion 10 - this file is overwritten on reboot.

8 Replies
Dan2112
Contributor
Contributor

This happens anytime the vmnet-cli is started - it will clobber the dhcpd.conf file in the vmnet8.

Does anybody know how to prevent this from happening?  Even if I remove "write" privileges the file gets recreated.

Bad very bad.  This is clearly broken.

Edit:

Ok even worse - the file is periodically overwritten.  This needs to be fixed.

Reply
0 Kudos
wookz
Contributor
Contributor

I just give the VMs static IP addresses outside the DHCP range when I create them and add those addresses to all the hosts files.

Reply
0 Kudos
Dan2112
Contributor
Contributor

wookz​  Thanks for the recommendation.  I have been using the widely documented technique of telling Fusion what address to assign based on the MAC address using the "host" directive in the dhcp.conf file for the last two major releases (7 and 😎 without any issues at all.  Now it has changed without notice.

I want to know if this was intentional or if indeed a bug.  I know a lot of people who rely on this functionality. 

It is much easier to allow the OS to come up using dhcp and assign the IP via the host directive especially when setting up test servers across multiple OS flavors.  Having to go into each VM and messing with the network settings is error prone.  Getting a MAC address and editing the dhcp.conf is easy and efficient and works the same for all flavors of OS.

Reply
0 Kudos
wookz
Contributor
Contributor

It was wrong to change it unannounced, I agree.  I suspect there's some other way of doing it you have to buy the expensive version with the network config tool in it, because I'm cynical like that.

I understand what DHCP is, and why in datacenter environments setting static IPs there is A Good Thing.  And I too got caught up in setting static IPs via DHCP in Fusion.  But in the end, I can fat-finger or mis-copy/paste an IP address in a file just as easily as I can on a VM.  If you do it in the VM, you don't have to worry about making sure you have the MAC address correct, which in my mind makes setting it in the VM slightly less messy.  I use dynamic DHCP addresses for the vmnet8 network, and have completely turned if off on the vmnet1 network, as any VM I connect to it is going in a hosts file.

I spaced off where the networking config file was, and it took a while to google my way to it.  In my search I was kind of astonished at the number of people who solve "I want to have a static ip" by using DHCP for a bunch of VMs that are all going to run on just one host.  My reaction came from there.  An no, it's not the answer to the question you asked.

Reply
0 Kudos
Dan2112
Contributor
Contributor

wookz​  It's okay to be cynical.

I have the Pro version of Fusion and I can not see any way to configure static ip addresses for a reservation.

DHCP address reservation is a common method of assigning IP addresses and is supported across multiple hardware devices.  I am a little shocked they took this feature away intentionally.  I still want to know if this is a bug and if so - it should be fixed, if not I want to know why they took it away and how to work around it without necessarily resorting to "mucking" around with static ips in the VM itself. 

Cheers,
Dan

Reply
0 Kudos
BDuguid
Contributor
Contributor

I've recently started experiencing this issue.  I thought it correlated with me upgrading to the Pro version, but I haven't stumbled on the part in the UI to configure DHCP reservation.  DHCP reservation is a very important feature in DHCP.  You can auto configure the IP stack, like DNS servers, while ensuring the device gets the IP address needed.

I'd find it hard to believe this was intentional and not a bug.  It would blow my mind really.

Every restart, I copy/paste and then do the stop/start.  Not ideal.  I am surprised they don't have a UI for reservations; at least in the pro.

Reply
0 Kudos
BDuguid
Contributor
Contributor

In the meantime, I wrote a Bash script.  You'll need sudo rights.

sudo ./update-vmnet8.sh

  • Run configure which will clear the custom settings. (This is also a just in case they weren't cleared before to avoid duplicate custom configurations)
  • Stop vmnet
  • append configuration.
  • Start vmnet
atkachuk
Contributor
Contributor

Try:

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli setdhcpmac2ip vmnet8 <mac> <ip>

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

(or vmnet1 for Host-only interface)

It will add the following record into the /Library/Preferences/VMware\ Fusion/networking file:

add_dhcp_mac_to_ip 1 <mac> <ip>

And it will add the record into /Library/Preferences/VMware\ Fusion/vmnet{1,8}/dhcpd.conf file into the DO NOT MODIFY SECTION section there which will survive reboots.

Unfortunately, if you start you vms with Vagrant - it will modify the /Library/Preferences/VMware\ Fusion/networking file and throw away the added configuration from it. And I did not find out yet how to workaround it.