- creare una nuova macchina virtuale e impostare il chipset Q35 (forse non è necessario)
- è necessario un BIOS di tipo UEFI: per la compatibilità con VGA passthrough, scaricare OVMF da https://github.com/tianocore/tianocore.github.io/wiki/OVMF e impostarlo per la VM
esempio:<loader readonly='yes' type='pflash'>/raid/GESTIONE/ovmf-x64/OVMF-pure-efi.fd</loader> <nvram>/raid/GESTIONE/ovmf-x64/OVMF_VARS-pure-efi.fd</nvram>
- CPU: scrivere ‘host-passthrough’ in virtmanager
- cambiare BUS disco1 in VirtIO
- scheda rete: ‘dispositivo host’ selezionare la macvlan creata (vedere in seguito), modello virtio
- aggiungere i dispositivi pass-through PCI (NVIDIA) e USB (mouse e tastiera)
- da shell, editare l’ XML della VM e aggiungere a <features>:
<features> <hyperv> ... <vendor_id state='on' value='123456789abc'/> ... </hyperv> ... <kvm> <hidden state='on'/> </kvm> </features>
- in alternativa (ma è preferibile il precedente punto):
<!-- modificare il namespace--> <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> <!-- aggiungere i seguenti parametri --> <qemu:commandline> <qemu:arg value='-cpu'/> <qemu:arg value='host,hv_time,kvm=off,hv_vendor_id=null'/> </qemu:commandline>
Per impostare una interfaccia di rete virtuale che consenta la comunicazione tra il guest e l’ esterno (compreso il traffico verso l’ host), è necessario creare una interfaccia MAC-VLAN: questa interfaccia virtuale assume un proprio indirizzo MAC e IP, e le si assegna una route e il gateway
#!/bin/bash # let host and guests talk to each other over macvlan # configures a macvlan interface on the hypervisor # run this on the hypervisor (e.g. in /etc/rc.local) # made for IPv4; need modification for IPv6 # meant for a simple network setup with only eth0, # and a static (manual) ip config # Evert Mouw, 2013 HWLINK=enp0s31f6 MACVLN=macvlan0 TESTHOST=www.google.com # ------------ # wait for network availability # ------------ while ! ping -q -c 1 $TESTHOST > /dev/null do echo "$0: Cannot ping $TESTHOST, waiting another 5 secs..." sleep 5 done # ------------ # get network config # ------------ IP=$(ip address show dev $HWLINK | grep "inet " | awk '{print $2}') NETWORK=$(ip -o route | grep $HWLINK | grep -v default | awk '{print $1}') GATEWAY=$(ip -o route | grep default | awk '{print $3}') # ------------ # setting up $MACVLN interface # ------------ ip link add link $HWLINK $MACVLN type macvlan mode bridge ip address add $IP dev $MACVLN ip link set dev $MACVLN up # ------------ # routing table # ------------ # empty routes ip route flush dev $HWLINK ip route flush dev $MACVLN # add routes ip route add $NETWORK dev $MACVLN metric 0 # add the default gateway ip route add default via $GATEWAY
vedere anche http://hicu.be/bridge-vs-macvlan
Annunci