]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Updates net_opts
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Dec 2017 21:09:08 +0000 (19:09 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Dec 2017 21:09:08 +0000 (19:09 -0200)
kvmx

diff --git a/kvmx b/kvmx
index cb0e31b9f98e119bb1e75be14d5cc64321de4b26..242a3ff5694decff6f41d77e05f4721b49c102b7 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -373,14 +373,14 @@ function kvmx_up {
   fi
 
   if [ -z "$net" ] || [ "$net" == "user" ]; then
-    net_opts="user,hostfwd=tcp:127.0.0.1:$SSH-:22,hostfwd=udp:127.0.0.1:$XDMCP_PORT-:177$hostfwd"
+    net_opts="user,hostfwd=tcp:127.0.0.1:$SSH-:22,hostfwd=udp:127.0.0.1:$XDMCP_PORT-:177$hostfwd -net nic,model=$nic_model"
   elif [ "$net" == "tap" ]; then
     # Thanks kvm-manager
     tap="${VM}0"
     # MAC address is derived from a hash of the host's name and the guest's name:
     mac_address="$(printf "02:%s" "$(printf "%s\0%s" "$(hostname)" "${VM}" | sha256sum | sed 's/\(..\)/\1:/g' | cut -f1-5 -d:)")"
     bridge="br0"
-    net_opts="tap,ifname=$tap,script=no,downscript=no,vlan=0,name=hostnet0"
+    net_opts="tap,ifname=$tap,script=no,downscript=no,vlan=0,name=hostnet0 -device virtio-net-pci,vlan=0,id=net0,mac=$mac_address,bus=pci.0"
   fi
 
   # Run virtual machine
@@ -394,7 +394,6 @@ function kvmx_up {
       -chardev "socket,id=monitor,path=$MONITORFILE,server,nowait" -mon chardev=monitor,mode=readline \
       -chardev "socket,id=serial0,path=$CONSOLEFILE,server" -device isa-serial,chardev=serial0 \
       -smp $smp -soundhw ac97 -cpu host -balloon virtio \
-      -net nic,model=$nic_model \
       -net $net_opts \
       $qemu_opts &> $LOGFILE < /dev/null &