VMware Workstation Player and Port Forwarding

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;

}

VMware Workstation Player and Port Forwarding

Aggiornamento dinamico dei record DNS da infrastruttura DHCP

Nelle opzioni dello scope del DHCP abbiamo:

In questa configurazione abbiamo:
  • gli aggiornamenti dinamici abilitati 
  • solamente se richiesto dal client DHCP

Come faccio vedere se questo aggiornamento è configurato sui client windows? 

Lo verifico dalle proprietà del TCP/IP sotto la voce DNS
Può succedere che alcuni dispositivi, configurati per ricevere un indirizzo ip dinamico, non aggiorni i dati sul DNS server. Ad esempio a me è capitato con dei terminali wyse.
In questo caso si può abilitare la voce:
“Always dynamically update DNS A and PTR records”
#######
As for the differences between “Always dynamically update DNS records” and “Dynamically update DNS records for DHCP clients that do not request updates”, you may check the following explanation:
1) By default, clients will register A records on DNS server directly and request DHCP server to register PTR record for them;
2) When enabling “Always dynamically update DNS records“, DHCP server will register both A record and PTR record on behalf of client, although client may only ask DHCP server to register PTR record;
3) “Dynamically update DNS records for DHCP clients that do not request updates” need to be checked when you are in a mixed environment (MAC and Linux clients, or NT 4.0 clients), these clients may be unable to send request to DHCP server to let DHCP server register records, after checking this option, then DHCP server will also register records for them (both A and PTR records).
#######
I motivi o gli eventi seguenti possono attivare un aggiornamento dinamico:

  • Aggiunta, rimozione o modifica degli indirizzi IP nella configurazione delle proprietà TCP/IP relativa a una qualsiasi delle connessioni di rete installate.
  • Lease dell’indirizzo IP che modifica o rinnova una qualsiasi delle connessioni di rete installate con il server DHCP, ad esempio quando si avvia un computer o dopo l’utilizzo del comando ipconfig /renew.
  • Utilizzo del comando ipconfig /registerdns, che impone manualmente un aggiornamento della registrazione del nome del client in DNS.
Aggiornamento dinamico dei record DNS da infrastruttura DHCP