Problems with network handling (Bridge, Qemu)
Hallo,
I, Debian Testing/Unstable, 2.6.15, KDE 3.5.3, try to connect my virtual Qemu-machines totally to my network.
For this I uses scripts which I found at different places.
The start script for the virtual machine:
<win98start.sh>
#!/bin/sh
sudo /opt/qemu/init-kqemu.sh
sudo /opt/qemu/qemu-start-net.sh
qemu -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 -usb -soundhw \
sb16 -localtime win98dev.img $1 $2 $3 $4 $5 $6 $7 $8 $9 </win98start.sh>
The subscripts:
<init-kqemu.sh>
#!/bin/sh
#prepare kqemu
if [ lsmod | grep -c kqemu -eq 0 ]; then
echo "load kqemu...";
/sbin/modprobe kqemu major=0;
sleep 3;
fi
/bin/chown root.winuser /dev/kqemu;/bin/chmod 0660 /dev/kqemu
</init-kqemu.sh>
<qemu-start-net.sh>
#!/bin/sh
if [ netstat -i | grep -c br0 -eq 0 ]; then /bin/chgrp winuser /dev/net/tun
/bin/chmod 0664 /dev/net/tun
# Allow IP forwarding
/bin/echo 1 > /proc/sys/net/ipv4/ip_forward echo "Setup the bridge";
brctl addbr br0
echo "Add host ethernet adapter to the bridge" brctl addif br0 eth0
echo "Remove IP address from host ethernet device" ifconfig eth0 0.0.0.0 up
echo "Grab an IP address from DHCP for the bridge" /sbin/dhclient br0;
fi;
</qemu-start-net.sh>
The following script will be called by qemu:
<qemu-ifup.sh>
#!/bin/sh
echo $1
/sbin/ifconfig $1 0.0.0.0 promisc up/usr/sbin/brctl addif br0 $1
</qemu-ifup.sh>
The output of the start script:
[..]
DHCPREQUEST on br0 to 255.255.255.255 port 67 DHCPACK from 192.168.10.1
bound to 192.168.10.22
[..]
It shows that the bridge is connected to the router.
After this neither my host linux machine nor the virtual machine is connected to the internet.
Also my router was not reachable.
I could solve this only by a restart.
Something I tried to reach the internet again without a restart:
ifconfig br0 down
brctl delif br0 eth0
brctl delbr br0
ifconfig eth0 up/sbin/dhclient eth0
but it does not work.
I am very appreciate for any hints to solve my problems, also for hints to reconnect to the internet after failure tries.
Ciao
Peter Schütt
Signature · 1 line
www.pstt.de