0

QEmu over a bridge in Ubuntu Linux

Being a linux user, I use QEmu to save me with those windows applications that I must use on the corporation environment. It all went well until I installed a windows tool that needed icmp to work. As you know, the basic and simple network setup of QEmu just support tcp and udp.

To have enough freedom I wanted to have my QEmu “machine” with a unique ip address as my notebook do. I pretend to simulate having two different systems over my subnet.

Let’s configure my Linux Ubuntu 7.04 Feisty to run this environment.

Let’s use a bridge instead of eth0 to have two different interfaces.
Edit your /etc/network/interfaces to look like this

auto lo
iface lo inet loopback

auto br0
iface br0 inet static
  address 10.0.0.17
  netmask 255.255.255.240
  gateway 10.0.0.30
  bridge-ports eth0

We add eth0 to the bridge group br0 and configure the allocated ip address to my linux notebook.

QEmu must be launched adding the options “-net nic -net tap” so it uses the tap device. You must “sudo” qemu so it can use the device – or configure it so it’s accessible from user mode. I don’t spend time with that and always use “sudo” – it’s just my machine.
Edit the interface script /etc/qemu-ifup to add it to br0.

#!/bin/bash
echo "Running /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

After having my windows running I configured its network ethernet device:

ip address: 10.0.0.18
netmask: 255.255.255.240
gateway: 10.0.0.30

The name server caches were configured too.

Et voilá, you have two operating systems on two different machines
using each own ip address and completely exposed to your network.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.