Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to set up a virtual LAMP server, including sharing files between the guest OS (Ubuntu Server) and the host OS (Windows 7) using samba. I think my problem is that I can't get Bridged (or Host-Only) networking to work in VirtualBox.

I can boot the Linux VM just fine with NAT, but then can't access any services on it directly (except after port-forwarding port 80)(my understanding is that port-forwarding works because I'm not running a web server on the host OS, and therefore it can forward traffic to the unused port 80).

I don't think that port-forwarding samba traffic (from the host to the guest) will work since I think that the host OS is using those ports.

When I turn off NAT and turn bridged networking on I get an error. The VM fails to boot, with a dialog popping up (title: VirtualBox - Error) that says "Failed to open a session for the virtual machine UbuntuServer. Configuration error: Failed to get MAC address (VERR_CFGM_VALUE_NOT_FOUND).

I'm hoping that once this is resolved then samba will work ok :)

Any advice on this would be great (how to fix it would be wonderful, next steps for troubleshooting would be great, too :) )

share|improve this question
add comment

4 Answers

I solved it different than these answers. Using VirtualBox 4.3.10 , I simply had to do the following:

  1. Setup my VMs to use DHCP or Manual IP.
  2. IN VBox settings, if Nat networks has no value, add a NAT network with default settings.
  3. In VBox settings, if Host-only Networks is empty , add one called Host-Only Ethernet Adapter #2 ( I assume #1 would also work)
  4. Restart your VM. It will get the IP and it will now be able to access the internet using Bridged networking per VM instance.

Pretty wierd and obscure that this didn't work out-of-the-box.

share|improve this answer
add comment
up vote -1 down vote accepted

So it looks like I happened upon an answer. I was fiddling around with the VM manager program (on the host OS) and made the 'Bridged' adapter #1 and now things work fine. Host-only also works once it's #1, too.

(I started with the default: NAT as adapter #1, then added the Bridged adapter as #2. Once I realized that the bridged/host-only adapter wasn't working I disabled adapter #1 (the NAT) leaving the Bridged adapter as #2)

share|improve this answer
    
BTW - I know that answering my own question is a bit gauche - if anyone can offer a clear explanation about why this is happening (or improve on my answer is some other, substantial way) I'd be happy to mark that as the answer, instead. –  MikeTheTall Nov 25 '12 at 21:04
    
Make sure which ever adapter you have set to 'bridged' is briged to your Microsoft Loopback adapter, and the adapter you want to access the internet is attached to NAT. This is done on the host through the VM manager. Then on your Ubuntu host, adapter 1 will be 'eth0' and adapter 2 will be 'eth1'; so if 'adapter 1' is bridged then 'eth 0' will be the static 192.168.x.x IP and 'eth 1' will have to be set to DHCP ... does that make since or am I totally misunderstanding the overall issue? –  txtechhelp Dec 4 '12 at 5:34
    
Also, which version of VBox are you using? They've updated a lot of their networking stacks and other internal features over the past few iterations..... –  txtechhelp Dec 4 '12 at 5:35
add comment

The bridged network mode in Virtualbox should work fine, it appears that your VM hasn't been assigned a MAC address (which should be different from your that of your physical NIC)

Attached is an image of the network settings for a VM in bridged mode, in the advanced section be sure to have a value for MAC address, you can use the icon on the right to generate a new MAC address for the virtual network card.

enter image description here

share|improve this answer
    
I was wondering about that, too. My VM definitely has a MAC address though - I even clicked the "generate new MAC address" & restarted it & it still doesn't work. –  MikeTheTall Nov 25 '12 at 1:03
    
Why not try to delete the VM (keeping the VM disk I guess) an re-create it ? –  jhcaiced Nov 25 '12 at 1:21
add comment

Port forwarding is just that, forward data from it's original location on port X to the next distention on port Y (ports X and Y can be the same or different and can reside on the same system or a different one). Port forwarding is more for if you have a server behind a firewall/proxy and you want to 'forward' the traffic destined for port X to your server. If you have port forwarding enabled and nothing listening to that port on the other end, then nothing happens (as expected).

I have an exact setup like yours (Win7 host, *nix guest). To set it up to get them to 'talk' here's what you'll need to get setup:

On the Win7 host install a Windows Loopback Adapter (https://social.technet.microsoft.com/Forums/en-US/w7itpronetworking/thread/259c7ef2-3770-4212-8fca-c58936979851/) gives a decent enough description on how to do that.

Since the loopback adapter functions as kind of an 'emulated' NIC, you can use it just like any other NIC, so assign the IPv4 address to whatever you would like (I use 192.168.0.2 with a subnet mask of 255.255.255.0 for mine).

On your virtualbox machine settings, set the network adapter to 'Bridged' and set the interface to the 'Microsoft Loopback Adapter'. If you want 'internet' access to, you can setup a 2nd virtual NIC set to NAT (google 'network address translation' for more detail on what NAT is and is not).

Boot up your Ubuntu guest, set it's IP address to 192.168.0.X (X is anything but 2, 0, and 255) and the subnet mask to 255.255.255.0.

That's it, you can now talk between your guest and host. Once you have Samba installed and configured correctly on your guest, you can now browse to your guest from your host by going to 'start->run' then typing in \192.168.0.X\sharename (where X is the guest and 'sharename' is the share name you setup in your samba share).

Hope that gets you heading in the right direction

EDIT: Quick note on the loopback adapter. If you view its speed on the Win7 machine you'll see it says '10mb' (yes TEN megabit), this is a misnomer because loopbacks don't actually have a 'speed' associated with them, so Windows reports 10Mb in its place. The reality is that the 'speed' of your loopback will be as fast as VirtualBox, Windows, and Ubuntu can transfer data over that interface. So in all actuality it might honestly be closer to 100Mb or 1Gb or more, but just know that the 10Mb speed can be disregarded as the actual speed.

share|improve this answer
    
Thanks for the detailed reply! I'm getting stuck on the "Boot up your Ubuntu guest" step - it's still giving me the error I listed in the original posting. –  MikeTheTall Nov 25 '12 at 6:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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