I’m using a Windows XP guest in VirtualBox in a intensive way for a few days. The host and guest exchange their files via a shared folder. It’s a very convenient way to exchange data between virtual machines and the guest. In my case, the shared folders reside on an encrypted file system: guests do not have to care of security.
An alternative to shared folders is to use file servers like NFS or SMB (Samba). But they require a network interface configured as ‘host networking’, need maintenance and extra configuration. A limitation to shared folders is the file protection: files stored in shared folders are simply owned by the UID running the virtual machine. A shared folder access can be defined as read-write or read-only, nothing else. To support multiple users, SMB or NFS must be implemented. But it wasn’t a requirement in my case.
Under Windows XP, my shared folder is simply mapped to a drive letter using the following command:
C:\> net use s: \\vboxsvr\shared_folder /persistent:yes
I faced a very annoying problem: When trying to access the drive, it took from time to time ~30 seconds to display the files! Same issue when saving files from applications (the dialog boxes timed out too often).
I posted my problem to the VirtualBox forum and got a solution (it’s more a quick fix):
In your Windows XP guest, edit the ‘hosts’ file (located in c:\windows\system32\drivers\etc) and replace the line:
127.0.0.1 localhost
with this one (where my_hostname is your host computer name):
127.0.0.1 localhost vboxsvr my_hostname
Now, the time to access the share has been reduced to two or three seconds, which is more acceptable.
But I would like to understand how work the shared folders. I sniffed traffic on loopback interface at the host level and did not see any relevant traffic. Does anybody has more information?
This also works to speed up shared folders in VirtualBox
Hello cdman,
In this particular case, usage of a real file server was not the best solution. As my laptop is connected on several networks (friendly as “hostile”), the shared folders is the best solution: surface attack is very limited. Management is also “null”.
I sniffed the loopback on the host (Ubuntu side) using tcpdump.
Thanks for your comments!
AFAIK, a separate file server should also work with NAT not just with host only networking.
Also, regarding the localhost interface: usually it is not possible to sniff it: http://wiki.wireshark.org/CaptureSetup/Loopback