💾 Archived View for yasendfile.org › TipTricks › qemu.gmi captured on 2024-05-26 at 14:34:38. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-12-28)
-=-=-=-=-=-=-
Written by Wim Stockman - on 10 December 2023
So you are able to talk from Host to Guest and vice versa.
between linux and Windows7
- We need to install the packages:
pacman -S \ qemu-full \ libvirt-runit \ libvirt \ virt-manager \ virt-viewer \ samba \ samba-runit \ nfs-utils \ nfs-utils-runit
wsdd2 -> this is an aur package I use yay to install it
add your user to the libvirt group
sudo usermod -aG libvirt
enable the services
ln -s /etc/runit/sv/libvirtd /run/runit/service
ln -s /etc/runit/sv/libvirtlogd /run/runit/service
ln -s /etc/runit/sv/smbd /run/runit/service
edit the file: /etc/samba/smb.conf
this is the minimum that should be in your smb.conf:
[global] netbios name = $YOUR_PC_NAME workgroup = WORKGROUP [qemu-shared] path = /home/$USERNAME/qemu-shared browsable = yes read only = no
this will create a shared writable folder for user with credentials
So we need to make a credentials.
smbpasswd
Create a password for your user.
So know you can login from windows with your username and the just set password.
Don't forget to reload your samba service
sv restart smbd
I want go into detail but this is what commands you need for it:
modprobe tun tap && \ ip link add br0 type bridge && \ ip tuntap add dev tap0 mode tap && \ ip link set dev eth0 master br0 && \ ip link set dev tap0 master br0 && \ ip link set dev br0 up && \ ip link set dev eth0 master br0 && \ ip address delete 10.0.0.31/24 dev eth0 && \ ip address add 10.0.0.100/24 dev br0 && \ ip route add default via 10.0.0.1 dev br0
Here we created a bridge connector br0
were tap0 is connected to the bridge and the bridge is connected to our physical network eth0
a good video about it you can find on youtube
https://www.youtube.com/watch?v=VCAqkyVd7dM&t=852s
or download from here:
https://yasendfile.org/geminibin/Qemu-Bridged_Networking.mp4
Create a new VM add what you want but:
There is one thing special.
in the NIC section choose
br0 as bridge adapter and your good to go.
virsh -c qemu:///system start win7
virt-viewer --connect qemu:///system win7
#!/bin/bash sudo ./qemu-bridge-script.sh sudo sv start smbd && \ sudo sv start virtlogd && \ sudo sv start libvirtd && \ virsh -c qemu:///system start win7 virt-viewer --connect qemu:///system win7 && \ sudo sv stop smbd sudo sv stop virtlogd sudo sv stop libvirtd
#!/bin/bash modprobe tun tap && \ ip link add br0 type bridge && \ ip tuntap add dev tap0 mode tap && \ ip link set dev eth0 master br0 && \ ip link set dev tap0 master br0 && \ ip link set dev br0 up && \ ip link set dev eth0 master br0 && \ ip address delete 10.0.0.31/24 dev eth0 && \ ip address add 10.0.0.100/24 dev br0 && \ ip route add default via 10.0.0.1 dev br0
I like to keep all the services just started when I need them.
That's why I stop them on exit of my Virt-Viewer.
In runit if you don't want to start some services on startup
you need to create a file down.
touch /run/runit/service/$yourservice/down
So we do this for Samba,virtlogd and libvirt
touch /run/runit/service/smbd/down
touch /run/runit/service/virtlogd/down
touch /run/runit/service/libvirtd/down
if you want to be able to discover your host computer on the windows machine you also need to enabel wsdd2
Since this is an AURpackage we need to make our own runit file.
Create a directory wsdd2 in the folder:
sudo mkdir /etc/runit/sv/wsdd2
#!/bin/sh [ ! -d /run/wsdd2 ] && mkdir -p /run/wsdd2 exec wsdd2
mkdir log
mkdir supervise
ln -s /etc/runit/sv/wsdd2 /run/runit/service
touch /run/runit/service/wsdd2/down
sv start wsdd2