diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..633033c --- /dev/null +++ b/Makefile @@ -0,0 +1,78 @@ +all: + echo OK + +create-gns3-user: + useradd gns3;true + mkdir -p /home/gns3 + rsync -av /etc/skel/ /home/gns3/ + usermod -a -G qemu gns3;true + usermod -a -G kvm gns3;true + usermod -a -G libvirt gns3;true + usermod -a -G docker gns3;true + + +install: install-gns3 + +install-docker: + bash install-docker.sh + +install-gns3-deps: + dnf update -y + dnf install epel-release -y + crb enable + dnf install epel-release -y + dnf group install -y "Development Tools" + dnf install -y cmake libpcap-devel + dnf group install -y "Virtualization Host" + dnf install -y python3.12 python3.12-devel python3.12-pip + update-alternatives --set python3 /usr/bin/python3.12 + pip3 install --upgrade pip + + +install-gns3: install-gns3-deps get-busy-box-static install-docker create-gns3-user build-gns3-server build-gns3-gui build-gns3-vpcs build-gns3-dynamips build-gns3-ubridge + chown gns3:gns3 /home/gns3/ -R + systemctl daemon-reload + systemctl enable gns3.service + systemctl start gns3.service + +build-gns3-server: + git clone --depth 1 https://github.com/GNS3/gns3-server.git; true + cd gns3-server && git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' && git pull origin && git checkout tags/v2.2.49 + python3 -m pip install --upgrade pip + cd gns3-server && pip3 install -r requirements.txt && python3 setup.py install + ln -s /usr/bin/qemu-system-x86_64 /usr/bin/qemu-kvm;true + cd gns3-server/init && cp gns3.service.systemd /etc/systemd/system/gns3.service + chown root:root /etc/systemd/system/gns3.service + sed -i -e "s@^ExecStart=.*@ExecStart=/usr/local/bin/gns3server@g" /etc/systemd/system/gns3.service + mkdir -p /home/gns3/.config/GNS3/2.2/ + cp -vf gns3_server.conf /home/gns3/.config/GNS3/2.2/gns3_server.conf + chown gns3:gns3 /home/gns3/ -R + systemctl daemon-reload + +build-gns3-gui: + git clone --depth 1 https://github.com/GNS3/gns3-gui.git; true + python3 -m pip install --upgrade pip + cd gns3-gui && pip3 install -r requirements.txt && python3 setup.py install + +build-gns3-vpcs: + git clone --depth 1 https://github.com/GNS3/vpcs.git; true + cd vpcs/src && ./mk.sh && cp -v vpcs /usr/local/bin/vpc + +build-gns3-dynamips: + git clone --depth 1 https://github.com/GNS3/dynamips.git; true + cd dynamips && mkdir build && cd build && cmake .. && make && make install + +build-gns3-ubridge: + git clone --depth 1 https://github.com/GNS3/ubridge.git; true + cd ubridge && make && make install + +upgrade-gns3-server: + git clone --depth 1 https://github.com/GNS3/gns3-server.git; true + cd gns3-server && git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' && git pull origin && git checkout tags/v2.2.49 + python3 -m pip install --upgrade pip + systemctl stop gns3.service + cd gns3-server && pip3 install -r requirements.txt && python3 setup.py install + systemctl start gns3.service + +get-busy-box-static: + bash get-busy-box-static.sh diff --git a/get-busy-box-static.sh b/get-busy-box-static.sh new file mode 100755 index 0000000..73cbb2c --- /dev/null +++ b/get-busy-box-static.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -x +set -e + +docker run -d --name busybox_extractor -v ${pwd}:/installer debian:12 sleep 3600 + +docker exec -it busybox_extractor apt update + +docker exec -it busybox_extractor apt upgrade -y + +docker exec -it busybox_extractor apt install -y busybox-static + +docker exec -it busybox_extractor cp -vf /usr/bin/busybox /installer/ + +docker stop busybox_extractor + +docker rm busybox_extractor + +cp -vf busybox /usr/bin/busybox + +set +e +set +x diff --git a/gns3-devel-packages b/gns3-devel-packages new file mode 100644 index 0000000..d72b921 --- /dev/null +++ b/gns3-devel-packages @@ -0,0 +1,4 @@ +jq +rsync +net-tools +lsb-release diff --git a/gns3_server.conf b/gns3_server.conf new file mode 100644 index 0000000..231e2be --- /dev/null +++ b/gns3_server.conf @@ -0,0 +1,49 @@ +[Server] +; IP where the server listen for connection +host = 0.0.0.0 +; HTTP port for controlling the servers +port = 3080 +; Path where images of devices are stored +images_path = /home/gns3/GNS3/images + +; Path where user project are stored +projects_path = /home/gns3/GNS3/projects + +; Send crash to the GNS3 team +report_errors = True +; First port of the range allocated to devices telnet console +console_start_port_range = 2001 +; Last port of the range allocated to devices telnet console +console_end_port_range = 5000 +; First port of the range allocated to communication between devices. You need two port by link +udp_start_port_range = 10000 +; Last port of the range allocated to communication between devices. You need two port by link +udp_end_port_range = 20000 +; Path of the ubridge program +ubridge_path = /usr/local/bin/ubridge +; Boolean for enabling HTTP auth +auth = True +; Username for HTTP auth +user = admin +; Password for HTTP auth +password = admin + +[VPCS] +; Path of the VPCS binary +vpcs_path = /usr/local/bin/vpc + +[Dynamips] +allocate_aux_console_ports = False +mmap_support = True +; Path of the dynamips path +dynamips_path = /usr/local/bin/dynamips +sparse_memory_support = True +ghost_ios_support = True + +[IOU] +; Path of the iouyap binary +iouyap_path = /usr/local/bin/iouyap +; Path of your .iourc file. If empty we search in $HOME/.iourc +iourc_path = /home/gns3/.iourc +; Validate if the iourc is correct. If you turn off and your licence is invalid iou will crash without errors +license_check = True diff --git a/install-docker.sh b/install-docker.sh index 3df8481..bc1224c 100755 --- a/install-docker.sh +++ b/install-docker.sh @@ -19,3 +19,5 @@ fi chmod +x /usr/bin/docker-compose +systemctl start docker +systemctl enable docker diff --git a/install-gns3.sh b/install-gns3.sh new file mode 100755 index 0000000..b777eb5 --- /dev/null +++ b/install-gns3.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +dnf update -y + +dnf install epel-release -y + +crb enable + +dnf install epel-release -y + +dnf group install -y "Development Tools" + +dnf install -y cmake libpcap-devel + +dnf group install -y "Virtualization Host" + +dnf install -y python3.12 python3.12-devel python3.12-pip + +update-alternatives --set python3 /usr/bin/python3.12 + +pip3 install --upgrade pip +