0

I have a virtual machine running in VMWare player v6. The network type is NAT. An application in my virtual machine sends UDP packages to a server in the network of the host machine and needs to receive the UDP answer from the contacted server.

The described use case don't work in my installation - only if I switch to the network bridged mode.

I measure the network traffic in NAT mode and can see that the UDP packages leave the vm and are sent with translated ip address to the server. The server answered with an upd package to the host ip but the virtual machine don't receive any package

So my question is it normally possible for a NAT vm to receive UDP traffic?

1

Your situation is not different than the regular user experience behind their little home-routers. It's the job of the NAT - providing router to do exactly this: translate the network addresses between the real internet and the internal net ("network address translation"). But, alas, just as the regular user experience behind their little home-routers: For a connection coming INTO the natted network you have to tell the router explicitely where certain incoming-ports will be forwarded to ("portforwarding"). You can setup the portforwarding in the "Vmware Network Editor", see the image to get a clue of what to look for:

vmware network editor - nat

In addition to that: look at the official vmware docs and related sites:

| improve this answer | |
  • Thank your for your response, but normal port forwarding doesn't help because the program inside the vm switching it's port – OkieOth Oct 8 '14 at 10:54
  • that's why folks have invented en.wikipedia.org/wiki/STUN .. but then of coz your on the inside (vm, intranet) must support this. anyway, thats how to do it: either portforwarding or stun. – akira Oct 8 '14 at 10:58
1

The problem, as you suspect, is NAT. That's a hack, not a properly designed technology.

In particular, what goes wrong is that TCP is connection-oriented, and NAT fiddles with each connection. With UDP, there's no connection, and no decent NAT solution. There are some heuristics to make some things work, in particular port-based guessing, but UDP failing with NAT is not unusual at all. In your case, the VMWare NAT just doesn't guess that the returned UDP packet is intended for the VM.

| improve this answer | |
  • Thank you, I afraid that, but I'm not exprienced enough to say this behavior is 'not unusual' :-D – OkieOth Oct 8 '14 at 10:56
0

If you have a private LAN (yes WiFi is a LAN to) you should consider switching the VM's network adapter to bridged. Then the VM will act like a regular PC on your network (using your hosts Ethernet interface).

| improve this answer | |
  • Thanx, but there is no WiFi and I try to understand how the NAT thing works in VMWare :-D – OkieOth Oct 8 '14 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.