Solved FreeBSD 11 NAT hanging under VMware Fusion...

seanc@

Developer
This is a PSA to save future travelers some angst. Specifically, TCP connections would stall randomly after transferring a modest amount of data (i.e. >5MB xfer per TCP stream).

As mentioned in my Discussion post to the VMware Fusion Forums, after much consternation, hand-wringing, and yelling, I finally found the combination that appears to work 100% of the time:

With your VM completely shut down, in the .vmx file for the VM, add or update the lines with the following values:
Code:
firmware = "efi"
ethernet0.virtualDev = "vmxnet3"

Then inside of FreeBSD (or run this before you shut FreeBSD down to make the above .vmx changes), add if_vmx_load="YES" to /boot/loader.conf:

echo 'if_vmx_load="YES"' | sudo tee -a /boot/loader.conf

Lastly, make sure to change the settings in /etc/rc.conf from em0 to vmx0 and you should be good to go after shutting down the VM (can't suspend to have this change take effect).
 
Addendum: in addition to the above requirements for vmxnet3, it is also required to:
  1. enable TCP keepalives on the host (i.e. macOS)
  2. Increase the window scaling factor to ~8
  3. Increase the send/receive buffers to something obscene
in order to have everything "just work(tm)." I'm not happy about having to set these values, but it is what it is, and I'm 100% confident that these are just papering over the real issue, but these settings do work as a workaround (Darwin 16.4.0/macOS 10.12.3).

Code:
$ sudo sysctl net.inet.tcp.always_keepalive=1
$ sudo sysctl net.inet.tcp.win_scale_factor=8
$ sudo sysctl net.inet.tcp.autosndbufmax=33554432
$ sudo sysctl net.inet.tcp.autorcvbufmax=33554432
$ echo net.inet.tcp.always_keepalive=1 | sudo tee -a /etc/sysctl.conf
$ echo net.inet.tcp.win_scale_factor=8 | sudo tee -a /etc/sysctl.conf
$ echo net.inet.tcp.autosndbufmax=33554432 | sudo tee -a /etc/sysctl.conf
$ echo net.inet.tcp.autorcvbufmax=33554432 | sudo tee -a /etc/sysctl.conf
 
Back
Top