62

I'm trying to use VirtualBox to host a couple of VMs.

Each VM should be able to connect to the Internet (this is needed primarily to install software) My Host browser should be able to connect to the Guest VMs. Also I need to be able to ssh to the Guest VMs. This is why I want each VM to have a static IP address. This will also allow the VMs to connect to each other, say for database connectivity.

I have done this with VMware Fusion. However, VMware has lately bitten me too often and destroyed so much work that I want to try VirtualBox.

But I'm not a network guru and don't know which type of networking I want. So what I'm asking is simple:

What are the main differences between networking types. This could help me find out which type of networking I should use in my case.

And of course if anyone has a link to any documentation of how to do what I want, that would be greatly appreciated.

Thanks, ge

closed as off topic by Stefano Palazzo Jan 12 '12 at 22:43

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • This isn't actually the right site for this question. If you want to get more answers, you should ask it on SuperUser or Ask Different. – Stefano Palazzo Jan 12 '12 at 22:42
  • 1
    @StefanoPalazzo No, it very much is :) – mlvljr Apr 23 '16 at 16:08
  • 1
    Do all of the upvotes on the question and answers cause any rethink among those that voted to close this? – chicks Sep 13 '16 at 18:48
  • 1
    Why closing instead of migrating to SU? – Franck Dernoncourt Oct 25 '17 at 1:30
  • @StefanoPalazzo I've edited the question to make it non-mac specific and less opinion-based. Since this question is so popular and still applies, I think it worths migrating it to SuperUser, so that more up-to-date information can be added. Unfortunately closed questions cannot be migrated, so I guess reopen-migrate might be the option related meta question – Marinos An Feb 6 at 10:26
69

This page : http://www.virtualbox.org/manual/ch06.html

covers the virtualbox networking quite well.

NAT - Your host will act as a router (firewall) and your guests will be on a private subnet. Use this if you are not running servers on the guests.

Bridged - Your guests will get a ip address on the same subnet as your host. Use this if you are running servers on the guest and wish to connect from other computers on the LAN.

Host Only - Sort of a hybrid. As the name implies, with this option you can connect to the guest servers from the host only. Use this for "private" (host only) servers. I use this if I am running a test web server.

To make a long story short, assuming you have a router, I would use bridged networking. 

  • "Internal Networking: similar to bridged in that the VM can directly communicate with the outside world. However the outside world is limited to other VMs on the same host which connect to the same internal network -- Host Only: ...whereas with bridged networking an existing physical interface is used to attach virtual machines to, with host-only networking a new loopback interface is created on the host. And whereas with internal networking, the traffic between the virtual machines cannot be seen, the traffic on the loopback interface on the host can be intercepted." – Marinos An Feb 5 at 12:50
14

You want to use bridged networking.

NAT is Network Address Translation - this is a VM-internet connection, as opposed to Bridged Networking, which is (from the network point of view) the same thing as having a physical machine connected - as such, with Bridged networking, you can have it be both ways - your VM gets an IP address, which can then be used for SSH, telnet etc.

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