Version 1 (modified by pierre, 7 years ago)

--

Reporting functionality

Over network

Testing via Qemu

The virtual machine needs access to the internet. If you don't have a PXE/tftp server on you network, you can use the one bundled with Qemu.

In order for the guest to have access to the built-in PXE server and be on the network as well, you need to create a bridge. To do so, replace the entry in /etc/network/interfaces for your existing network card (e.g. eth0).

auto eth0
iface eth0 inet dhcp

becomes

auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

In case you are using a static IP:

auto eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1

becomes

auto br0
iface br0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

Restart your network (/etc/init.d/networking restart). The physical interface (eth0) should be 'UP' but without an IP address assigned to it. br0 should be 'UP' and have an IP address.

Replace Qemu default networking script /etc/qemu-ifup by

echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /usr/sbin/brctl addif br0 $1

Since this script is run each time Qemu starts, you may want to tweak your sudoers file to avoid running Qemu as root. Use visudo to add

# Cmnd alias specification
Cmnd_Alias      QEMU=/sbin/ifconfig, \
                     /sbin/modprobe, \
                     /usr/sbin/brctl
# User privilege specification
root	ALL=(ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
$username$     ALL=NOPASSWD: QEMU

With this bridge, the guest has now access to the network if you boot with the following options

-net tap -net nic