I was looking to do the same on OSX (more specifically, allow phones/tablets/devices/people to access my VM for testing purposes) and the following worked perfectly:
My setup:
Host OSX IP: 192.168.1.72
VM IP: 172.16.67.188
Method:
1) Select “NAT” in “Network Adapter” settings on VMWare Fusion
2) cd to the vmnet8 directory
cd /Library/Application\ Support/VMware\ Fusion/vmnet8/
Note: If you can't find the vmnet8 directory, try running locate nat.conf
, which is usually where the file resides.
3) Edit the nat.conf
file (using vim/vi etc) and underneath [incomingtcp]
, enter the following:
EG: <external port number> = <VM’s IP address>:<VM’s port number>
In my case, I entered:
[incomingtcp]
8080 = 172.16.67.188:80
4) Save and exit the nat.conf
file
5) Reboot VMWare networking by running:
/Library/Application\ Support/VMware\ Fusion/boot.sh --restart
Upon running boot.sh
, all tcp traffic to port 8080 on your OSX host machine will be immediately forwarded to destination port 80 of the virtual machine with IP 172.16.68.188 and make your VM available to your local network on 192.168.1.72:8080.
Note: If you're already running a webserver on OSX, conflicts might occur on port 80, so use 8080 (as I've shown here) or other port to avoid problems.