I have a guest computer with internet access through the NAT option in VMware. I also have a connection to VMnet2. What I need to do now is share that internet connection to the guests in VMnet2 (since they are stuck there, can't put them in another net but I need an internet connection on them). How do I do this? The guest connected to the internet can be Linux or Windows, I don't care I just need it to work.

  • Do you want to have a shared internet connection between the two guests? Or have them networked so that they can communicate? – WikiWitz Jun 16 '12 at 9:47
  • Yes, I want to share the internet connection in guest1 to guest2. I already have the network connected. Guest1 has one connection to the internet through the host and one connection to vmnet 2 where the other guests are located. – Ebin Jast Jun 16 '12 at 9:53

Reading http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&externalId=1006480 and http://www.vmware.com/support/ws55/doc/ws_net_configurations_common.html explains that the three types of networks are actually virtual ethernet "switches" which can be configured in one of three ways - host only, bridge, or NAT.

Virtual machines assigned to the same switch can see each other, and are effectively on the same (virtual) Ethernet segment. The type of "switch" determines the behavior when connecting to the outside world.

  • In the NAT mode, there is a virtual NAT router between the virtual switch and the host machine's internet connection, which prevents the virtual machines from being seen by others on the host network, but doesn't affect the ability to reach the other hosts via the VM.
  • In the host-only mode, the virtual switch is on a different Ethernet segment entirely, with connectivity to other virtual machines assigned to the same switch, and to the host itself.
  • In the bridged mode, it's as if the virtual switch was physically plugged into the same ethernet segment as the host's ethernet connection. The machines have IPs on the same network, and are fully accessible to virtual and physical hosts sharing that segment.

Depending on your security requirements, you can either assign the other machines to the same NAT "switch", or set up secondary virtual interfaces on all the machines in host-only mode, and configure one of the virtual machines to be on both the NAT switch and the host-only switch and act as a gateway, in the same way you'd do with a physical network, ie, iptables on Linux, or ICS or third party software on Windows.

  • I believe you are wrong in suggesting on assigning the machines to the same NAT "switch". In VirtualBox, each machine with NAT connection type is isolated to the host and other guest machines and the Internet in that the "outside world" can't see it, unless port-forwarding is configured. – WikiWitz Jun 16 '12 at 10:05
  • Thanks for your answer. I feel I need to elaborate a little. The guests in vmnet2 are actually real computers so I cannot right click and add another virtual NIC on them. What I need to do is use guest1 (wich is virtual, and again has one NIC to the internet and one to VMnet2) as a gateway for the machines on VMnet2, I've tried this with a linux machine and did not get it to work, im going to try with a Windows machine now and see if I can use the option "share this internet connection blabla". – Ebin Jast Jun 16 '12 at 10:20
  • @WikiWitz According to VMWare's documentation, the default behavior puts the guests on different switches, but it's possible to assign them manually to the same one. Now, I wouldn't put it past them to have errors in their documentation, but that's what the documentation claims :) – Stephanie Jun 16 '12 at 10:23
  • I think I know what I missed now. In the gateway I need to do a NAT between VMnet2 and the NAT-VMnet since they are on different networks. – Ebin Jast Jun 16 '12 at 10:29
  • @Ebin Jast Great - if that works for you please add it as an answer and accept it. :) – Stephanie Jun 16 '12 at 10:32

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.