I'm trying to test some software on a big endian system to ensure compatibility. My plan is to use qemu on Ubuntu 12.04 to emulate a MIPS system. So far I've been able to create the quest system successfully, but I haven't been able to network it with the host system. I can access the outside world from the guest system (e.g. wget or apt-get), but my attempts at setting up samba have failed.
According to this, in QEmu 1.1 and newer the network bridge helper can set tun/tap up for you without the need for additional scripting. I'm trying to use that since I've seen different versions of the scripts. Right now qemu-system-mips -version
reports the following:
QEMU emulator version 1.0.50 (Debian 1.0.50-2012.03-0ubuntu2.1), Copyright (c) 2003-2008 Fabrice Bellard
I've compiled from the 1.4.1 source and used the version from apt-get
. Both report the same thing. I'm working under the assumption that I have version 1.1 or later despite what -version
is telling me. Anyway, the next instruction was to turn on the setuid attribute for the default network helper:
sudo chmod u+s /usr/local/libexec/qemu-bridge-helper
Next I created a bridge.conf
file in /etc/qemu/
and /usr/local/etc/qemu
with -rw-r--r--
for permissions. The contents of the file are:
allow br0
If I start QEmu with the following command:
qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta -hda disk.img -append "root=/dev/sda1 console=ttyS0" -nographic -net nic -net bridge,br=br0 -smb /home/uli/samba
or with
qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta -hda disk.img -append "root=/dev/sda1 console=ttyS0" -nographic -netdev bridge,id=hn0 -device virtio-net-pci,netdev=hn0,id=nic1
or with
qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta -hda disk.img -append "root=/dev/sda1 console=ttyS0" -nographic -netdev tap,helper=/usr/local/libexec/qemu-bridge-helper,id=hn0 -device virtio-net-pci,netdev=hn0,id=nic1
I get the following error:
failed to get mtu of bridge `br0': No such device
failed to launch bridge helper
qemu-system-mips: -net bridge,br=br0: Device 'bridge' could not be initialized
Fair enough, I didn't create the br0 bridge. I've tried creating one with a script I don't understand, but then my quest MIPS QEmu system no longer connects to anything. It sees br0, but it doesn't get an IP address. Clearly I'm doing something wrong here:
ifconfig br0 down
brctl delbr br0
ifconfig eth2 0.0.0.0 promisc up
brctl addbr br0
brctl setfd br0 0
brctl addif br0 eth2
echo 1 > /proc/sys/net/ipv4/conf/br0/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/eth2/proxy_arp
echo 1 > /proc/sys/net/ipv4/ip_forward
dhclient br0
ifconfig br0 up
Is there an easier way to do this? Personally, I would be fine just using the SMB server on \10.0.2.4\qemu that's described here, but that hasn't worked for me either (115 errors when I try to mount the share, presumably because of networking trouble).
Update
Once I create the bridge, I see the following output from ifconfig on the host machine:
br0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
inet addr:10.2.32.101 Bcast:10.2.32.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:85 errors:0 dropped:0 overruns:0 frame:0
TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8235 (8.2 KB) TX bytes:9227 (9.2 KB)
eth2 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:196581 errors:0 dropped:0 overruns:0 frame:0
TX packets:44205 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:139517339 (139.5 MB) TX bytes:3365206 (3.3 MB)
Checking the brctl show
output, I see the following:
bridge name bridge id STP enabled interfaces
br0 8000.XXXXXXXXXXXX no eth2
Now I start the quest system in QEmu. If I run ifconfig, I see the following:
eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:536 errors:1 dropped:51 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:55083 (53.7 KiB) TX bytes:2862 (2.7 KiB)
Interrupt:10 Base address:0x1020
And the bridge looks like this:
bridge name bridge id STP enabled interfaces
br0 8000.XXXXXXXXXXXX no eth2
tap0
Unfortunately with this setup, the quest system has lost the limited "user mode" networking it once had (i.e. wget and apt-get no longer work). The only IP address I see is for the bridge, so I'm not sure how the quest will appear on the network. The host still appears, at the same IP address as br0.
Update
Here is the output from iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
iptables -L
. So you can ping www.google.com from both the Host and the Guest? I would attempt to setup samba on either the Host or the Guest, depending on which way you want to push/pull the files.