To configure a PortForwarding on Windows 10 to a VM hosted on VMware Player it is necessary to proceed as follows:
- Configure a static IP address (not essential but recommended) use the DHCP reservation function present in the virtualization application
- Configure port forwarding.
Configure DHCP Reservation
- Retrieve the MAC Address assigned to the virtual machine to which you want a static IP
- Modify (with Notepad running in Administrator mode) the vmnetdhcp.conf file present in C:\ProgramData\VMware by inserting the following lines:
Host <Name of virtual network> {
hardware ethernet <Mac Address in this format xx:xx:xx:xx:xx:xx;
fixed-address <ip address>*;
}
Example:
#Static IP WIN11 –> Comment to identify the VM
VMnet8 host {
Hardware Ethernet 00: 0C: 29: 41: E8: 0C;
fixed address 192.168.233.10;
}
Where in our case the VMnet8 is the one assigned by default to the “NAT” configuration of the VM network card
- Restart the VMNETDHCP service
net stop vmnetdhcp
net start vmnetdhcp
Port Forwarding Configuration
- Modify (with Notepad running in Administrator mode) the vmnetnat.conf file present in C:\ProgramData\VMware by inserting the following lines:
<tcpPortSource> = <IPaddress VM>:<tcpPortDestination>
Example:
8889 = 192.168.233.10:3389
In this case, we follow an RDP session to the OS system hosting my VM using: 8889 I will access through RDS to my VM with IP 192.168.233.10
*To check the IP range to always use the vmnetdhcp.conf file and identify the correct network segment; In the case of my example the segment is 8 (VMnet8)
# Virtual ethernet segment 8
# Added at 11/10/21 23:49:40
subnet 192.168.233.0 netmask 255.255.255.0 {
range 192.168.233.128 192.168.233.254; # default allows up to 125 VM’s
option broadcast-address 192.168.233.255;
option domain-name-servers 192.168.233.2;
option domain-name “localdomain”;
option netbios-name-servers 192.168.233.2;
option routers 192.168.233.2;
default-lease-time 1800;
max-lease-time 7200;
}