I'm going to run the following setup with qemu-system as hypervisor:
Hostsetup:
Hypervisor machine (Ubuntu 16.04) Second Machine
qemuVm--tap0--br123--eth0--|Hardware hub|--eth42--SecondPC
So this is a network containing a virtual machine hosted by qemu-system and is connected over a tap interface to a virtual bridge. The virtual bridge is createt by the host. The virtual bridge is NOT the default bridge of libvirt/virt-manager or other systems. The virtual bridge has a real eth0 network card. This network card is connected over wire with a real hub. Connected to the hub is an other Real pc. All clients use static IP-addresses. I would like to use all services like ICMP, UDP, TCP, FTP etc. between all connected machines
IP-list:
win7qemuVm: 10.0.0.10
br123: 10.0.0.100
(I do not want to use the default bridge from qemu)tap0: ?
Is it possible / necessary to assign an ip address?eth0: ?
necessary to assign an ip address?eth42 10.0.0.201
(interface of second pc)
I would like to work with -netdev
/ -device
not with old -net nic
.
Which command line parameters do I need for my win7qemuVm to connect it to the tap-device?
There are IP routes, ipforwarding and iptables. Do I need to change there default ubuntu settings to make such a network possible?
My host network is already configured like that:
iface tap11 inet manual
pre-up tunctl -t tap0
up ifconfig tap0 up
down ifconfig tap0 down
auto br123
iface br123 inet static
address 10.0.0.100
netmask 255.255.255.0
bridge_ports eth0
bridge_ports tap0
bridge_stp off
bridge_fd 0.0
pre-up ifdown eth0
pre-up ifdown tap0
pre-up ifup eth0
pre-up ifup tap0
post-down ifdown eth0
post-down ifdown tap0
The network manager is disabled.
Best Answer
The upper configuration is correct to solve the problem. The first success is, when your bride / tap etc remains UP. So this say's it is used, system is running. should look like this:
You can see the line, where master and state is mentioned, those ones are the important ones.
Next challenge is to find a network device, supporting this tap thing. I've used the
virtio network device
and downloaded thevirtio driver
for my XP. I haven't tested yet other OS and only some virtual network cards, so there might be the possibility other will work too. But important is, that not all virtual device drivers are working with tap-devices. SO for example, the network card in Windows might be up and running, but you can't get in and out any ping. If your firewall is down and everything else is configured correct, you might have added a adapter, where a tap-device is not supported.The network connection is a 1:1 pair, so you use two steps to do so. The host side configuration starts with
-netdev
, where you define a network adapter connected to the (here) host.tap0
is part of this. Important is to define theID
.This
ID
is used in the client side configuration where the interface for the guest is defined.-device
.virtio-net-pci
is the networkadapter used in this example.Source for Commands
Controlling State of bridge during or after machine has run
I've checked the setup with following adapters with winXP SP3, all working with tap-device:
Only for some you need to install an external driver.