Samba: how can I access a share on a Virtualbox guest (in NAT mode)

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
   address 192.168.36.2
   netmask 255.255.255.0
   network 192.168.36.0
   gateway 192.168.36.1
   dns-nameservers 192.168.36.1

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 hereenter image description hereenter image description hereenter image description hereenter image description here


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.