Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2020-10-04 22:34:54 +02:00
commit aed13a4f20
Signed by: y0rune
GPG Key ID: F204C385F57EB348
2 changed files with 84 additions and 0 deletions

37
start-gentoo.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
function start(){
exec qemu-system-x86_64 -enable-kvm \
-cpu host \
-drive file=Gentoo-VM.img,if=virtio \
-netdev user,id=vmnic,hostname=Gentoo-VM \
-device virtio-rng-pci \
-m 512M \
-smp 2 \
-monitor stdio \
-name "Gentoo VM" \
-boot d \
-device e1000,netdev=network0,mac=52:55:00:d1:55:01 \
-netdev tap,id=network0,ifname=tap0,script=no,downscript=no \
-cdrom install-amd64-minimal-20201001T120249Z.iso
}
sudo ip link add br0 type bridge
#sudo ip addr flush dev eth0
sudo ip tuntap add dev tap0 mode tap user $(whoami)
sudo ip link set tap0 master br0
sudo ip link set dev br0 up
sudo ip link set dev tap0 up
sudo ip link set eth0 master br0
start &
sleep 2
vncviewer 127.0.0.1:5900 &
for j in $(jobs -p)
do
echo $j
wait "$j"
done
pkill -9 qemu

47
start-win.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
function start(){
exec qemu-system-x86_64 -enable-kvm \
-name "Windows" \
-cpu host \
-m 4G \
-smp 4,threads=4 \
-vga qxl \
-usb \
-usb -device usb-tablet \
-device e1000,netdev=network0,mac=52:55:00:d1:55:01 \
-netdev tap,id=network0,ifname=tap0,script=no,downscript=no \
-spice port=5900,addr=127.0.0.1,disable-ticketing \
-chardev spicevmc,id=spicechannel0,name=vdagent \
-device usb-tablet \
-rtc base=localtime,clock=host \
-drive driver=raw,file=win10.img,if=virtio \
-cdrom virtio-win-0.1.189.iso
# -drive file=Win10_2004_English_x64.iso,index=3,media=cdrom
}
tunctl -u yorune -t tap0
ifconfig tap0 192.168.100.1 up
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -I FORWARD 1 -i tap0 -j ACCEPT
iptables -I FORWARD 1 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT
#sudo ip link add br0 type bridge
##sudo ip addr flush dev eth0
#sudo ip tuntap add dev tap0 mode tap user $(whoami)
#sudo ip link set tap0 master br0
#sudo ip link set dev br0 up
#sudo ip link set dev tap0 up
#sudo ip link set eth0 master br0
start &
sleep 2
spicy -h 127.0.0.1 -p 5900 &
for j in $(jobs -p)
do
wait "$j"
done
pkill -9 qemu