Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2021-04-10 17:36:01 +02:00
parent aed13a4f20
commit 53abadcd8a
Signed by: y0rune
GPG Key ID: F204C385F57EB348
3 changed files with 59 additions and 34 deletions

View File

@ -5,33 +5,35 @@ exec qemu-system-x86_64 -enable-kvm \
-drive file=Gentoo-VM.img,if=virtio \
-netdev user,id=vmnic,hostname=Gentoo-VM \
-device virtio-rng-pci \
-m 512M \
-smp 2 \
-m 10240M \
-smp 8 \
-monitor stdio \
-name "Gentoo VM" \
-boot d \
-device e1000,netdev=network0,mac=52:55:00:d1:55:01 \
-device e1000-82545em,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
sudo sysctl -w net.ipv4.ip_forward=1
sudo ip route add 192.168.0.220 dev br0
start &
sleep 2
vncviewer 127.0.0.1:5900 &
sleep 5
for j in $(jobs -p)
do
echo $j
wait "$j"
done
start
pkill -9 qemu
sleep 5
sudo ip route del 192.168.0.220 dev br0
sudo sysctl -w net.ipv4.ip_forward=0
sudo ip link set eth0
sudo ip link set dev tap0 down
sudo ip link set dev br0 down
sudo ip link del tap0
sudo ip link del br0

28
start-t2sde Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# qemu-img create -f raw win10.img 100G
# qemu-img create -f qcow2 Gentoo-VM.img 100G
function start(){
exec qemu-system-x86_64 -enable-kvm \
-cpu host \
-drive file=T2SDE-VM.img,if=virtio \
-netdev user,id=vmnic,hostname=T2SDE-VM \
-device virtio-rng-pci \
-m 10240M \
-smp 8 \
-monitor stdio \
-name "T2SDE" \
-boot d \
-cdrom x86-64.iso \
-net nic \
-net tap,id=tap1
#-net tap,ifname=tap0,script=no,downscript=no \
#-device e1000,netdev=network0,mac=52:55:00:d1:55:01 \
#-netdev tap,id=network0,ifname=wlan0,script=no,downscript=no
#-net nic -net tap,ifname=kvmnat \
#-net nic,vlan=0,model=virtio,macaddr=00:16:35:AF:94:4B \
#-net tap,vlan=0,ifname=$tap,script=no,downscript=no \
}
start &
sleep 2

View File

@ -1,11 +1,10 @@
#!/bin/bash
function start(){
exec qemu-system-x86_64 -enable-kvm \
-name "Windows" \
-cpu host \
-m 4G \
-smp 4,threads=4 \
-m 10G \
-smp 8,threads=8 \
-vga qxl \
-usb \
-usb -device usb-tablet \
@ -16,24 +15,16 @@ exec qemu-system-x86_64 -enable-kvm \
-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
}
-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
sudo tunctl -u yorune -t tap0
sudo ifconfig tap0 192.168.100.1 up
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -I FORWARD 1 -i tap0 -j ACCEPT
sudo iptables -I FORWARD 1 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT
start &
sleep 2
@ -45,3 +36,7 @@ for j in $(jobs -p)
done
pkill -9 qemu
iptables-restart
sudo ip link set dev tap0 down
sudo ip link set dev br0 down