I recently setup a new laptop and a new Ubuntu VM. I have a static IP setup for my VMs so I can ssh into them with an SSH host alias.
For some reason, how this works has changed since last I set this up, and this was a huge pain. Here’s what worked:
I explicitly added a new custom network adapter. VMWare fusion assigned it the subnet IP of 192.168.77.0
You can verify this by checking /Library/Preferences/VMware\ Fusion/networking
:
answer VNET_2_HOSTONLY_NETMASK 255.255.255.0
answer VNET_2_HOSTONLY_SUBNET 192.168.77.0
answer VNET_2_NAT yes
answer VNET_2_NAT_PARAM_UDP_TIMEOUT 30
answer VNET_2_VIRTUAL_ADAPTER yes
In the same directory, vmnet2/nat.conf
has more helpful info:
[host]
# NAT gateway address
ip = 192.168.77.2
netmask = 255.255.255.0
Alright. So now we can setup the VM with an IP. 192.168.77.10 was chosen arbitrarily.
And boom, this works.
Things I tried before I couldn’t get working:
Setting a static IP on vmnet1 or vmnet8
Setting the static IP via /etc/network/interfaces