How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU

Page 1 of 2 12 LastLast

  1. Posts : 7
    Windows 10
       #1

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU


    Hi all,

    I have KVM installed on a Linux host and already created a folder, namely KVM_Share, on /Home, of the host for files sharing. Files sharing between Linux guests and Linux host works without problem.

    Please advise how to share files between Windows 10 guest and Linux host to a folder created on Windows 10.

    I have tried "ext2 Volume Manager" (Win App) but I can't make it to work for files sharing. However I made "ext2 Volume Manager" to work, sharing files on Windows drive with other Linux drives in the same PC.

    Please help. Thanks in advance.

    Regards
      My Computer


  2. Posts : 11,247
    Windows / Linux : Arch Linux
       #2

    sat2022 said:
    Hi all,

    I have KVM installed on a Linux host and already created a folder, namely KVM_Share, on /Home, of the host for files sharing. Files sharing between Linux guests and Linux host works without problem.

    Please advise how to share files between Windows 10 guest and Linux host to a folder created on Windows 10.

    I have tried "ext2 Volume Manager" (Win App) but I can't make it to work for files sharing. However I made "ext2 Volume Manager" to work, sharing files on Windows drive with other Linux drives in the same PC.

    Please help. Thanks in advance.

    Regards
    Hi there

    @sat2022

    First on SAMBA in the Linux systems set the netbios name to computer and ensure the work group is the same name as the Windows machines.

    Depending on the Linux distros you might need to set "Min protocol = NT1" in the [globals] section of SAMBA and enable SMB1 on Windows

    On the Linux boxes you need to allow access to the shared file -- either add permissions for users -- or if it's just you simply type sudo chown -R <userid> <file name or device name>.

    You don't have to use samba - but whether you do or not install openssh server (or whatever its called) and ensure the SSH daemon is running -- might be called sshd -- depends on your Linux distro(s). Using SAMBA though then gives no problems for Windows to read and write Linux formatted drives / folders. You need the SSH daemon for any sort of sensible file sharing and transfers.

    A useful GUI tool for file transfer is filezilla-client --- install on both the windows and Linux machines -- it's free and excellent -- beats File explorer any day of the week for this stuff.

    Filezilla : (note I'm using Icelandic language on Windows - filezilla will install in your default language -- probably English so no prob there !!!).

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-skjamynd-2022-01-22-115124.png

    another idea is to create some "blk device" mount points e.g /mnt/DV0, /mnt/DV1 etc and then allow access by users or you if the only user. Then you can mount a device (with any file system) on it and have it shared -- sudo mount /dev/xxx -t auto -o rw /mnt/DV0 etc. If you also allocate these in SAMBA sharing section you can then stream data or whatever to remote devices including TV's phones etc.

    Ensure also in Windows network discovery is enabled.

    For the LINUX machines to read Windows files you need to ensure package ntfs-3g is installed.

    Here's a windows machine with access to Linux (machine Wulf)

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-skjamynd-2022-01-22-113410.png

    File system on Linux is XFS but with SAMBA Windows has no problems reading / writing to the shared drive (RAID 0 20 TB of data space).

    some entries from SAMBA (/etc/smb.conf)

    [global]
    min protocol = NT1
    # can set it to SMB2 if you want experimental SMB2 support.
    #
    workgroup = VIKINGURS <=== ensure workgroup name is common across your network
    netbios name = wulf <========= computer host name of linux server
    server string = Samba Server Version %v

    in the sharing section :


    [homes]
    comment = Home Directories
    browseable = yes
    writable = yes
    valid users = %S

    [printers]
    comment = All Printers
    path = /var/spool/samba
    browseable = no
    guest ok = no
    writable = no
    printable = yes

    [HDD0]
    comment HDD0
    path = /mnt/DV0
    guest ok = yes
    writeable = yes
    browseable = yes

    [HDD1]
    comment HDD1
    path = /mnt/DV1
    guest ok = yes
    writeable = yes
    browseable = yes

    [HDD2]
    comment HDD2
    path = /mnt/DV2
    guest ok = yes
    writeable = yes
    browseable = yes

    [HDD3]
    comment HDD3
    path = /mnt/DV3
    guest ok = yes
    writeable = yes
    browseable = yes

    [HDD4]
    comment HDD4
    path = /mnt/DV4
    guest ok = yes
    writeable = yes
    browseable = yes

    on Windows or example as you saw on the screenshot above the shared drive is HDD2 which is [HDD2] in the shared folders.
    (You might want to add some extra security but I'm using a HOME LAN where this stuff is only shared internally so not bothered).

    BTW this also works on W11 -- running on the insider preview version of W11. Same considerations as per W10.

    Finally you will probably need to set up some bridging rather than NAT so you can access the machine on the network

    1) create an Isolated network on the Host say in /tmp/isolated.xml (XML file) -- give it a fixed IP address e.g as shown.

    <network>
    <name>isolated</name>
    <ip address="192.168.254.1" netmask="255.255.255.0"> ===== Your VM will use this addr 192.168.254.1 for accessing the Host
    <dhcp>
    <range start="192.168.254.2" end="192.168.254.254"/>
    </dhcp>
    </ip>
    </network>

    2) define it via virsh net-define
    root@hestur hrafn]# virsh net-define /tmp/isolated.xml you should see response : Network isolated defined from /tmp/isolated.xml


    3)auto start it and also start it (virsh-net start)
    [root@hestur hrafn]# virsh net-autostart isolated response from console should be : Network isolated marked as autostarted

    4) in the Virtual Machines configuration :
    a) Ist Nic define as Host device <nic interface e'g ethx or empxx or whatever>:macvtap source mode bridge

    b) add in the VM a second NIC defined as Virtual network <name --in my case isolated> device model virtio

    5) start guest

    6) Host will be accessible always as 192.168.254.1

    Works fine for Windows VM's on Arch and Fedora. Should also work if the real NIC is a wifi card too. Should also work on any other Linux distro that supports KVM/QEMU Virtual Machines e.g OPENSUSE / LINUX MINT / UBUNTU/DEBIAN.

    The XML generated file will look something like this for NIC 2 --depending on your hardware --this is generated automatically if everything is setup correctly.

    <interface type="network">
    <mac address="52:54:00:b0:3c:94"/>
    <source network="isolated" portid="4afe495d-53a4-49fa-84e1-85d5c658bf78" bridge="virbr0"/>
    <target dev="vnet0"/>
    <model type="virtio"/>
    <alias name="net0"/>
    <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </interface>

    If you've done it correctly you should see as the output on the host of ifconfig (or equivalent command) the network virbr1 at the bottom of the screenshot with IP address 192.168.254.1 which is what the Windows VM will use to access the Host. (Note the VM can access other machines on Lan / Internet in the normal way - this is only for the VM to get HOST access).


    Cheers
    jimbo
    Last edited by jimbo45; 22 Jan 2022 at 07:06. Reason: Added info for KVM HOST GUEST access
      My Computer


  3. Posts : 7
    Windows 10
    Thread Starter
       #3

    jimbo45 said:
    Hi there

    @sat2022

    First on SAMBA in the Linux systems set the netbios name to computer and ensure the work group is the same name as the Windows machines.

    Depending on the Linux distros you might need to set "Min protocol = NT1" in the [globals] section of SAMBA and enable SMB1 on Windows

    On the Linux boxes you need to allow access to the shared file -- either add permissions for users -- or if it's just you simply type sudo chown -R <userid> <file name or device name>.

    You don't have to use samba - but whether you do or not install openssh server (or whatever its called) and ensure the SSH daemon is running -- might be called sshd -- depends on your Linux distro(s). Using SAMBA though then gives no problems for Windows to read and write Linux formatted drives / folders. You need the SSH daemon for any sort of sensible file sharing and transfers.

    A useful GUI tool for file transfer is filezilla-client --- install on both the windows and Linux machines -- it's free and excellent -- beats File explorer any day of the week for this stuff.

    Filezilla : (note I'm using Icelandic language on Windows - filezilla will install in your default language -- probably English so no prob there !!!).

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-skjamynd-2022-01-22-115124.png

    - snip -

    Cheers
    jimbo
    Hi jimbo,

    Lot of thanks for your detailed advice and your time spent to assist me.

    I'll try Filezilla later if my current attempt failed. I have run Filezilla before.

    I'm now trying ;
    Sharing a folder a windows guest under virt-manager
    Sharing a folder a windows guest under virt-manager – Guy Rutenberg

    but unable to install all "spice-webdavd-x64-2..." applications, both 64/32bit versions on Windows 10 guest.
    The applications are download on;
    Index of /download/windows/spice-webdavd

    I already turn off the firewall of Windows 10 guest. Any advice. Thanks

    Regards
      My Computer


  4. Posts : 11,247
    Windows / Linux : Arch Linux
       #4

    @sat2022

    Did you try on your Linux Host in order for Windows Guest and Linux HOST communication when using KVM/QEMU do the following :

    1) create an Isolated network on the Host say in /tmp/isolated.xml (XML file) -- give it a fixed IP address e.g as shown.

    <network>
    <name>isolated</name>
    <ip address="192.168.254.1" netmask="255.255.255.0"> ===== Your VM will use this addr 192.168.254.1 for accessing the Host
    <dhcp>
    <range start="192.168.254.2" end="192.168.254.254"/>
    </dhcp>
    </ip>
    </network>

    2) define it via virsh net-define
    root@hestur hrafn]# virsh net-define /tmp/isolated.xml

    you should see response : Network isolated defined from /tmp/isolated.xml


    3)auto start it and also start it (virsh-net start)
    [root@hestur hrafn]# virsh net-autostart isolated response from console should be : Network isolated marked as autostarted



    4) in the Virtual Machines configuration :
    a) Ist Nic define as Host device <nic interface e'g ethx or empxx or whatever>:macvtap source mode bridge

    b) add in the VM a second NIC defined as Virtual network <name --in my case isolated> device model virtio

    5) start guest

    6) Host will be accessible always as 192.168.254.1

    Works fine for Windows VM's on Arch and Fedora. Should also work if the real NIC is a wifi card too. Should also work on any other Linux distro that supports KVM/QEMU Virtual Machines e.g OPENSUSE / LINUX MINT / UBUNTU/DEBIAN.

    The XML generated file will look something like this for NIC 2 --depending on your hardware --this is generated automatically if everything is setup correctly.

    <interface type="network">
    <mac address="52:54:00:b0:3c:94"/>
    <source network="isolated" portid="4afe495d-53a4-49fa-84e1-85d5c658bf78" bridge="virbr0"/>
    <target dev="vnet0"/>
    <model type="virtio"/>
    <alias name="net0"/>
    <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </interface>

    If you've done it correctly you should see as the output on the host of ifconfig or ip -c a (or equivalent command) the network virbr1 at the bottom of the screenshot with IP address 192.168.254.1 which is what the Windows VM will use to access the Host. (Note the VM can access other machines on Lan / Internet in the normal way - this is only for the VM to get HOST access).

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_20220123_102035.png

    On Linux BTW if you have a GUI / desktop manager e.g KDE/GNOME/MINT etc then install virt-manager as it makes configuring the VM's a doddle.

    One problem with KVM/QEMU VM's is that using WIFI to share between guest and Host (although the Guest can use Wifi for accessing Internet but not the host) is still "hit and miss" depending on your Wifi adapter.

    You are better to use a wired connection - or even a USB->LAN connection. You can then route that connection into a cheap switch which can be plugged in to a wireless extender if you don't have easy access to run LAN cables to a router.

    To mega increase the performance of the Windows Guest install the virtio drivers on the Windows guest -- download the ISO from the fedora site or git hub , attach to guest and install. The disks should also be formatted as raw rather than the default as well.

    WindowsGuestDrivers/Download Drivers - KVM

    easier : virtio-win-pkg-scripts/README.md at master . virtio-win/virtio-win-pkg-scripts . GitHub

    These act as per vmware-tools in vmware or guest-additions in VBOX. Improves Video, has faster network and enables windows to use virtio for disks etc.

    Cheers
    jimbo
    Last edited by jimbo45; 23 Jan 2022 at 05:23. Reason: Added screenshot of virtual network
      My Computer


  5. Posts : 7
    Windows 10
    Thread Starter
       #5

    jimbo45 said:
    @sat2022

    Did you try on your Linux Host in order for Windows Guest and Linux HOST communication when using KVM/QEMU do the following :

    1) create an Isolated network on the Host say in /tmp/isolated.xml (XML file) -- give it a fixed IP address e.g as shown.

    <network>
    <name>isolated</name>
    <ip address="192.168.254.1" netmask="255.255.255.0"> ===== Your VM will use this addr 192.168.254.1 for accessing the Host
    <dhcp>
    <range start="192.168.254.2" end="192.168.254.254"/>
    </dhcp>
    </ip>
    </network>

    2) define it via virsh net-define
    root@hestur hrafn]# virsh net-define /tmp/isolated.xml

    you should see response : Network isolated defined from /tmp/isolated.xml


    3)auto start it and also start it (virsh-net start)
    [root@hestur hrafn]# virsh net-autostart isolated response from console should be : Network isolated marked as autostarted



    4) in the Virtual Machines configuration :
    a) Ist Nic define as Host device <nic interface e'g ethx or empxx or whatever>:macvtap source mode bridge

    b) add in the VM a second NIC defined as Virtual network <name --in my case isolated> device model virtio

    - snip -
    Perfored the steps as root

    $ su -
    Password:

    # nano /tmp/isolated.xml
    copy following content on it
    Code:
    <network>
    <name>isolated</name>
    <ip address="192.168.254.1" netmask="255.255.255.0"> ===== Your VM will use this addr 192.168.254.1 for accessing the Host
    <dhcp>
    <range start="192.168.254.2" end="192.168.254.254"/>
    </dhcp>
    </ip>
    </network>
    # virsh net-define /tmp/isolated.xml
    Code:
    Network isolated defined from /tmp/isolated.xml
    # virsh net-autostart isolated
    Code:
    Network isolated marked as autostarted
    On Virt-Manager
    (Windows 10 guest)
    There is only one NIC (NIC:6a:d1:30)
    (pls refer to screenshot)

    Please advise how to add 2nd NIC

    I have tried -> Add Hardware
    but can't find a solution.

    Thanks

    Regards
    Attached Thumbnails Attached Thumbnails How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_nic.png  
      My Computer


  6. Posts : 11,247
    Windows / Linux : Arch Linux
       #6

    sat2022 said:
    Perfored the steps as root

    $ su -
    Password:

    # nano /tmp/isolated.xml
    copy following content on it
    Code:
    <network>
    <name>isolated</name>
    <ip address="192.168.254.1" netmask="255.255.255.0"> ===== Your VM will use this addr 192.168.254.1 for accessing the Host
    <dhcp>
    <range start="192.168.254.2" end="192.168.254.254"/>
    </dhcp>
    </ip>
    </network>
    # virsh net-define /tmp/isolated.xml
    Code:
    Network isolated defined from /tmp/isolated.xml
    # virsh net-autostart isolated
    Code:
    Network isolated marked as autostarted
    On Virt-Manager
    (Windows 10 guest)
    There is only one NIC (NIC:6a:d1:30)
    (pls refer to screenshot)

    Please advise how to add 2nd NIC

    I have tried -> Add Hardware
    but can't find a solution.

    Thanks

    Regards

    Hi there

    @sat2022

    Delete the NAT NIC, add the ISOLATED and MACVTAP NIC's.

    Add your "Isolated" Network


    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_20220124_083048.png

    Add the 2nd NIC from the dropdown as a Macvtap device with the name of the REAL interface which you find from using command ip -c a

    In my case it's interface nr 3 (I also have wifi Nic on this machine but for this purpose I don't use it)

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_20220124_081040.png

    In the config (via the virtual machine manager) add this as a MACVTAP device via the dropdown using the interface (real) on your HOST -- nr 3 on mine from the console image above

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_20220124_080643.png

    depending on your Linux distro it might also ask for MODE -- in which case use BRIDGED. On Arch Linux which is what I'm using as HOST it's not required.

    Note this NiC is required for the VM to have Internet and rest of your network / LAN access but doesn't have HOST communication --that's the point of the other NIC (Virtual) so that there's now complete communication on the network.

    Host access from the Windows GUEST will be via 192.168.254.1 in this case if you are using my example. You can make it any accessible "Subnet".

    So on Windows you can share with the HOST via address 192.168.254.1 (You will need to use this address as NETBIOS won't be available for resolve by name unless you do a lot of fiddling around -- not worth it on a HOME LAN).

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_20220124_090832.png

    If you downloaded the Windows VIRTIO ISO you can also use virtio for the NIC I/O. Using the Virtual INTEL NIC e1000e is good enough though. You'll also get better video if you install the qxl driver on the Guest for the display adapter and set the video driver to qxl in the VM config. The latest ISO has both W10 and W11 Windows drivers.

    Cheers
    jimbo
    Last edited by jimbo45; 24 Jan 2022 at 04:12. Reason: Added screenshot of share with HOST
      My Computer


  7. Posts : 7
    Windows 10
    Thread Starter
       #7

    jimbo45 said:
    Hi there

    @sat2022

    Delete the NAT NIC, add the ISOLATED and MACVTAP NIC's.

    Add your "Isolated" Network


    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_20220124_083048.png

    Add the 2nd NIC from the dropdown as a Macvtap device with the name of the REAL interface which you find from using command ip -c a

    In my case it's interface nr 3 (I also have wifi Nic on this machine but for this purpose I don't use it)

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_20220124_081040.png

    In the config (via the virtual machine manager) add this as a MACVTAP device via the dropdown using the interface (real) on your HOST -- nr 3 on mine from the console image above

    How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot_20220124_080643.png

    depending on your Linux distro it might also ask for MODE -- in which case use BRIDGED. On Arch Linux which is what I'm using as HOST it's not required.

    Note this NiC is required for the VM to have Internet and rest of your network / LAN access but doesn't have HOST communication --that's the point of the other NIC (Virtual) so that there's now complete communication on the network.

    Host access from the Windows GUEST will be via 192.168.254.1 in this case if you are using my example. You can make it any accessible "Subnet".

    So on Windows you can share with the HOST via address 192.168.254.1 (You will need to use this address as NETBIOS won't be available for resolve by name unless you do a lot of fiddling around -- not worth it on a HOME LAN).
    .....
    ......
    jimbo
    Hi jimbo,

    Performed following steps:-
    Click -> NIC :3f:6c:13 (remark : I run another Windows 10 guest)

    Details
    -> Network source
    select -> [Virtual network 'isolated' : Isolated network (Inactive)] (from the drop-list)
    IP address: Unknown
    (pls refers to screenshot-1)
    -> Apply

    Again on the same screen
    select -> Host device enp3sO: macvtap
    Source mode: [Bridge]
    Warning: In most configruations, macvtap does not work for host to guest network commounication
    other items not filling in
    (pls refers to screenshot-2)
    -> Apply


    Start Windows 10 guest
    (pls refers to screenshot-3)

    192.168.254.1 is not the HOST's real IP address, accessible as normal on LAN.

    Please advise how to browse this 2nd NIC ip address on browser, such as Firefox/Chrome, of Windows 10 guest ?

    Thanks

    Regards
    Attached Thumbnails Attached Thumbnails How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot-1.png   How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot-2.png   How to setup files sharing btw Win10 guest and Linux host - KVM/QEMU-screenshot-3.png  
      My Computer


  8. Posts : 11,247
    Windows / Linux : Arch Linux
       #8

    sat2022 said:
    Hi jimbo,

    Performed following steps:-
    Click -> NIC :3f:6c:13 (remark : I run another Windows 10 guest)

    Details
    -> Network source
    select -> [Virtual network 'isolated' : Isolated network (Inactive)] (from the drop-list)
    IP address: Unknown
    (pls refers to screenshot-1)
    -> Apply

    Again on the same screen
    select -> Host device enp3sO: macvtap
    Source mode: [Bridge]
    Warning: In most configruations, macvtap does not work for host to guest network commounication
    other items not filling in
    (pls refers to screenshot-2)
    -> Apply


    Start Windows 10 guest
    (pls refers to screenshot-3)

    192.168.254.1 is not the HOST's real IP address, accessible as normal on LAN.

    Please advise how to browse this 2nd NIC ip address on browser, such as Firefox/Chrome, of Windows 10 guest ?



    Thanks

    Regards
    Hi there
    The 192.168.254.1 address is ONLY used for Windows->HOST communication.
    Use that to browse HOST from Windows Guest. Not sure what the problem is.
    Cheers
    jimbo
      My Computer


  9. Posts : 7
    Windows 10
    Thread Starter
       #9

    Hi jimbo,

    Is there any way to check the browse connecting NIC 2 not NIC 1 ?

    Thanks

    Regards
      My Computer


  10. Posts : 11,247
    Windows / Linux : Arch Linux
       #10

    sat2022 said:
    Hi jimbo,

    Is there any way to check the browse connecting NIC 2 not NIC 1 ?

    Thanks

    Regards
    Works for me

    Guest can can reach guest at 192.168.254.1 and Host can reach Guest at the relevant IP address got via DHCP from your network.

    If you've still got problems :

    Check Firewalls, SMB1, Virus protection software (if using) whether you allow Windows remote access to the machine etc. All I know works for me without issue.

    Here's the official documentation from Red Hat (now part of IBM)

    B.9. Guest Can Reach Outside Network, but Cannot Reach Host when Using macvtap Interface Red Hat Enterprise Linux 6 | Red Hat Customer Portal

    Cheers
    jimbo
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:40.
Find Us




Windows 10 Forums