├── LICENSE ├── Quick&Dirty.md └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /Quick&Dirty.md: -------------------------------------------------------------------------------- 1 | # GNS3 Server Quick Start 2 | 3 | ```bash 4 | sudo dpkg --add-architecture i386 && sudo apt update && sudo apt upgrade -y && sudo reboot 5 | ``` 6 | 7 | ```bash 8 | sudo apt install make gcc libpcap-dev git wget cmake libelf-dev libpcap0.8-dev qemu-kvm qemu-system-x86 cpulimit ovmf uml-utilities bridge-utils virtinst libvirt-daemon-system libvirt-clients docker.io libssl1.1:i386 python3-setuptools python3-pip python3-aiohttp python3-psutil python3-jsonschema wireshark -y 9 | ``` 10 | ```bash 11 | cd ~ 12 | git clone https://github.com/GNS3/ubridge.git 13 | cd ubridge/ 14 | make 15 | sudo make install 16 | cd ~ 17 | git clone git://github.com/GNS3/dynamips.git 18 | cd dynamips/ 19 | mkdir build 20 | cd build/ 21 | cmake .. 22 | cmake .. -DDYNAMIPS_CODE=stable -DCMAKE_C_COMPILER=/usr/bin/gcc 23 | make 24 | sudo make install 25 | cd ~ 26 | wget https://github.com/GNS3/vpcs/releases/download/v0.6.1/vpcs 27 | chmod +x vpcs 28 | sudo cp vpcs /usr/bin/vpcs 29 | cd ~ 30 | : 31 | ``` 32 | 33 | ```bash 34 | sudo adduser gns3 35 | ``` 36 | 37 | ```bash 38 | sudo adduser gns3 sudo 39 | sudo adduser gns3 kvm 40 | sudo adduser gns3 docker 41 | sudo adduser gns3 wireshark 42 | cd ~ 43 | git clone https://github.com/GNS3/gns3-server.git 44 | cd gns3-server 45 | sudo python3 setup.py install 46 | cd init 47 | sudo cp gns3.service.systemd /lib/systemd/system/gns3.service 48 | sudo chown root /lib/systemd/system/gns3.service 49 | sudo systemctl enable gns3 50 | sudo systemctl enable docker 51 | sudo virsh net-autostart default 52 | sudo reboot 53 | : 54 | ``` 55 | 56 | ```bash 57 | sudo su gns3 58 | cd ~ 59 | sudo systemctl status gns3 60 | : 61 | ``` 62 | 63 | ```bash 64 | sudo pip3 install gdown 65 | gdown https://drive.google.com/uc?id=1HDeSeUS2KuyAAk9g4Lxrq7PXltHPscA7 66 | tar -xf GNS3.tar.gz -C ~/ 67 | cp -r ~/home/gns3/GNS3/* ~/GNS3/ 68 | rm -rf ~/home/ 69 | mkdir ~/gns3_config_backup/ 70 | cp ~/.config/GNS3/2.*/* ~/gns3_config_backup/ 71 | wget https://archive.org/download/gns3-on-gcp/gns3_controller.conf 72 | mv gns3_controller.conf ~/.config/GNS3/2.*/ 73 | sudo bash -c 'printf "\0\0\0\0" > /etc/hostid' 74 | cd ~ 75 | wget https://archive.org/download/gns3-on-gcp/ciscoIOUKeygen_Python3.py 76 | chmod +x ciscoIOUKeygen_Python3.py 77 | python3 ./ciscoIOUKeygen_Python3.py 78 | cat < ~/iourc.txt > ~/.iourc 79 | sudo bash -c 'printf "\n127.0.0.127\txml.cisco.com # Added by Me\n" >> /etc/hosts' 80 | cd ~ 81 | wget https://github.com/xxxserxxx/gotop/releases/download/v4.0.1/gotop_v4.0.1_linux_amd64.tgz 82 | tar -xf gotop_v4.0.1_linux_amd64.tgz 83 | sudo mv gotop /usr/bin/ 84 | rm gotop_v4.0.1_linux_amd64.tgz 85 | sudo systemctl restart gns3 86 | sudo gotop 87 | : 88 | ``` 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Install GNS3 Server on Google Cloud (**_KVM Enabled VM_**) 2 | 3 | **Well Tested on Debian10 and Ubuntu 20** 4 | 5 | ## _Steups to do_ 6 | 7 | - [x] 1. Prepare your Google Cloud environment 8 | - [x] 2. Enabling nested virtualization on an instance 9 | - [x] 2.1 Create a boot disk from a public image 10 | - [x] 2.2 Create a custom image with special license key for virtualization 11 | - [x] 2.3 Create a VM instance using the new custom image with the license 12 | - [x] 2.4 Create a Firewall ruel to allow GNS3 on port **`3080`** 13 | - [x] 2.5 Confirm that nested virtualization is enabled in the VM 14 | - [x] 3. Prepare your instance for GNS3-server Installtion 15 | - [x] 3.0 Update, Upgrade and Reboot your instance 16 | - [x] 3.1 uBridge - Download, Compile and Install 17 | - [x] 3.2 Dynamips - Download, Compile and Install 18 | - [x] 3.3 VPCS - Download and Install 19 | - [x] 3.4 QEMU and NAT (libvirt) - Install 20 | - [x] 3.5 Docker - Install 21 | - [x] 3.6 Installing i386-libraries for IOU -(IOS on UNIX) 22 | - [x] 3.7 Installing Wireshark 23 | - [x] 3.8 Create a user for GNS3Server - User: **`gns3`** Pass: **`gns3`** 24 | - [x] 4. Install GNS3 Server 25 | - [x] 4.1 Set GNS3 server as a daemon (auto start at boot time) 26 | - [x] 5. Testing GNS3Server 27 | - [x] 6. Installing terminal based system monitoring tool 28 | --- 29 | ## 1. Prepare your Google Cloud environment 30 | Before you begin Set you project default region and zone.
31 | First, click the Activate Cloud Shell button at the top right of the Google Cloud Console.
32 |
33 | Find you Goolge Cloud Projects by typing below command. 34 | ```bash 35 | gcloud projects list 36 | ``` 37 | To set the default project for all gcloud commands, run the command: change ~**`itca-2020`**~ with your **`project_id`** 38 | ```bash 39 | gcloud config set project itca-2020 40 | ``` 41 | initialize the Google Cloud 42 | ```bash 43 | gcloud init 44 | ``` 45 | --- 46 | ## 2. Enabling nested virtualization on an instance 47 | **Restrictions** 48 | - Nested virtualization can only be enabled for L1 VMs running on **Haswell processors** or later. 49 | - E2 machine types do not support nested virtualization. 50 | - Nested virtualization is supported only for KVM-based hypervisors running on Linux instances. 51 | - Hyper-V, ESX, and Xen hypervisors are not supported. 52 | - Windows VMs do not support nested virtualization; that is, host VMs must run a Linux OS. 53 | --- 54 | ### 2.1 Create a boot disk from a public image 55 | There are two steps required to used nested virtualization:
56 | - The VM instances for which you want to use nested virtualization must use a custom image with a special license key.
57 | - To enable nested virtualization on a VM instance, create a custom image with a special license key that enables VMX in VM.
58 | - Create a boot disk from a public image or from a custom image with an operating system.
59 | 60 | ```bash 61 | gcloud compute images list 62 | 63 | NAME PROJECT FAMILY DEPRECATED STATUS 64 | debian-10-buster-v20200910 debian-cloud debian-10 READY 65 | ubuntu-2004-focal-v20200917 ubuntu-os-cloud ubuntu-2004-lts READY 66 | ``` 67 | Debian Disk 68 | ```bash 69 | gcloud compute disks create disk1 --image-project debian-cloud --image-family debian-10 --zone asia-southeast1-b 70 | ``` 71 | Ubuntu Disk 72 | ```bash 73 | gcloud compute disks create disk1 --image-project ubuntu-os-cloud --image-family ubuntu-2004-lts 74 | ``` 75 | ### 2.2 Create a custom image with a special license key for virtualization 76 | Using the boot disk that you created, create a custom image with the special license key required for virtualization.
77 | change zone ~**`asia-southeast1-b`**~ to your zone _example:_ **`us-east1-b`** 78 | ```bash 79 | gcloud compute images create kvm-image \ 80 | --source-disk disk1 --source-disk-zone asia-southeast1-b \ 81 | --licenses "https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx" 82 | ``` 83 | Note: After you create the image with the necessary license, you can delete the source disk if you no longer need it.
84 | ### 2.3 Create a VM instance using the new custom image with the license 85 | You must create the instance in a zone that supports the **Haswell** CPU Platform or newer.
86 | Check your zone for Haswell CPU support 87 | ```bash 88 | gcloud compute zones describe asia-southeast1-b 89 | ``` 90 | Create a VM instance using the new custom image with the license
91 | Minimum Alternatives: 92 | - ~**`Intel Skylake`**~ to **`Intel Haswell`**
93 | - ~**`n1-standard-8`**~ to **`n1-standard-1`**
94 | - ~**`pd-ssd`**~ to **`pd-standard`**
95 | 96 | ```bash 97 | gcloud compute instances create gns3server --zone asia-southeast1-b \ 98 | --min-cpu-platform "Intel Skylake" --machine-type=n1-standard-8 \ 99 | --boot-disk-size=30GB --boot-disk-type=pd-ssd \ 100 | --tags http-server,https-server \ 101 | --image kvm-image 102 | ``` 103 | ### 2.4 Create a Firewall rule to allow GNS3 on port **`3080`** 104 | You must have to allow TCP port `3080` in the GCP firewall to access GNS3 Server. 105 | ```bash 106 | gcloud compute firewall-rules create gns3 --action=ALLOW --rules=tcp:3080 107 | ``` 108 | ### 2.5 Confirm that nested virtualization is enabled in the VM 109 | Connect to your newly created instance with SSH. 110 | ```bash 111 | gcloud compute ssh gns3server 112 | ``` 113 | Find Out CPU Supports for **Intel VT** Virtualization For KVM 114 | ```bash 115 | grep -cw vmx /proc/cpuinfo 116 | ``` 117 | If the output of the above command is Greater-than zero then we have Virtualization technology enabled on our system.
118 | 119 | --- 120 | ## 3. Prepare your instance for GNS3-server Installation 121 | 122 | - uBridge is required, it interconnects the nodes.
123 | - Dynamips is required for running IOS routers (using real IOS images) as well as the internal switches and hubs.
124 | - VPCS is recommended, it is a builtin node simulating a very simple computer to perform connectivity tests using ping, traceroute.
125 | - Qemu is strongly recommended on Linux, as most node types are based on Qemu, for example, Cisco IOSv and Arista vEOS.
126 | - libvirt is recommended (Linux only), as it's needed for the NAT cloud
127 | - Docker is optional (Linux only), some nodes are based on Docker.
128 | --- 129 | ### 3.0 Update, Upgrade and Reboot your instance 130 | ```bash 131 | sudo apt update && sudo apt upgrade -y && sudo reboot 132 | ``` 133 | ### 3.1 uBridge - Download, Compile and Install 134 | **Dependencies** 135 | For Ubuntu or other Debian based Linux you need to install this package: 136 | - libpcap-dev 137 | ```bash 138 | sudo apt install make gcc libpcap-dev git wget -y 139 | ``` 140 | uBridge - Download, Compile and Install 141 | ```bash 142 | cd ~ 143 | git clone https://github.com/GNS3/ubridge.git 144 | cd ubridge/ 145 | make 146 | sudo make install 147 | cd ~ 148 | 149 | ``` 150 | ### 3.2 Dynamips - Download, Compile and Install 151 | Dynamips now uses the CMake build system. To compile Dynamips you will need CMake and a working GCC or Clang compiler, as well as the build dependencies. 152 | 153 | **Build Dependencies**
154 | On Debian based systems the following build dependencies are required and can be installed using apt: 155 | 156 | - libelf-dev 157 | - libpcap0.8-dev 158 | ```bash 159 | sudo apt install cmake libelf-dev libpcap0.8-dev -y 160 | ``` 161 | Dynamips - Download, Compile and Install 162 | ```bash 163 | cd ~ 164 | git clone git://github.com/GNS3/dynamips.git 165 | cd dynamips/ 166 | mkdir build 167 | cd build/ 168 | cmake .. 169 | cmake .. -DDYNAMIPS_CODE=stable -DCMAKE_C_COMPILER=/usr/bin/gcc 170 | make 171 | sudo make install 172 | cd ~ 173 | 174 | ``` 175 | 176 | ### 3.3 VPCS - Download and Install 177 | 178 | ```bash 179 | 180 | cd ~ 181 | wget https://github.com/GNS3/vpcs/releases/download/v0.6.1/vpcs 182 | chmod +x vpcs 183 | sudo cp vpcs /usr/bin/vpcs 184 | cd ~ 185 | 186 | ``` 187 | 188 | ### 3.4 QEMU and NAT (libvirt) - Install 189 | 190 | ```bash 191 | sudo apt install qemu-kvm qemu-system-x86 cpulimit ovmf uml-utilities bridge-utils virtinst libvirt-daemon-system libvirt-clients -y 192 | ``` 193 | 194 | ### 3.5 Docker - Install 195 | ```bash 196 | sudo apt install docker.io -y 197 | ``` 198 | 199 | ### 3.6 Installing i386-libraries for IOU -(IOS on UNIX) 200 | **Dependencies:** 201 | - libc 202 | - libcrypto 203 | 204 | First add i386 architecture support then update your system and install requirements. 205 | 206 | ```bash 207 | sudo dpkg --add-architecture i386 208 | sudo apt update 209 | sudo apt install libssl1.1:i386 -y 210 | cd ~ 211 | ``` 212 | ### 3.7 Installing Wireshark 213 | **"Should non-superusers be able to capture packets?"** select `Yes`. 214 | ```bash 215 | sudo apt install wireshark 216 | ``` 217 | ### 3.8 Create a user for GNS3Server - User: **`gns3`** Pass: **`gns3`** 218 | ```bash 219 | sudo adduser gns3 220 | 221 | sudo adduser gns3 sudo 222 | sudo adduser gns3 kvm 223 | sudo adduser gns3 docker 224 | sudo adduser gns3 wireshark 225 | groups gns3 226 | : 227 | ``` 228 | --- 229 | ## 4. Install GNS3 Server 230 | **Dependencies:** 231 | ```bash 232 | sudo apt install python3-setuptools python3-pip python3-aiohttp python3-psutil python3-jsonschema -y 233 | ``` 234 | Finally Download and Install GNS3 Server. 235 | ```bash 236 | cd ~ 237 | git clone https://github.com/GNS3/gns3-server.git 238 | cd gns3-server 239 | sudo python3 setup.py install 240 | cd init 241 | sudo cp gns3.service.systemd /lib/systemd/system/gns3.service 242 | sudo chown root /lib/systemd/system/gns3.service 243 | cd ~ 244 | : 245 | ``` 246 | ### 4.1 Set GNS3 server as a daemon (auto start at boot time) 247 | ```bash 248 | sudo systemctl enable gns3 249 | sudo systemctl enable docker 250 | sudo virsh net-autostart default 251 | ls 252 | ``` 253 | It is better to reboot your instance at this time. 254 | ```bash 255 | sudo reboot 256 | ``` 257 | --- 258 | ## 5. Testing GNS3Server 259 | login with gns3 user: 260 | ```bash 261 | sudo su gns3 262 | cd ~ 263 | sudo systemctl status gns3 264 | : 265 | 266 | ``` 267 | - Make sure you are login with gns3 user 268 | - Download and Extract the GNS3 Sample Project for testing
269 | - Installing license key to run Cisco IOU on system.
270 | ```bash 271 | cd ~ 272 | sudo pip3 install gdown 273 | gdown https://drive.google.com/uc?id=1HDeSeUS2KuyAAk9g4Lxrq7PXltHPscA7 274 | tar -xf GNS3.tar.gz -C ~/ 275 | cp -r ~/home/gns3/GNS3/* ~/GNS3/ 276 | rm -rf ~/home/ 277 | mkdir ~/gns3_config_backup/ 278 | cp ~/.config/GNS3/2.*/* ~/gns3_config_backup/ 279 | wget https://archive.org/download/gns3-on-gcp/gns3_controller.conf 280 | mv gns3_controller.conf ~/.config/GNS3/2.*/ 281 | sudo bash -c 'printf "\0\0\0\0" > /etc/hostid' 282 | cd ~ 283 | wget https://archive.org/download/gns3-on-gcp/ciscoIOUKeygen_Python3.py 284 | chmod +x ciscoIOUKeygen_Python3.py 285 | python3 ./ciscoIOUKeygen_Python3.py 286 | cat < ~/iourc.txt > ~/.iourc 287 | sudo bash -c 'printf "\n127.0.0.127\txml.cisco.com # Added by Me\n" >> /etc/hosts' 288 | cat /etc/hosts 289 | sudo systemctl restart gns3 290 | : 291 | ``` 292 | Find your instance Public IP and connect to it using browser
293 | _example:_ http://0.0.0.0:3080 294 | 295 | ## 6. Installing terminal based system monitoring tool 296 | Install gotop for system monitoring. 297 | ```bash 298 | cd ~ 299 | wget https://github.com/xxxserxxx/gotop/releases/download/v4.0.1/gotop_v4.0.1_linux_amd64.tgz 300 | tar -xf gotop_v4.0.1_linux_amd64.tgz 301 | sudo mv gotop /usr/bin/ 302 | rm gotop_v4.0.1_linux_amd64.tgz 303 | sudo gotop 304 | : 305 | 306 | ``` 307 | --- 308 | ▀▄▀▄▀▄ [ Follow us on ] ▄▀▄▀▄▀
309 | Website: https://www.infotechca.com
310 | YouTube: https://youtube.com/infotechca
311 | Twitter: https://twitter.com/infotechca
312 | Facebook: https://www.facebook.com/infotechca.hyd
313 | Instagram: https://www.instagram.com/infotechca
314 | Pinterest: https://pinterest.com/infotechca
315 | Github: https://github.com/infotechca
316 | --------------------------------------------------------------------------------