VMware Communities
mnjensen
Enthusiast
Enthusiast
Jump to solution

Why is the NAT option not always working?

I am using a VMWare Workstation 15 Pro.

I need to be able to change the IP address depending on which machine I am going to access.

I am modifying the IP address of the host computer and the network option is set to NAT in the VMWare machine. The IP address option on TCP/IPv4 is set to DCHP (TCP/IPv4 is disabled) in the VMWare machine.

When I set the IP address on the host to XXX.XX.187.116 (that is a network containing many working devices) and the PC is connected to the XXX.XX.187.XXX net work and start the VMWare machine the IP address on the VMWare machine is set to the same as the host (XXX.XX.187.116). This is as I was hoping.

However when I set the IP address on the host to XXX.XX.183.116 (that is a test network only containing some test devices) and the PC is connected to the XXX.XX.183.XXX net work and start the VMWare machine the IP address on the VMWare machine is set to some default value (XXX.XX.187.116). This is no good to me. 
How do I make the NAT option work every time (so that the IP address of the VMWare machine will follow the IP address of the host every time)?

0 Kudos
3 Solutions

Accepted Solutions
louyo
Virtuoso
Virtuoso
Jump to solution

>>I have started the VMW and checked the IPA of the VMW. It is not 172.29.183.116 but 169.254.130.218. I have closed the VMW.

The 169.x.x.x address indicates your VM is set for DHCP and can't find a DHCP server. If you are not doing NAT from your router, this would be expected.
Replicate does not mean the VM gets the same static IP as the host.
https://docs.vmware.com/en/VMware-Workstation-Pro/17/com.vmware.ws.using.doc/GUID-826323AD-D014-475D...

Put the virtual network editor settings back to default (if you changed them). Set your VM to NAT with IPV4 setting "obtain IP address dynamically".

This should work. The host, via VMware Workstion, is the DHCP server.It creates a gateway to your host's connection to the network.

View solution in original post

louyo
Virtuoso
Virtuoso
Jump to solution

The VM is still not pulling a valid IP (169.xxxx.xxx.xxx).

Your screen shot of the host shows an address of 172.29.187.116. So, the subnet for your devices is 172.29.187/24 (mask of 255.255.255.0). If you set your VM for bridged and assign a static IP for an address (must be unique) in that subnet, you should be able to communicate with other devices in that subnet and the host.
If your VM is set for NAT (Vmnnet 8), see my screenshot. NAT should work. Note that the subnet is not xxx.xxx.187, it is 172.29.187

View solution in original post

louyo
Virtuoso
Virtuoso
Jump to solution

>>How / Where do I find that "Virtual Network Editor" and will my VMW machine have the same 3 vmnet adaptors (0, 1 and 8)?

In Workstation, click Edit and select virtual network editor.

View solution in original post

14 Replies
a_p_
Leadership
Leadership
Jump to solution

It looks like you've configured the NAT subnet in the Virtual Network Editor!?
The NAT subnet must not be in a physical address range.

In case you need an IP address from the physical subnet, Bridged networking is what you need.

André

mnjensen
Enthusiast
Enthusiast
Jump to solution

Thank you for answering - BUT I had bridging earlier and had some troubles with that and when I read it in the VMWare settings I think it sounds like NAT is where the VMWare machine assumes the same IP address as the host. And it seems to work on the xxx.xx.187.xxx network but not on the xxx.xx.183.xxx network.

Are you sure that bridging is the right choice to make the VMWare machine take the same IP address as I am setting on the host?

 

 

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

NAT does not assume the host's IP address.
The virtual NAT network has its own subnet, which usually (by dafalt) is a private 192.168.x.x/24 subnet.

Think of this as with your private network at home (or in your company) where the Internet router does the NATing.
You wouldn't want each system on the local network to have a public IP, wouöd you?

André

RDPetruska
Leadership
Leadership
Jump to solution

If an external process needs to connect to a process in a VM configured with NAT networking, then:

  1. The external process uses the host's IP as the IP to connect to.
  2. The VMware NAT router needs port mapping defined using the Virtual Network Editor.
mnjensen
Enthusiast
Enthusiast
Jump to solution

I am sure sure I fully understand all the answers given.

But it is quite simple what I want to do. I want the VMW machine to connect to external devices with the IPA that is the same as the IPA as the host. When I used Bridging earlier I COULD modify the IPA in the VMW to be as desired but unfortunately both the IPA of the host and the IPA of the was connected to the external network and only ONE IPA can be assigned to this programming device. Furthermore it also confused some systems so that the programming device was not seen as having the right IPA and not given access.

Please look at the attached screenshots:

1. In all 3 examples the IPA of the host is set to be 172.29.183.116.

2. I have set the network adapter of the VMW to be bridged WITHOUT the replicate option.

3. I have started the VMW and checked the IPA of the VMW. It is not 172.29.183.116 but 169.254.130.218. I have closed the VMW.

4. I have set the network adapter of the VMW to be bridged WITH the replicate option.

5. I have started the VMW and checked the IPA of the VMW. It is not 172.29.183.116 but 169.254.130.218. I have closed the VMW.

6. I have set the network adapter of the VMW to be bridged NAT.

7. I have started the VMW and checked the IPA of the VMW. It is not 172.29.183.116 but 192.168.124.128. I have closed the VMW.

Neither of these options is working for me.

How can I make the IPA of the VMW follow the IPA of the host so that the host and VMW are seen as one unit by the external network?

0 Kudos
RDPetruska
Leadership
Leadership
Jump to solution

You cannot have 2 devices on the same network with the same IP address.  However, by using NAT (network address translation), along with port mapping, you can have multiple devices with the same public-facing IP address.  From the outside world, both your host and your guest will have the same address - but, you MUST map the appropriate port for the service you need to connect to on the guest.  Then from the network, connect to the host's IP and desired (mapped) port - this will connect to the service on the guest.

mnjensen
Enthusiast
Enthusiast
Jump to solution

Thank you for the answer.

Unfortunately I don't really know how to set up the port mapping you are mentioning.

I CAN go into the settings on the VMW machine at select NAT instead of Bridging but beyond that I need help.

Do you (or anyone) have a link to a detailed (for dummies) instruction in setting that up so that my machine (host and VMW machine) will only have one IPA see from the outside?


Should this one IPA be set on the host or on the VMW machine?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

You said that NAT with an 192.168.124.x IP address doesn't work for you.
That's actually how NAT works. The internal (the VM's) IP address will be translated, so that external systems will only see the host's IP address. Responses will then be translated back and forwarded to the VM by the host.

Please explain what exactly is it that does not work for you?
Is it outgoing traffic from the VM to other systems on the network, or do these systems need to connect to the VM?

André

0 Kudos
louyo
Virtuoso
Virtuoso
Jump to solution

>>I have started the VMW and checked the IPA of the VMW. It is not 172.29.183.116 but 169.254.130.218. I have closed the VMW.

The 169.x.x.x address indicates your VM is set for DHCP and can't find a DHCP server. If you are not doing NAT from your router, this would be expected.
Replicate does not mean the VM gets the same static IP as the host.
https://docs.vmware.com/en/VMware-Workstation-Pro/17/com.vmware.ws.using.doc/GUID-826323AD-D014-475D...

Put the virtual network editor settings back to default (if you changed them). Set your VM to NAT with IPV4 setting "obtain IP address dynamically".

This should work. The host, via VMware Workstion, is the DHCP server.It creates a gateway to your host's connection to the network.

mnjensen
Enthusiast
Enthusiast
Jump to solution

Thank you again.

"The 169.x.x.x address indicates your VM is set for DHCP and can't find a DHCP server. If you are not doing NAT from your router, this would be expected."
So I should set the IPA of the host to the 172.29.1XX.116 that is reserved for this programming unit?

"Put the virtual network editor settings back to default (if you changed them)."
I did not change them deliberately - when can I see what they are set to (and maybe what the default is)?

"Set your VM to NAT with IPV4 setting "obtain IP address dynamically.""
I assume I am setting to NAT before I start the machine and setting the "obtain IP address dynamically." in the VMW machine after it has been started?

I will try these settings.

 

0 Kudos
mnjensen
Enthusiast
Enthusiast
Jump to solution

I tested it but unfortunately it didn't work.

The first 3 screenshots is from the host and the last 3 screenshots is from the VMW machine.
When I set the IPA to be in the 187 subnet I must be able to ping 187.5 and I can from the host but not from the VMW machine (and I need the connection in the VMW machine and not so much in the host).

 

0 Kudos
louyo
Virtuoso
Virtuoso
Jump to solution

The VM is still not pulling a valid IP (169.xxxx.xxx.xxx).

Your screen shot of the host shows an address of 172.29.187.116. So, the subnet for your devices is 172.29.187/24 (mask of 255.255.255.0). If you set your VM for bridged and assign a static IP for an address (must be unique) in that subnet, you should be able to communicate with other devices in that subnet and the host.
If your VM is set for NAT (Vmnnet 8), see my screenshot. NAT should work. Note that the subnet is not xxx.xxx.187, it is 172.29.187

mnjensen
Enthusiast
Enthusiast
Jump to solution

Thank you for answering.

"The VM is still not pulling a valid IP (169.xxxx.xxx.xxx)."

I see that. But why? Somehow I read the previous instructions as if the host should provide the VMW machine with an IPA when it was set to NAT.

"Your screen shot of the host shows an address of 172.29.187.116. So, the subnet for your devices is 172.29.187/24 (mask of 255.255.255.0)."

Where did the /24 come from?

"If you set your VM for bridged and assign a static IP for an address (must be unique) in that subnet, you should be able to communicate with other devices in that subnet and the host."

I have tried that with host and VMW machine been given static IPA's of 172.29.187.116 and 172.29.187.120 and after that with 172.29.187.120 and 172.29.187.116. in both cases I can ping 172.29.187.5 (time server) from th host but not from th VMWare machine. I would also really prefer that the external system only saw the programming unit (host AND VMW machine) as one IPA.

"If your VM is set for NAT (Vmnnet 8), see my screenshot. NAT should work."

How / Where do I find that "Virtual Network Editor" and will my VMW machine have the same 3 vmnet adaptors (0, 1 and 8)?

0 Kudos
louyo
Virtuoso
Virtuoso
Jump to solution

>>How / Where do I find that "Virtual Network Editor" and will my VMW machine have the same 3 vmnet adaptors (0, 1 and 8)?

In Workstation, click Edit and select virtual network editor.