FreeBSD/jails/config/vm/gns3.sh

72 lines
1.7 KiB
Bash
Raw Normal View History

2021-02-13 11:38:38 -08:00
#!/usr/local/bin/bash
2022-04-19 13:46:35 -07:00
# Copyright (c) 2018-2022, diyIT.org
2021-02-13 11:38:38 -08:00
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
2022-04-19 13:38:56 -07:00
# ./gns3.sh under tmux
2021-02-13 11:38:38 -08:00
2021-04-01 01:23:14 -07:00
# disabled for now
2022-12-03 17:32:20 -08:00
exit
2021-04-01 01:23:14 -07:00
2021-02-13 11:38:38 -08:00
# clean cached state
2022-04-19 13:38:56 -07:00
bhyvectl --destroy --vm=gns3
2021-02-13 11:38:38 -08:00
while true
do
2022-04-19 13:38:56 -07:00
bhyve -c 4 -m 16G -A -H -P \
2021-02-13 11:38:38 -08:00
-s 0,hostbridge \
-s 3,ahci-cd \
2022-04-19 13:38:56 -07:00
-s 4,virtio-blk,/dev/zvol/ship/raw/gns3 \
2021-02-13 11:38:38 -08:00
-s 5,virtio-net,tap86,mac=00:0A:0B:0C:0D:86 \
2021-04-01 01:23:14 -07:00
-s 7,virtio-net,tap4886,mac=00:0A:0B:0C:8D:86 \
2021-02-13 11:38:38 -08:00
-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 \
2022-04-19 13:38:56 -07:00
gns3
2021-02-13 11:38:38 -08:00
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
2022-04-19 13:38:56 -07:00
echo `date` - restarting gns3 in 5 seconds - press ctrl-c to stop
2021-02-13 11:38:38 -08:00
sleep 5
done
exit $?
2022-04-19 13:38:56 -07:00
#-s 3,ahci-cd,/mnt/linux/ubuntu-20.04.1-live-server-amd64.iso \
##-s 6,virtio-blk,/dev/zvol/ship/raw/gns3_data \
2021-02-13 11:38:38 -08:00
2022-04-19 13:38:56 -07:00
# bhyvectl --get-all --vm=gns3
2021-02-13 11:38:38 -08:00
# cu -l /dev/nmdm86B
# (This uses cu() so press ~+Ctrl-D to exit)
#on base system:
2022-04-19 13:38:56 -07:00
#zfs create -V 128G -o refreservation=none ship/raw/gns3
2021-02-13 11:38:38 -08:00
# 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
2022-04-19 13:38:56 -07:00
# sudo killall Xvnc; /opt/TurboVNC/bin/vncserver -name gns3 -geometry 1920x1080 :4
2021-02-13 11:38:38 -08:00
# systemctl enable ssh.service; service ssh start