# Refs http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge http://openvpn.net/index.php/open-source/documentation/miscellaneous/76-ethernet-bridging.html http://www.linux-france.org/prj/inetdoc/articles/vm/vm.network.tun-tap.html http://wiki.debian.org/VirtualNetworking # Run KVM/Qemu using a bridge kvm -hda test.img -cdrom Debian-Lenny.iso -boot d -vnc :0 -k fr -net nic -net tap,ifname=v_john0,script=no,downscript=no kvm -hda test.img -cdrom Debian-Lenny.iso -boot d -vnc :0 -k fr -net nic -net tap,ifname=v_john0,script=no,downscript=no -monitor stdio kvm -hda test.img -cdrom Debian-Lenny.iso -boot d -vnc :0 -k fr -net nic -net tap,ifname=v_john0,script=no,downscript=no --daemonize screen kvm -hda test.img -cdrom Debian-Lenny.iso -boot d -vnc :0 -k fr -net nic -net tap,ifname=v_john0,script=no,downscript=no -monitor stdio # Notes chown root:uml /dev/net/tun chmod 660 /dev/net/tun brctl addbr uml-bridge brctl setfd uml-bridge 0 brctl sethello uml-bridge 0 brctl stp uml-bridge off ifconfig eth0 0.0.0.0 promisc up ifconfig uml-bridge 192.168.0.100 netmask 255.255.255.0 up brctl addif uml-bridge eth0 tunctl -u umluser -t uml-conn0 ifconfig uml-conn0 0.0.0.0 promisc up brctl addif uml-bridge uml-conn0 ############################################################################## #!/bin/bash ################################# # Set up Ethernet bridge on Linux # Requires: bridge-utils ################################# # Define Bridge Interface br="br0" # Define list of TAP interfaces to be bridged, # for example tap="tap0 tap1 tap2". tap="tap0" # Define physical ethernet interface to be bridged # with TAP interface(s) above. eth="eth0" eth_ip="192.168.8.4" eth_netmask="255.255.255.0" eth_broadcast="192.168.8.255" for t in $tap; do openvpn --mktun --dev $t done brctl addbr $br brctl addif $br $eth for t in $tap; do brctl addif $br $t done for t in $tap; do ifconfig $t 0.0.0.0 promisc up done ifconfig $eth 0.0.0.0 promisc up ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast