Network loss on host when running VMs that use tap devices on the same bridge as main physical interface
Hello there.
I'm trying to run a simple setup with qemu: run several qemu-kvm virtual machines that have a public (DHCP) IP. I.e., I'm not running any NAT in this network. I'm using Alpine Linux 3.19.1 My current setup is: I have a "bridge_ext" bridge that I connect my main interface (eth0). My /etc/network/interfaces file content is: Code:
auto lo Code:
# tunctl -t tap5 -u myself Code:
$ qemu-system-x86_64 -accel kvm -display vnc=:2 -hda vm.qcow2 -m 2g -netdev tap,ifname=tap5,id=n1,script=no,downscript=no -device e1000,netdev=n1,mac=DE:AD:BE:EF:00:02 Code:
# tunctl -d tap5 Is there something wrong with my setup? BTW, a very strange thing: even after the tap device (in this example, tap5) is removed from the bridge and deleted, if I create it again and attach it to the bridge, I lost control to the network again. But it doesn't happen if the created tap device was not used by qemu at all. So, right now I have six "unused" tap devices (tap0...tap5) that I cannot use even if I delete and create them again. Have you ever seen anything like this? Thank you very much. |
Yes, I had similar happen. How many ip4 addresses is your ISP giving you? Probably one. If you are letting your guest take it, your host is getting disconnected. Run a dhcpd server for the guests. Similar setup: https://www.linuxquestions.org/quest...8/#post6404001 The post mentions SIMH but I use Qemu with it just the same. You will have to do ip4 masquerading if you want the guest virtual machines to reach outside.
|
Hi! Thanks for the reply. It happens that I didn't realize that bridge MAC address was cloned from the last interface attached to the bridge. In my configuration, eth0 was the only interface attached to the bridge at the boot (with /etc/network/interfaces configuration). After acquiring an IP address with DHCP, I was manually creating and attaching another interface (a tap interface) to the bridge, which caused the bridge to change the MAC address, hence stopping network from working.
The solution I found was to create all tap devices I need at boot time and attaching them to the bridge before acquiring an IP from DHCP. So I now don't attach or remove no more interfaces from the bridge after it has a valid IP. |
All times are GMT -5. The time now is 04:55 AM. |