My OS: Windows 8

Virtualbox guest: Ubuntu 12.10 server

I configured apache server on vbox guest and mapped http, https, ssh port successfully into ubuntu server. It works nice without any problem.

My network card is in NAT mode. After some research I installed samba on guest system. I need to map /var/www/ folder on windows 8 so that I can work directly inside guest server from windows.

Here is my smb.conf

 comment = "Vbox server share"
 path = /
 writable = yes
 read only =no
 browseable = yes
 force directory mode = 777
 force create mode = 777
 force security mode = 777 
force directory security mode = 777
 hide dot files = no
 create mask = 0777
 directory mask = 0777
 valid users = @users, tural, root
 delete readonly = yes
 guest ok = yes
workgroup = WORKGROUP

I know that mapping works when networking is in bridged mode, but I don't want to make my vbox server visible to network.

Also I confgured windows hosts file and mapped port 80 with vbox nat so that, when I open some domain that redirected into localhost on windows, it gets data from virtualbox webserver. If do bridged, I will not be able to open guest webserver

Is there any other way to make drive mapping possible with NAT or something else?

2 Answers 2


Configure a second adapter as host only, set the second interface on the VM to static ip that does not interfere with your local network(s), e.g., set /etc/network/interfaces to:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

# The host network interface
#auto eth1
#iface eth1 inet dhcp
auto eth1
iface eth1 inet static

Then go to its properties from windows networking and set a static ip that does not interfere with your local network(s), e.g.: enter image description here enter image description here enter image description here enter image description here enter image description here

  • If you are switching wifi networks is the a network range that won't ever interfere with this static ip address?
    – William
    Sep 17, 2018 at 22:38

This setup can't work. You can map the smb ports to VirtualBox, but then you're host will lose smb connectivity.

If you just want to access some host folders from the guest you can use Shared Folders, it's a kind of limited smb connection. You will need to install the guest additions. It will do exactly what you want but limited to the host and guest. I mean no other machine will be able to access those folders.

There are some other more options, like using two interfaces, one NAT and the other using Bridge or Host-only.

  • 1
    I configured second network adapter as host only and believe me, it worked, I mapped / folder directly to windows
    – heron
    Apr 15, 2013 at 10:23
  • Yes, two different interfaces will work, it's not needed that one is bridged. I will edit the answer. Apr 15, 2013 at 10:44
  • Anyway, as a curiosity. Why not shared folders? Apr 15, 2013 at 10:45
  • 1
    @JavierRivera I normally use virtual ubuntu server on windows 7 host, and it 'feels' like Samba outperforms shared folders. Unfortunately I don't have any numbers to support this statement, but working with my git project on ubuntu with thousands of files feels sluggish when running git on guest, while running on host over samba is just fine.
    – tishma
    Apr 4, 2014 at 21:42
  • 1
    Its odd that you suggest shared folders, and suggest opposite of what he needed, but he, and I, need to map a shared folder on the guest vbox (linux), and have it accesible on a windows machine via \\\sharename. im on a corp domain, although i can see the share in the guest using smbclient i cant access it without the extra host only adapter, however the prompt comes up, but i cant authenticate at all. Im goimg to test your static ip idea, however the machine is answering so i think thats not the issue. Ill try bridged mode next. Aug 16, 2017 at 23:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .