host networking

VirtualBox Windows Vista – Host Network Bridge and Tap

This entire post is no longer applicable to the most recent version of VirtualBox. Here is a more recent post.

VirtualBox is well equipped for a Windows environment. Most of its features have a mechanism for automatic installation and setup. To get your guest OS, in Windows Vista, to have a real IP address from your router you first need a network bridge and tap. Open the VirtualBox manager:

VirtualBox manager screenshot

Then select a guest OS and open its settings. Then click the network tab:
VirtualBox manager network tab

Then click the add network tap button:
Add network tap button

It doesn’t matter what the name is :) Then adjust your guest OS networking adapter accordingly.

Enable host network

Now open your Windows Vista network configurations manager:

Microsoft Vista network configuration

This screenshot is what your network configurations should be after everything is done. To achieve this simply select both the VirtualBox tap, that was previously created, and bridge it to your LAN connection. Select both by click on each adapter while pressing the shift key. Then right click on either of the two highlighted icons and select “bridge”. This will automatically create a bridge between the tap and your real host networking adapter. Wham bam, now you can select a real static IP in your VirtualBox guest OS on a Windows Vista system :)

Update (12/4/2009); At the top of this post I say that the information here is outdated. You can view the post listed above if you want, but here are the pertinent screenshots also:

Here is a screen from Windows Vista. Go to the network tab of the virtual machine settings:

Network settings

Then select the attach to drop down menu:

Attach

Then change the attach to, drop down menu, to bridged adapter:

Bridged adapter

VirtualBox Host Networking – Script Versus Interfaces

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.

VirtualBox Host Networking Set Host Static Local IP

If you are running a guest operating system, and are utilizing host networking via a bridge and tap, you should set the host IP address statically. On my other machine I was able to utilize DHCP for the host IP, but on this machine when the guest IP address is set the host has trouble DHCP’ing and new IP address. Overall setting IP address statically is important to keep track of utilized and available IP addresses. DHCP is really only useful in practice when anonymous machines are connecting and the MAC addresses are new to the router.

Fedora 8 Host VirtualBox

On Fedora Core distributions, and Fedora 7 & 8 you will not be able to enable VirtualBox host networking the same way as on Debian based system. Red Hat and the Fedora distributions do not include uml-utilities which is a required application for proper host networking functionality. You have reached a dead end on this blog for support for VirtualBox host networking on Fedora distributions. I have decided to use Debian because of their inclusion of uml-utilities in the default repositories.

VirtualBox Host Networking Multiple Taps

After the creation of the first tap you can create additional taps and connect them to the single bridge off the ethernet connection. For example the following is my setup for an additional tap. sudo tunctl -t tap1 -u username sudo /usr/sbin/brctl addif br0 tap1 sudo ifconfig tap1 192.168.0.12 up sudo bash -c ‘echo 1 > /proc/sys/net/ipv4/conf/tap1/proxy_arp’ sudo route add -host 192.168.0.5 dev tap1 sudo arp -Ds 192.168.0.5 eth0 pub You want all IP addresses to be unique otherwise there will be conflicts. Do consider the IP address you want to provide to the Guest OS. Note that you can specify the MAC address of the VirtualBox ethernet card in the VirtualBox configuration menu. This is useful if you want to configure a static IP address to be supplied to your Virtual OS. This post is superseded by a more recent post.