Qemu Network Bridge Support -------------------------- My box: Centos 5.4 x86_64 Qemu version ---------- qemu-0.10.6-1 dkms-kqemu-1.4.0-0.1 (rpmforge) on abit kn9 with MCP55 chipset and (svm) enabled CPU, AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ My CPU supports svm, so it pays for me to use the kqemu module. A package for tunctl is on my C5 repo. #yum install bridge-utils,tunctl --------- add to /etc/rc.local ------- # bring up qemu bridge modprobe kqemu modprobe bridge modprobe tun /etc/qemu-br0-up --------------- end snip --------- -------------- helper script run at startup -------- $ cat /etc/qemu-br0-up #!/bin/sh /usr/sbin/brctl addbr br0 /sbin/ifconfig eth0 0.0.0.0 promisc up /usr/sbin/brctl addif br0 eth0 /sbin/dhclient br0 # not needed #route add default gateway 192.168.1.1 /sbin/iptables -F FORWARD ------------- end snip ----------- ------------- qemu-ifup ------------- #cat /etc/qemu-ifup #!/bin/sh /sbin/ifconfig $1 0.0.0.0 promisc up /usr/sbin/brctl addif br0 $1 /usr/sbin/tunctl -u root -t $1 exit 0 ------------- end snip -------- For the 2 helper scripts do: >sudo chmod 755 qemu-ifup # may help if you have no ip6 routers #chkconfig ip6tables off #/etc/init.d/ip6tables stop #start qemu with tap/tun, phony mac address, fast rtl8139 nic, and vnc @me>sudo qemu-system-x86_64 -kernel-kqemu -name winxpvm -hda /data/livecd/winxp.img -localtime -m 768 -net \ nic,macaddr=00:16:3E:21:C4:F8,model=rtl8139 -net tap -vnc :1 -vga cirrus Notice that there is no [-net user] parameter. If there was, qemu will stop any bridging and force NAT. If you use the -vnc param, you might have trouble stopping the guest and you will see qemu-* processes hanging around in top. The Qemu session will close if the guest OS does a clean shutdown. In winxp, you can do a shutdown while in an RDP session using main-menu->run->cmd->shutdown -s If Winxp hangs and says "it's now OK to shutdown your computer" read this kb article: http://support.microsoft.com/kb/810903 There is a fix for "Standard PC" with acpi support. ----------------- ifconfig after startup with Qemu bridge ----------------- $ ifconfig br0 Link encap:Ethernet HWaddr 00:50:8D:93:BC:2D inet addr:192.168.1.108 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::250:8dff:fe93:bc2d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:123710 errors:0 dropped:0 overruns:0 frame:0 TX packets:93569 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:139292870 (132.8 MiB) TX bytes:8344648 (7.9 MiB) eth0 Link encap:Ethernet HWaddr 00:50:8D:93:BC:2D inet6 addr: fe80::250:8dff:fe93:bc2d/64 Scope:Link UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 RX packets:5044 errors:0 dropped:0 overruns:0 frame:0 TX packets:5639 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2811869 (2.6 MiB) TX bytes:1023211 (999.2 KiB) Interrupt:66 Base address:0x2000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:17 errors:0 dropped:0 overruns:0 frame:0 TX packets:17 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1320 (1.2 KiB) TX bytes:1320 (1.2 KiB) virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:63 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:12982 (12.6 KiB) ------------- end ifconfig ---------- Author ------ msp December 1, 2009