With recent version of VirtualBox you no longer need to create a bridge and tap to enable host networking. In the settings panel of the virtual machine, select the network tab, and make sure that its set on bridged adapter. VirtualBox automatically creates a virtual ethernet adapter, and bridges it to the network of the host machine.
Bridging to the host network is necessary for the virtual machine to get an ip address from the router. Such a configuration is needed to communicate with the machine from the outside world. Because of this feature virtual machines can server website, and other services. I use my virtual machine to host this website, a visual ftp server, a wiki, and an EyesOS server.
There are other ways to forward individual ports from the host system to the guest, but then the ports on the host machine will not be accessible on the host; they will virtually represent the guest OS thus hindering connectivity with the host machine. There may be instances where this is what is wanted and more information, including instruction, can be found on this previous post.
The following is a screenshot of the network tab in VirtualBox. It had a bridge adapter option that will autobridge the connection to an existing ethernet adapter. Bare in mind that this is the screen from a Linux install of VirtualBox and it might be different in Windows. I remember in Windows you might have the option to create a virtual ethernet adapter, and then you can bridge the connection all in VirtualBox. Nothing needs to be done manually anymore, and everything can be done from within the VirtualBox configuration panels.
Here is a screen from Windows Vista. Go to the network tab of the virtual machine settings:
Then select the attach to drop down menu:
Then change the attach to, drop down menu, to bridged adapter:
If you have setup your bridge and tap directly in the network interfaces file, you still have to chmod the /dev/net/tun folder to successfully utilize host networking. I use a quick startup script located conveniently in my home folder. sudo chmod 666 /dev/net/tun Place this line in a file and name it host.sh or something. Then open your preferences>>session configuration menu and set it to be run on startup. Now with correct network interfaces configuration your guest system will successfully recognize the tap.
When configuring your network, bridges, and taps you want your default Ethernet card to have the same static ip address as the bridge you create in /etc/network/interfaces. Doing so you will have internet access on the host and guest systems. Within the guest system configure the interfaces to be one numerical value higher in order to avoid conflict with the host.
In your /etc ditectory is the network folder. In the network folder is the interfaces file that contains all the data used to configure your network. The default configuration is dhcp. You can configure this file manually, to a limited degree, via the administration>>network panel. For most applications dhcp will be fine, and therefore you can leave your default configuration. If you want to setup a static ip, for your primary ethernet card, use the administration>>network configuration menu. You can set any static local ip outside the range of the dhcp configuration on your router. You can disable the dhcp of your router to set static addresses for the lower safe range. The default dhcp range is typically 192.168.0.2 to 19220.127.116.11. After disabling dhcp you can disable network manager in the preferences>>sessions configuration menu. If you are using a bridge and tap I highly recommend direct configuration of your interfaces via the /etc/network/interfaces file. Please refer to my previous post for more information about bridge and tap configuration.
There are two methods of creating a bridge and tap on Linux. The easy method is via a script that is set to automatically run at login. The following is the script that I used for a long time to setup two taps. It will create a bridge and assign an ip address to it via dhcp. It will create a tap with ip 192.168.0.102, and a second tap with ip 192.168.0.105. host.sh Bridge and Tap Configuration Script I have completely abandoned the startup script method in favor of directly configuring the network interfaces on the host and the guests. To configure the host networking bridge and tap open the interfaces file located in /etc/networking. sudo nano /etc/networking/interfaces Now add a tap: auto tap0 allow-hotplug tap0 address 192.168.0.101 iface tap0 inet manual tunctl_user nseidm1 Then add the bridge: auto br0 iface br0 inet static address 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255 gateway 192.168.0.1 bridge-ports eth1 tap0 bridge-ageing 7200 bridge-fd 0 The tap will be created with an ip address of 192.168.0.101 and the bridge with and ip of 192.168.0.100. Then inside your guest os configure the interface; set the eth0 ip address to the same ip as the tap. This works fine based on my experience up to this point. This also help consolidate ip addresses; note that only two have been used in total. One for the host system configured through the bridge br0, and the other for the tap that is configured in conjunction with the guest os interface.