Linux kernel support for virtual network devices(called TAP interfaces), widely be used in virtualization, ex: vmware, openvz, virtualbox ...
The TAP interfaces behave like physical network interfaces on your host and will work with any networking tools installed on your host system. From the point of view of the host, it looks like the guest’s network card is connected to the TAP interface with a network cable.
Setting up a bridge network interface on Linux Hosts (ex. Ubuntu):
Step 1:
Necessary tools
uml-utilities : User-mode Linux (utility programs)
bridge-utils : Utilities for configuring the Linux ethernet bridge
Install:
sudo apt-get install uml-utilities bridge-utils
Step 2 : create TAP interface
sudo tunctl -t tap0 -u username
Step 3 : Create a br0 bridge
sudo brctl addbr br0
Step 4 : Make your real network interface be promiscuous
sudo ifconfig eth0 0.0.0.0 promisc
Step 5 : Link your real network interface to bridge br0
sudo brctl addif br0 eth0
Step 6 : Assign an IP to the br0. If you are using DHCP
sudo dhclient br0
Or, if you assign an IP yourself(the IP may be different from yours.)
sudo ifconfig br0 192.168.1.102
Step 7 : Link TAP to bridge br0
sudo brctl addif br0 tap0
Step 8 : Activate TAP interface
sudo ifconfig tap1 up
Step 9 : Change the permission of /dev/net/tun
sudo chmod 0666 /dev/net/tun
Step 10 :
use this TAP interface in your Programs.
ex: VirtuoBox, at the VirtualBox startup panel, choose “Host Interface” and add “tap0″ to “Interface Name”.
Step 11 :
At the guest (after boot up the guest OS), change the IP of the guest OS to the same subnet of your host.
IP 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.1
DNS #1 208.67.222.222
DNS #2 208.67.220.220
Learn:
Net:Bridge
http://www.linux-foundation.org/en/Net:Bridge
Universal TUN/TAP device driver.
http://www.kernel.org/pub/linux/kernel/people/marcelo/linux-2.4/Documentation/networking/tuntap.txt
Bridge network interface on VirtualBox
http://ipunblocker.info/index.php?q=uggc://fnzvhk.jbeqcerff.pbz/2007/07/11/oevqtr-argjbex-vagresnpr-ba-iveghnyobk
VirtualBox - User Manual
http://195.34.175.98/download/UserManual.pdf