Monday, November 5, 2007

Shared folders

When you check the automatic generated IP-configuration of the guest you'll get something like this:

IP-address. . . . . . . . . . . . : 10.0.2.15
Subnetmask. . . . . . . . . . . : 255.255.255.0
Defaultgateway. . . . . . . . . : 10.0.2.2

This means your host OS is acting like a router, creating a new network (10.0.2.0/255.255.255.0) with gateway address 10.0.2.2. The guest OS is virtually connected to the router with IP-address 10.0.2.15.

You can also verify that the router exists by pinging 10.0.2.2. This should work (and it does) without packet loss. Since 10.0.2.2 is the IP address of our host OS in the "new" network we should be able to connect with it's shared folders using that IP address, but somehow this doesn't work.

Luckily we have a solution for this problem. VirtualBox uses its own system for handling shared folders from the host OS to the guest OS. You can read the manual, but here is a short version:

  1. In the Devices menu you choose Shared Folders. Then in the dialog you pick the folder from the host OS you would like to access in the guest OS. Then you should give it a name (or use the default name).

  2. Then open cmd.exe in your guest OS. Type:
    net use x: \\vboxsvr\sharename

    where x is the driveletter you want to assign to the shared folder and sharename is obviously the name of the share you gave in the dialog (see step 1). \\vboxsvr is a static name for the host OS, so you should not change this.

  3. Now the share will be mounted and can be found in My Computer
Note:
Somehow I am able to connect to all other computers in my network by using their IP-address. So VirtualBox's utility for sharing folders is only necessary for the host, not for other computers in your network.

No comments: