I`am struggling with bridging on qemu für about 2 days now, but today I made a major breakthrough.
I managed it to create the bridge and I was able to connect to the Internet from within the Virtual Machine. But on the host machine, the connection is lost. I think this happens because of
- Code: Select all
ifconfig eth0 0.0.0.0 promisc up
but as soon as I give eth0 its normal IP back the Internet on the host is working again and the guest-OS is basically cut off.
Well, here are the facts, maybe someone has a hint for me:
The Host-System is running 64-bit gentoo with a 2.6.22-mm Kernel on a core 2 duo
the guest is using i686 arch linux.
These are the IP-adresses I use:
Host: 192.168.11.25
Guest: 192.168.11.45
Router: 192.168.11.23
This is what I do to get the bridge working:
First, I start this little script:
- Code: Select all
#!/bin/bash
echo "Configure Bridge..."
brctl addbr br0
ifconfig eth0 192.168.11.25 promisc up
brctl addif br0 eth0
echo "Starting br0..."
/etc/init.d/net.br0 start
This is mainly taken from http://kidsquid.com/cgi-bin/moin.cgi/bridge
Then I`am giving br0 its IP-adress and gateway via /etc/init.d/net.br0 start
My /etc/conf.d/net looks like this:
- Code: Select all
config_eth0=( "192.168.11.25 netmask 255.255.255.0 brd 192.168.11.255" )
routes_eth0=( "default gw 192.168.11.23" )
config_br0=( "192.168.11.45 netmask 255.255.255.0 brd 192.168.11.255" )
routes_br0=( "default gw 192.168.11.23" )
This does nothing more than assign Gateway, IP, Broadcast etc. to the given interface, afaik.
After this steps, the internet on the Host-Machine is basically dead but inside the VM it works perfectly.
This is what ifconfig looks like after all (after setting eth0 back to its normal IP):
- Code: Select all
kiste jan # ifconfig -a
br0 Link encap:Ethernet HWaddr 00:0F:B5:42:E3:44
inet addr:192.168.11.45 Bcast:192.168.11.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3219 errors:0 dropped:0 overruns:0 frame:0
TX packets:2103 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2426282 (2.3 Mb) TX bytes:406412 (396.8 Kb)
eth0 Link encap:Ethernet HWaddr 00:0F:B5:42:E3:44
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:4988 errors:0 dropped:0 overruns:0 frame:0
TX packets:3282 errors:1 dropped:0 overruns:1 carrier:1
collisions:0 txqueuelen:1000
RX bytes:4707929 (4.4 Mb) TX bytes:492456 (480.9 Kb)
Interrupt:23 Base address:0x6000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:23 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1952 (1.9 Kb) TX bytes:1952 (1.9 Kb)
tap0 Link encap:Ethernet HWaddr 00:FF:46:F3:1C:AA
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
tunl0 Link encap:IPIP Tunnel HWaddr
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
I think this is all the important stuff, hope someone can help me bringing internet to work simultaneously on both the guest and host system.
[edit]: Seems like the internet-connection on the host system breaks in the same moment qemu is started and tap0 was created.
And I forgot qemu-ifup, which looks like this:
- Code: Select all
#!/bin/sh
ifconfig $1 0.0.0.0 promisc up
brctl addif br0 $1
