#!/usr/local/bin/bash # Copyright (c) 2018-2022, diyIT.org # All rights reserved. # # BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License") # https://diyit.org/license/ # # # ./gns3.sh under tmux # disabled for now #exit # clean cached state bhyvectl --destroy --vm=gns3 while true do bhyve -c 4 -m 16G -A -H -P \ -s 0,hostbridge \ -s 3,ahci-cd \ -s 4,virtio-blk,/dev/zvol/ship/raw/gns3 \ -s 5,virtio-net,tap86,mac=00:0A:0B:0C:0D:86 \ -s 7,virtio-net,tap4886,mac=00:0A:0B:0C:8D:86 \ -s 8,virtio-net,tap1086,mac=00:0A:0B:0C:8D:86 \ -s 9,virtio-net,tap2086,mac=00:0A:0B:0C:9D:86 \ -s 29,fbuf,tcp=0.0.0.0:5986,w=1280,h=720 \ -s 30,xhci,tablet \ -s 31,lpc -l com1,/dev/nmdm86A \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ gns3 bhyve_exit=$? # bhyve returns the following status codes: # 0 - VM has been reset # 1 - VM has been powered off # 2 - VM has been halted # 3 - VM generated a triple fault # all other non-zero status codes are errors # if [ $bhyve_exit = 1 ] || [ $bhyve_exit = 2 ] then break fi echo `date` - restarting gns3 in 5 seconds - press ctrl-c to stop sleep 5 done exit $? #-s 3,ahci-cd,/mnt/linux/ubuntu-20.04.1-live-server-amd64.iso \ ##-s 6,virtio-blk,/dev/zvol/ship/raw/gns3_data \ # bhyvectl --get-all --vm=gns3 # cu -l /dev/nmdm86B # (This uses cu() so press ~+Ctrl-D to exit) #on base system: #zfs create -V 128G -o refreservation=none ship/raw/gns3 # Install VNC # curl -o turbovnc_2.2.5_amd64.deb https://sourceforge.net/projects/turbovnc/files/2.2.5/turbovnc_2.2.5_amd64.deb/download# # sudo apt install gdebi-core # sudo gdebi turbovnc_2.2.5_amd64.deb # sudo killall Xvnc; /opt/TurboVNC/bin/vncserver -name gns3 -geometry 1920x1080 :4 # systemctl enable ssh.service; service ssh start