This evening I installed my old copy of XP (I’m now running Vista) into VirtualBox. The install was pretty easy and straight forward, so much so that it’s not even worth doing step by step instructions. A simple wizard setup my base machine, and XP installed just like it would as a “real” machine.
Using the default of NAT for networking (Networking Address Translation) seemed OK for getting to the internet, but I spent most of my evening trying to make the guest OS, in this case XP, talk to the hard disks of my host OS, Vista.
To save you a lot of grief and manual digging, here’s what I finally had to do. First, I setup a single folder on my host OS, right clicked on it to bring up properties. I then picked the Sharing tab and told the OS to share it with others on the network. (Yes, I’m firewalled, both hardware at the router and within the OS as well. I haven’t been listening to all those security now episodes for nothing! )
The folder I created was named “Z”, for no better reason than it’d be easy to find. I also named the share Z, for consistency. Once I had it shared, I went back into the guest OS of XP, which was running inside VirtualBox. I opened an explorer (aka My Computer) window, and picked Tools, Map Network Drive. OK, here comes the tricky part:
After picking the drive letter, for the Folder I had to use the IP address of the guest OS, followed by the name of the share, as in \\192.168.1.1\Z . I could not browse my local network, I couldn’t enter the machine name, only using the combo of IP address followed by share name would work.
Digging in the documentation it said that running VirtualBox’s network emulation in NAT mode caused the issue, and gave the solution, but I wish they had mentioned it a bit more prominently in the software, since using a lot of common techniques was not working.
A few notes, yes I could have chosen to share my entire drive. However, being security conscious I prefer to setup a single folder and share it. That allows me a comfortable level of isolation, and allows my to quickly and easily scan the contents with antivirus / spyware applications before using the files. And, if anyone should “break in” my exposure via shared networking will be limited to that single folder, which will be empty 99.9% of the time.
To find your machine’s IP, in the host box (outside VirtualBox) open a command window and type in IPCONFIG and hit enter. In the list of wireless adapters should be your hard wired network card, just grab it’s IP address.
Also, the share name of “Z” was because I was testing, for longer term I’ll probably setup something more meaningful like “VirtualBox Shared Folder”.
Be aware that the moment you share a folder between your VirtualBox (or any Virutal Machine) and the host OS, you have a security vulnerability. That may be fine, and will be one of the better solutions for transferring data and application installs between the host and guest OS.
Many people though use virtual machines to test new software (especially “free”applications) for viruses / spyware / malware. If that’s your goal, make sure to disconnect your mapped network drive before testing these potentially harmful applications.
Hopefully I’ve saved you a bit of effort in establishing a connection between your guest and host OS’s hard disks when running VirtualBox.
2 thoughts on “VirtualBox – Communicating to the Host OS via Networking”
you rock man!
after try after try, finally i found your tutorial and it work.
I never quite got the Shared folders feature to work, and couldn’t browse the network, either. Your suggestion saved the day. Thanks!