3

I've created a Windows XP image and I'm booting it with qemu. When using "user mode networking" via -net user, my guest os (windows xp) gets the 10.0.2.15 IP assigned and I can ping 10.0.2.2 so Windows drivers are installed correctly.

Unfortunately I'm unable to access anything else. I read tutorials and I found that "user mode networking" doesn't forward connections to internet, and I've to use either TAP device, or Bridge device.

I'm unfamiliar with these devices and the tutorials are very confusing and complicated.

One of tutorials suggested that I use qemu-bridge-helper. I configured /etc/qemu/bridge.conf to allow br0 bridge device and created the br0 device via brctl addbr br0.

I followed the tutorials and booted my winxp this way:

qemu-system-x86_64 --enable-kvm -m 2048 \
  -drive file=winxp.img,if=virtio \
  -net nic,model=virtio \
  -net bridge,br=br0

The image boots nicely but I don't get an IP address. The reason is that Windows is configured to use DHCP but "br0" is not providing a DHCP address as it's just a bridge interface (somehow tied with tap0 but I'm not sure what that means).

My question is - how do I configure "br0" to give addresses to winxp over DHCP? Do I've to run a dhcp server on tap0 interface? How is br0, tap0 and eth0 related? (eth0 is my static IP interface, the only internet interface.)

My second question is - is there an easier way to configure all of this to allow simple internet access to guest os?

3

My second question is - is there an easier way to configure all of this to allow simple internet access to guest os?

You don't (or, at least, shouldn't) need to manually configure anything for simple internet access; QEMU automatically handles it. It has some limitations, such as not supporting the ICMP protocol (used by ping), not being visible to the external network, nor being able to talk to other virtual machines run the same way, but it works well for simple usage. See the Arch Wiki for more information.

  • 1
    "not supporting the ICMP protocol" -- thanks for mentioning that! I tested my internet connection via ping, assumed internet does not work and proceeded to try to "fix" it for hours. Thanks! – Lukas Kalbertodt Jul 9 at 9:08
0

After your command brctl addbr br0 you need to connect new bridge to real network interface, by example eth0, witch is connected to the Internet. Use for it next command brctl addif br0 eth0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.