Added
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
parent
aed13a4f20
commit
53abadcd8a
@ -5,33 +5,35 @@ exec qemu-system-x86_64 -enable-kvm \
|
|||||||
-drive file=Gentoo-VM.img,if=virtio \
|
-drive file=Gentoo-VM.img,if=virtio \
|
||||||
-netdev user,id=vmnic,hostname=Gentoo-VM \
|
-netdev user,id=vmnic,hostname=Gentoo-VM \
|
||||||
-device virtio-rng-pci \
|
-device virtio-rng-pci \
|
||||||
-m 512M \
|
-m 10240M \
|
||||||
-smp 2 \
|
-smp 8 \
|
||||||
-monitor stdio \
|
-monitor stdio \
|
||||||
-name "Gentoo VM" \
|
-name "Gentoo VM" \
|
||||||
-boot d \
|
-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 \
|
-netdev tap,id=network0,ifname=tap0,script=no,downscript=no \
|
||||||
-cdrom install-amd64-minimal-20201001T120249Z.iso
|
-cdrom install-amd64-minimal-20201001T120249Z.iso
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sudo ip link add br0 type bridge
|
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 tuntap add dev tap0 mode tap user $(whoami)
|
||||||
sudo ip link set tap0 master br0
|
sudo ip link set tap0 master br0
|
||||||
sudo ip link set dev br0 up
|
sudo ip link set dev br0 up
|
||||||
sudo ip link set dev tap0 up
|
sudo ip link set dev tap0 up
|
||||||
sudo ip link set eth0 master br0
|
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 5
|
||||||
sleep 2
|
|
||||||
vncviewer 127.0.0.1:5900 &
|
|
||||||
|
|
||||||
for j in $(jobs -p)
|
start
|
||||||
do
|
|
||||||
echo $j
|
|
||||||
wait "$j"
|
|
||||||
done
|
|
||||||
|
|
||||||
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
28
start-t2sde
Executable 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
|
35
start-win.sh
35
start-win.sh
@ -1,11 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function start(){
|
function start(){
|
||||||
exec qemu-system-x86_64 -enable-kvm \
|
exec qemu-system-x86_64 -enable-kvm \
|
||||||
-name "Windows" \
|
-name "Windows" \
|
||||||
-cpu host \
|
-cpu host \
|
||||||
-m 4G \
|
-m 10G \
|
||||||
-smp 4,threads=4 \
|
-smp 8,threads=8 \
|
||||||
-vga qxl \
|
-vga qxl \
|
||||||
-usb \
|
-usb \
|
||||||
-usb -device usb-tablet \
|
-usb -device usb-tablet \
|
||||||
@ -16,24 +15,16 @@ exec qemu-system-x86_64 -enable-kvm \
|
|||||||
-device usb-tablet \
|
-device usb-tablet \
|
||||||
-rtc base=localtime,clock=host \
|
-rtc base=localtime,clock=host \
|
||||||
-drive driver=raw,file=win10.img,if=virtio \
|
-drive driver=raw,file=win10.img,if=virtio \
|
||||||
-cdrom virtio-win-0.1.189.iso
|
-cdrom virtio-win-0.1.189.iso \
|
||||||
# -drive file=Win10_2004_English_x64.iso,index=3,media=cdrom
|
-drive file=Win10_2004_English_x64.iso,index=3,media=cdrom
|
||||||
}
|
}
|
||||||
|
|
||||||
tunctl -u yorune -t tap0
|
sudo tunctl -u yorune -t tap0
|
||||||
ifconfig tap0 192.168.100.1 up
|
sudo ifconfig tap0 192.168.100.1 up
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
|
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
||||||
iptables -I FORWARD 1 -i tap0 -j ACCEPT
|
sudo iptables -I FORWARD 1 -i tap0 -j ACCEPT
|
||||||
iptables -I FORWARD 1 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT
|
sudo 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 &
|
start &
|
||||||
sleep 2
|
sleep 2
|
||||||
@ -45,3 +36,7 @@ for j in $(jobs -p)
|
|||||||
done
|
done
|
||||||
|
|
||||||
pkill -9 qemu
|
pkill -9 qemu
|
||||||
|
|
||||||
|
iptables-restart
|
||||||
|
sudo ip link set dev tap0 down
|
||||||
|
sudo ip link set dev br0 down
|
||||||
|
Loading…
Reference in New Issue
Block a user