Skip to content

How to Install GNS3 Server on Google Cloud KVM Enabled VM.

License

Notifications You must be signed in to change notification settings

infotechca/gns3-on-gcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

Install GNS3 Server on Google Cloud (KVM Enabled VM)

Well Tested on Debian10 and Ubuntu 20

Steups to do

  • 1. Prepare your Google Cloud environment
  • 2. Enabling nested virtualization on an instance
    • 2.1 Create a boot disk from a public image
    • 2.2 Create a custom image with special license key for virtualization
    • 2.3 Create a VM instance using the new custom image with the license
    • 2.4 Create a Firewall ruel to allow GNS3 on port 3080
    • 2.5 Confirm that nested virtualization is enabled in the VM
  • 3. Prepare your instance for GNS3-server Installtion
    • 3.0 Update, Upgrade and Reboot your instance
    • 3.1 uBridge - Download, Compile and Install
    • 3.2 Dynamips - Download, Compile and Install
    • 3.3 VPCS - Download and Install
    • 3.4 QEMU and NAT (libvirt) - Install
    • 3.5 Docker - Install
    • 3.6 Installing i386-libraries for IOU -(IOS on UNIX)
    • 3.7 Installing Wireshark
    • 3.8 Create a user for GNS3Server - User: gns3 Pass: gns3
  • 4. Install GNS3 Server
    • 4.1 Set GNS3 server as a daemon (auto start at boot time)
  • 5. Testing GNS3Server
  • 6. Installing terminal based system monitoring tool

1. Prepare your Google Cloud environment

Before you begin Set you project default region and zone.
First, click the Activate Cloud Shell button at the top right of the Google Cloud Console.

Find you Goolge Cloud Projects by typing below command.

gcloud projects list

To set the default project for all gcloud commands, run the command: change itca-2020 with your project_id

gcloud config set project itca-2020

initialize the Google Cloud

gcloud init

2. Enabling nested virtualization on an instance

Restrictions

  • Nested virtualization can only be enabled for L1 VMs running on Haswell processors or later.
  • E2 machine types do not support nested virtualization.
  • Nested virtualization is supported only for KVM-based hypervisors running on Linux instances.
    • Hyper-V, ESX, and Xen hypervisors are not supported.
  • Windows VMs do not support nested virtualization; that is, host VMs must run a Linux OS.

2.1 Create a boot disk from a public image

There are two steps required to used nested virtualization:

  • The VM instances for which you want to use nested virtualization must use a custom image with a special license key.
  • To enable nested virtualization on a VM instance, create a custom image with a special license key that enables VMX in VM.
  • Create a boot disk from a public image or from a custom image with an operating system.
gcloud compute images list

NAME                            PROJECT              FAMILY                  DEPRECATED  STATUS
debian-10-buster-v20200910      debian-cloud         debian-10                           READY
ubuntu-2004-focal-v20200917     ubuntu-os-cloud      ubuntu-2004-lts                     READY

Debian Disk

gcloud compute disks create disk1 --image-project debian-cloud --image-family debian-10 --zone asia-southeast1-b

Ubuntu Disk

gcloud compute disks create disk1 --image-project ubuntu-os-cloud --image-family ubuntu-2004-lts 

2.2 Create a custom image with a special license key for virtualization

Using the boot disk that you created, create a custom image with the special license key required for virtualization.
change zone asia-southeast1-b to your zone example: us-east1-b

gcloud compute images create kvm-image \
  --source-disk disk1 --source-disk-zone asia-southeast1-b \
  --licenses "https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"

Note: After you create the image with the necessary license, you can delete the source disk if you no longer need it.

2.3 Create a VM instance using the new custom image with the license

You must create the instance in a zone that supports the Haswell CPU Platform or newer.
Check your zone for Haswell CPU support

gcloud compute zones describe asia-southeast1-b

Create a VM instance using the new custom image with the license
Minimum Alternatives:

  • Intel Skylake to Intel Haswell
  • n1-standard-8 to n1-standard-1
  • pd-ssd to pd-standard
gcloud compute instances create gns3server --zone asia-southeast1-b \
              --min-cpu-platform "Intel Skylake" --machine-type=n1-standard-8 \
              --boot-disk-size=30GB --boot-disk-type=pd-ssd \
              --tags http-server,https-server \
              --image kvm-image

2.4 Create a Firewall rule to allow GNS3 on port 3080

You must have to allow TCP port 3080 in the GCP firewall to access GNS3 Server.

gcloud compute firewall-rules create gns3 --action=ALLOW --rules=tcp:3080

2.5 Confirm that nested virtualization is enabled in the VM

Connect to your newly created instance with SSH.

gcloud compute ssh gns3server

Find Out CPU Supports for Intel VT Virtualization For KVM

grep -cw vmx /proc/cpuinfo

If the output of the above command is Greater-than zero then we have Virtualization technology enabled on our system.


3. Prepare your instance for GNS3-server Installation

  • uBridge is required, it interconnects the nodes.
  • Dynamips is required for running IOS routers (using real IOS images) as well as the internal switches and hubs.
  • VPCS is recommended, it is a builtin node simulating a very simple computer to perform connectivity tests using ping, traceroute.
  • Qemu is strongly recommended on Linux, as most node types are based on Qemu, for example, Cisco IOSv and Arista vEOS.
  • libvirt is recommended (Linux only), as it's needed for the NAT cloud
  • Docker is optional (Linux only), some nodes are based on Docker.

3.0 Update, Upgrade and Reboot your instance

sudo apt update && sudo apt upgrade -y && sudo reboot

3.1 uBridge - Download, Compile and Install

Dependencies For Ubuntu or other Debian based Linux you need to install this package:

  • libpcap-dev
sudo apt install make gcc libpcap-dev git wget -y

uBridge - Download, Compile and Install

cd ~
git clone https://github.com/GNS3/ubridge.git
cd ubridge/
make
sudo make install
cd ~

3.2 Dynamips - Download, Compile and Install

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.

Build Dependencies
On Debian based systems the following build dependencies are required and can be installed using apt:

  • libelf-dev
  • libpcap0.8-dev
sudo apt install cmake libelf-dev libpcap0.8-dev -y

Dynamips - Download, Compile and Install

cd ~
git clone git://github.com/GNS3/dynamips.git
cd dynamips/
mkdir build
cd build/
cmake ..
cmake .. -DDYNAMIPS_CODE=stable  -DCMAKE_C_COMPILER=/usr/bin/gcc
make
sudo make install
cd ~

3.3 VPCS - Download and Install

cd ~
wget https://github.com/GNS3/vpcs/releases/download/v0.6.1/vpcs
chmod +x vpcs
sudo cp vpcs /usr/bin/vpcs
cd ~

3.4 QEMU and NAT (libvirt) - Install

sudo apt install qemu-kvm qemu-system-x86 cpulimit ovmf uml-utilities bridge-utils virtinst libvirt-daemon-system libvirt-clients -y

3.5 Docker - Install

sudo apt install docker.io -y

3.6 Installing i386-libraries for IOU -(IOS on UNIX)

Dependencies:

  • libc
  • libcrypto

First add i386 architecture support then update your system and install requirements.

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libssl1.1:i386 -y
cd ~

3.7 Installing Wireshark

"Should non-superusers be able to capture packets?" select Yes.

sudo apt install wireshark

3.8 Create a user for GNS3Server - User: gns3 Pass: gns3

sudo adduser gns3

sudo adduser gns3 sudo
sudo adduser gns3 kvm
sudo adduser gns3 docker
sudo adduser gns3 wireshark
groups gns3
:

4. Install GNS3 Server

Dependencies:

sudo apt install python3-setuptools python3-pip python3-aiohttp python3-psutil python3-jsonschema -y

Finally Download and Install GNS3 Server.

cd ~
git clone https://github.com/GNS3/gns3-server.git
cd gns3-server
sudo python3 setup.py install
cd init
sudo cp gns3.service.systemd /lib/systemd/system/gns3.service
sudo chown root /lib/systemd/system/gns3.service
cd ~
:

4.1 Set GNS3 server as a daemon (auto start at boot time)

sudo systemctl enable gns3
sudo systemctl enable docker
sudo virsh net-autostart default
ls

It is better to reboot your instance at this time.

sudo reboot

5. Testing GNS3Server

login with gns3 user:

sudo su gns3
cd ~
sudo systemctl status gns3
:
  • Make sure you are login with gns3 user
  • Download and Extract the GNS3 Sample Project for testing
  • Installing license key to run Cisco IOU on system.
cd ~
sudo pip3 install gdown
gdown https://drive.google.com/uc?id=1HDeSeUS2KuyAAk9g4Lxrq7PXltHPscA7
tar -xf GNS3.tar.gz -C ~/
cp -r ~/home/gns3/GNS3/* ~/GNS3/
rm -rf ~/home/
mkdir ~/gns3_config_backup/
cp ~/.config/GNS3/2.*/* ~/gns3_config_backup/
wget https://archive.org/download/gns3-on-gcp/gns3_controller.conf
mv gns3_controller.conf ~/.config/GNS3/2.*/
sudo bash -c 'printf "\0\0\0\0" > /etc/hostid'
cd ~
wget https://archive.org/download/gns3-on-gcp/ciscoIOUKeygen_Python3.py
chmod +x ciscoIOUKeygen_Python3.py
python3 ./ciscoIOUKeygen_Python3.py
cat < ~/iourc.txt > ~/.iourc
sudo bash -c 'printf "\n127.0.0.127\txml.cisco.com  # Added by Me\n" >> /etc/hosts'
cat /etc/hosts
sudo systemctl restart gns3
:

Find your instance Public IP and connect to it using browser
example: http://0.0.0.0:3080

6. Installing terminal based system monitoring tool

Install gotop for system monitoring.

cd ~
wget https://github.com/xxxserxxx/gotop/releases/download/v4.0.1/gotop_v4.0.1_linux_amd64.tgz
tar -xf gotop_v4.0.1_linux_amd64.tgz
sudo mv gotop /usr/bin/
rm gotop_v4.0.1_linux_amd64.tgz
sudo gotop
:

▀▄▀▄▀▄ [ Follow us on ] ▄▀▄▀▄▀
Website: https://www.infotechca.com
YouTube: https://youtube.com/infotechca
Twitter: https://twitter.com/infotechca
Facebook: https://www.facebook.com/infotechca.hyd
Instagram: https://www.instagram.com/infotechca
Pinterest: https://pinterest.com/infotechca
Github: https://github.com/infotechca

About

How to Install GNS3 Server on Google Cloud KVM Enabled VM.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published