Hi all,
if you're working with ubuntu, you could also setup bridge-utils (apt-get install bridge-utils) on your host and try the following scripts:
-- qemu-start-nw
! #!/bin/sh ! # ! # This script requires qemu 0.11.50 or newer and a host ! # system with bridge utils. Must be run as root. ! ! qemu-ifup tap0 ! ! qemu -kernel $1 -serial stdio -m 1024 -usbdevice mouse -usbdevice keyboard -net nic,model=pcnet,macaddr=00:81:71:61:51:41 -net tap,ifname=tap0,script=no,downscript=no ! ! qemu-ifdown tap0
$1 would be the weaver.elf file. Don't make the first byte of the assigned mac address an odd number, because that would be a multicast mac address which might be ignored by some (linux-) peers.
-- qemu-ifup
! #!/bin/sh ! # ! # script to bring up the tun device in QEMU in bridged mode ! # first parameter is name of tap device (e.g. tap0) ! ! # ! # First take eth0 down, then bring it up with IP 0.0.0.0 ! # ! /sbin/ifconfig eth0 down ! /sbin/ifconfig eth0 promisc up ! ! # ! # Bring up the tap device (name specified as first argument, by QEMU) ! # ! /usr/sbin/openvpn --mktun --dev $1 --user `id -un` ! /sbin/ifconfig $1 up ! ! # ! # create the bridge between eth0 and the tap device ! # ! /usr/sbin/brctl addbr br0 ! /usr/sbin/brctl addif br0 eth0 ! /usr/sbin/brctl addif br0 $1 ! /sbin/ifconfig br0 up ! ! # ! # only a single bridge so loops are not possible, turn off spanning tree protocol ! # ! /usr/sbin/brctl stp br0 off
-- qemu-ifdown
! #!/bin/sh ! # ! # Script to bring down and delete bridge br0 when QEMU exits ! # ! # Bring down eth0 and br0 ! # ! /sbin/ifconfig eth0 down ! /sbin/ifconfig $1 down ! /sbin/ifconfig br0 down ! # ! # Delete the bridge ! # ! /usr/sbin/brctl delbr br0 ! # ! # bring up eth0 in "normal" mode ! # ! /sbin/ifconfig eth0 -promisc ! /sbin/ifconfig eth0 up ! # ! # delete the tap device ! # ! /usr/sbin/openvpn --rmtun --dev $1
Perhaps you must prevent local networking from using the bridged interface (for whatever reason, this does not seem to work in my case)
! route del -net 192.168.1.0 netmask 255.255.255.0 dev eth0 ! route add -net 192.168.1.0 netmask 255.255.255.0 dev wlan0
Good luck
Sven
Christian Helmuth wrote:
Hello Peter,
On Mon, Feb 22, 2010 at 11:29:38AM +1030, Peter Nguyen wrote:
Is anyone able to give me some pointers on how to set up the TAP version of the HTTP server? My knowledge on setting up such things is not that good. More specifically, I'm unsure as to what do for setting up the DHCP server step stated in the following link: http://genode.org/documentation/release-notes/9.02#section-4
I also discovered this deficiency in the documentation while writing a section of the release notes for Genode 10.02. The information regarding your question is:
[...] Therefore, the device has to be configured prior to running Genode like the following.
! sudo tunctl -u $$USER -t tap0 ! sudo ip link set tap0 up ! sudo ip address add 10.0.0.1/24 brd + dev tap0
Give it a try with the lwIP example scenario. Please note that lwIP is configured for DHCP and does not assign a static IP configuration to its end of the wire. Hence, you should run a DHCP server on tap0, e.g.
! sudo /usr/sbin/dhcpd3 -d -f -cf /tmp/dhcpd.conf -pf /tmp/dhcpd.pid -lf /tmp/dhcpd.lease tap0
An example 'dhcpd.conf' may look like
! subnet 10.0.0.0 netmask 255.255.255.0 { ! range 10.0.0.16 10.0.0.31; ! }
The DHCP server's log will show you that the driver fakes an ethernet NIC with the MAC address 01:02:03:04:05:06.
Happy Hacking
-- Sven Fülster