I’ve been using VMWare for the last couple of years. What I really liked about it was that when you ran the vmware-config.pl script, it would automatically set up interfaces for the virtual machine to interact with the host OS. What I didn’t like was that the guest OS was so slow. I heard about Parallels, and from what I’ve seen, it’s a very slick and had a great feature that allowed you to switch to seamless mode. In this mode, you could run applications with the illusion that you were running the application within the guest OS, in my case Linux.
Since I was running Linux, Parallels was not an option for me. Instead I dug in and found a Virtualbox. This VM also had the seamless mode feature which I’ve grown to really love and has become a key feature that I look for. Another great advantage of the VM is that it’s fast, really fast! It seems so fast, that it’s almost like running Windows XP (for example) right on my hardware. Plus, booting Windows XP is so much faster than if I were to install it and load it right from disk.
Enough about Virtualboxes feature. What I’m really doing is describing how to get the guest OS to access the host OS file system through samba. By default, Virtualbox uses the IP of the host OS to get online. This is fine and dandy, but what if you wanted to access shares on the host from within the guest OS? This is how you do it:
- Make sure that the kernel has 802.1d Ethernet bridging and that Universal TUN/TAP device driver support is either compiled into the kernel or as a module.
- Login as root
- create the device. The output will tell you that the device has been created and the ID of the person who owns it:
# tunctl -t tap0 -u username
Set tap0 persistent and owned by uid 500
- Change the permissions of /dev/tun to 666 (tun may be in /dev/net)
# chmod 0666 /dev/tun
- Create the bridge
# brctl addbr br0
- Add the real interface to the bridge
# brctl addif br0 eth0
- Add the tunnel interfaces to the bridge
# brctl addif br0 tap0
- Bring up the bridge
# dhcpcd br0
The last part is modifying some of the guest OS’ settings. Start VirtualBox, select an OS, click on Network, make sure that the network adapter (or at least one of them) is enabled. Change Attached to so it says Host Interface then type in tap0. Finally click OK and start the virtual machine.
If you need to add more than one interface for running multiple Virtual Machines at once,