qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] missing some fundamental concepts


From: Peter Maydell
Subject: Re: [Qemu-discuss] missing some fundamental concepts
Date: Mon, 16 Sep 2019 18:21:46 +0100

On Mon, 16 Sep 2019 at 17:33, F. Heitkamp <address@hidden> wrote:
> What I am trying to get working is to make the installation connect to
> my host network so I can mount an NFS share to it.
> My other boxes, on my network, are able to run the image, mount the NFS
> when running in VMWARE and Virtualbox.
>
> I tried configuring the qemu command line with option:
>    -netdev user,id=mynet0,net=192.168.0.0/16 -device e1000,netdev=mynet0
>
> When the machine boots it gets an address 192.168.2.x hence is not on
> the  same subnet on my host. If I change the address and routing  to be
> on the same subnet it  still does not see my host network.

This is how 'user' mode networking works.
There's a diagram at:
https://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29
QEMU creates an emulated internal 'network' which the guest VM
sits on, as do some faked up DNS/DHCP/etc servers and a 'gateway'
that can forward packets to the host network. So the guest can
"see out", but the rest of the world can't "see in". (The only
exception here is that if you use the 'hostfwd' option you can
forward a specific port on the host so that connecting to that port
on your host machine ends up going through to a particular port on the
guest VM.

If you try to tell the user networking to use the same IP address
range for its emulated internal network that you're using on
the real network your host is on, then the guest VM is going to
get very confused. So don't do that.

> I tried using iproute2 utils to create a bridge and a tun/tap  device
> bridged to enp9s0  on my host.  However two problems occur, one I lose
> connectivity to the outside world, two, the bridge I create is not
> detected by my virtual  machine when running in qemu. Most of the
> bridging examples also  assign a static IP to the bridge.

If you want the QEMU VM to be really connected to the host network
then you'll need to use tap networking, yes. Unfortunately
this is quite complicated to configure.

> Usually this means it is intuitively obvious or no one else wants  to do
> this.

I think most people who do TAP networking with QEMU use a
'management layer' program, like libvirt's virt-manager,
to set up the VM and the network. This will take care of all
these details for you. If you want to run QEMU by hand yourself
you have to get all the complicated command line options,
helper scripts, bridging config, etc right yourself. Unless
you have a strong reason to want to work out how to do this
by hand I would suggest using virt-manager instead.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]