VirtualBox: Another Open Source Virtual Machine (Part III)
From the previous serious problem, I have to make a solution about how to bridging on Linux hosts over the VirtualBox, but I great successfully working on it. From the documentation available, the VirtualBox implemented Host Interface Networking with the Linux kernel's own TAP interfaces. Therefore, make sure that Linux kernel has support for TUN/TAP enabled. While the additional drivers are then not required, the TUN/TAP packages are not available on Fedora Core 4 setup CD’s. There are at least 3 packages are needed to enabled it.
tunctl utility
With TAP, the Linux kernel can simulate Ethernet interfaces that, instead of being attached to networking hardware, communicate with VirtualBox. The TAP interfaces therefore appear like physical network interfaces (e.g. eth0) on the system. To create a TAP devices, use the tunctl utility. For Fedora Core 4 release, have a download session on this link.
brctl utility
Bridging, then, is a feature provided by the Linux kernel and can be controlled with the brctl command from another utility package. This tiny packages released for Fedora Core 4 are available on this link.
libsysfs library
The libsysfs is a dependency library needed by the brctl utility. Again, for Fedora Core 4, the download link are available here.
There are two ways these interfaces can be created, define a static link or dynamically. A static link build a persistent TAP interfaces on the Linux host and make them available to VirtualBox. While a dynamically build TAP interfaces each time a VirtualBox starts, and destroyed when it stops. To simplify this, I let you know how to create a static link. For a moments, go provide those 3 packages above available & install it on your Linux system. Then perform the following steps as root:
1. As root, run tunctl to create a new TAP interface:
where is the user who wants to run VirtualBox with the new bridge.
2. Create a new bridge, which we will call br0:
4. Add your network adapter to the bridge:
For configurations where the network adapter is configured statically, you need to setup br0 exactly as you would have set up eth0. At this point the host should have network connectivity
again.
6. Add the new TAP device to the bridge as well:
Go get some pinging process to local Linux host or other else hosts & it will working good. By the way, if the existing network are configured with proxy & gateway, you may adding a router mechanism after succeded bridging the VirtualBox. This would done by "route add" command prompt at Windows, just like example below:
The settings above are helping me to connect to the LAN & internet connectivity from the proxy or gateway. So on, there will be no problem with the Windows based native application required networking link but totally failed to run over the Windows emulator. Just like the problem I described earlier…
So, case is closed!
tunctl utility
With TAP, the Linux kernel can simulate Ethernet interfaces that, instead of being attached to networking hardware, communicate with VirtualBox. The TAP interfaces therefore appear like physical network interfaces (e.g. eth0) on the system. To create a TAP devices, use the tunctl utility. For Fedora Core 4 release, have a download session on this link.
brctl utility
Bridging, then, is a feature provided by the Linux kernel and can be controlled with the brctl command from another utility package. This tiny packages released for Fedora Core 4 are available on this link.
libsysfs library
The libsysfs is a dependency library needed by the brctl utility. Again, for Fedora Core 4, the download link are available here.
There are two ways these interfaces can be created, define a static link or dynamically. A static link build a persistent TAP interfaces on the Linux host and make them available to VirtualBox. While a dynamically build TAP interfaces each time a VirtualBox starts, and destroyed when it stops. To simplify this, I let you know how to create a static link. For a moments, go provide those 3 packages above available & install it on your Linux system. Then perform the following steps as root:
1. As root, run tunctl to create a new TAP interface:
tunctl -t tap1 -u
2. Create a new bridge, which we will call br0:
brctl addbr br03. Put your network adapter in promiscuous mode so that it will accept Ethernet frames for MAC addresses other than its own:
ifconfig eth0 0.0.0.0 promiscYou will lose network connectivity on eth0 at this point.
4. Add your network adapter to the bridge:
brctl addif br0 eth05. Transfer the network configuration of your ethernet adapter to the bridge (the following example assumes your network adapter is configured with DHCP):
dhclient br0Your physical Ethernet adapter will now merely act as a transport medium for the bridge.
For configurations where the network adapter is configured statically, you need to setup br0 exactly as you would have set up eth0. At this point the host should have network connectivity
again.
6. Add the new TAP device to the bridge as well:
brctl addif br0 tap17. Activate the new TAP device:
ifconfig tap1 upAfter this, you can now specify tap1 in the settings of your virtual machine, as if it were a real network adapter. Note that in order to use a static TAP interface, the VirtualBox process needs to have write access to /dev/net/tun. Either make sure the access bits allow access or add the user of the VirtualBox process to the group owning that device file.
Go get some pinging process to local Linux host or other else hosts & it will working good. By the way, if the existing network are configured with proxy & gateway, you may adding a router mechanism after succeded bridging the VirtualBox. This would done by "route add" command prompt at Windows, just like example below:
C:\WINDOWS\Desktop>route add 10.1.1.0 mask 255.255.255.0 10.1.7.225
C:\WINDOWS\Desktop>route print
Active Routes:
Network Address Netmask Gateway Address Interface Metric
10.1.1.0 255.255.255.0 10.1.7.225 10.1.7.225 1
10.1.7.0 255.255.255.0 10.1.7.225 10.1.7.225 1
10.1.7.225 255.255.255.255 127.0.0.1 127.0.0.1 1
10.255.255.255 255.255.255.255 10.1.7.225 10.1.7.225 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
224.0.0.0 224.0.0.0 10.1.7.225 10.1.7.225 1
The settings above are helping me to connect to the LAN & internet connectivity from the proxy or gateway. So on, there will be no problem with the Windows based native application required networking link but totally failed to run over the Windows emulator. Just like the problem I described earlier…
So, case is closed!
Labels: My Works
PS: If you've benefit from this blog, you can support it by making a small contribution. |
Anonymous said,
Monday, June 30, 2008 3:37:00 AM
Thanks Eko! Installed xpsp2 guest in Kubuntu 8.0.4 host with virtualbox 1.6.0. Kubuntu can now access windoz wireless usb dongle using tun/tap as you outlined. There is no Linux driver for the device which doesn't work with ndiswrapper. Can now update Kubuntu and browse the web without having to set up a second proxy machine!