[CCNA] Construction of Cisco device emulator environment (EC2 + Ubuntu + GNS3)

Introduction

In CCNA learning, it is better to have an environment where you can actually verify the operation of Cisco devices. The purpose of this article is to use Amazon EC2 + Ubuntu + GNS3 to build an emulator environment that can be verified anytime and anywhere as long as you have a PC and an Internet environment.

* The biggest bottleneck in using GNS3 is the preparation of Cisco IOS. If "the company has a Cisco partner agreement" or "the company or acquaintance owns a Cisco router" does not apply, you need to purchase a GNS3-compatible IOS-equipped router from Amazon, Yahoo! Auctions, Mercari, etc. Expenses will be incurred, so at your own risk. .. ..

table of contents

  1. [Prepare AWS environment](# Chapter1)
  2. [Build an Ubuntu server](# Chapter2)
  3. [Preparing Remote Desktop (xrdp)](# Chapter3)
  4. [Install GNS3](# Chapter4)
  5. Create Cisco Router Templates in GNS3 (# Chapter 5)
  6. Saigo ni
  7. References (#reference)

1. Prepare the AWS environment

I will omit the creation of AWS account, VPC, subnet, etc. because it is not the main point of this article.

2. Build an Ubuntu server

In the AWS Management Console, go to the EC2 page and launch an instance.

Create EC2 by referring to the following points.

--Select Ubuntu Server 18.04 LTS (HVM), SSD Volume Type 64-bit (x86) for AMI (subject to free usage tier) --Select t2.medium as the instance type (if t2.micro is eligible for free usage, the ubuntu desktop described later is too heavy to work) --Automatically assigned public IP should be enabled if it fits in the free usage tier (however, the public IP changes each time it is stopped and started) --The EBS volume can be general purpose SSD (gp2) 8GiB --The tag can be Name: gns3 --Security group is Type: For all traffic`` Source: Allows inbound to the public IP you are currently using ** * You can open it fully, but be careful as it is deprecated and dangerous! ** **

Reference: To check the public IP: Check the global IP address you are currently connected to the Internet

After the instance is created, use the pem key to SSH into the ubuntu server with TeraTerm etc. The default user for Ubuntu AMI is ubuntu.

Make the following initial settings.

First apt update


$ sudo apt -y update && sudo apt -y upgrade

Language and time setting


$ sudo apt -y install language-pack-ja-base language-pack-ja ibus-mozc
$ sudo localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
$ source /etc/default/locale
$ sudo apt -y install manpages-ja manpages-ja-dev
$ sudo timedatectl set-timezone Asia/Tokyo

Password and SSH authentication settings


$ sudo passwd ubuntu   #Specify any password
$ sudo vi /etc/ssh/sshd_config   #Change no of "Password Authentication" to yes and save
$ sudo systemctl restart sshd

3. Preparing remote desktop (xrdp)

For the xrdp setting, I referred to this article. Reference: Remote Desktop Connection Memo for Windows 10 → Ubuntu 18.04

Install each package as follows and reboot.

desktop/Install xrdp package


$ sudo apt install -y ubuntu-desktop
$ sudo apt install -y xrdp

apt update


$ sudo apt -y update && apt -y upgrade

From here, switch to the user who will actually use the remote desktop connection. This time, we will continue to connect as the ubuntu user.

Prepare two types of scripts (create new with vi command and copy and paste below)

/home/ubuntu/u_setting.sh


cat <<EOF > ~/.xsessionrc
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop
export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
EOF

/home/ubuntu/g_setting.sh


sudo sed -e 's/^new_cursors=true/new_cursors=false/g' -i /etc/xrdp/xrdp.ini

cat <<EOF | \
sudo tee /etc/polkit-1/localauthority/50-local.d/xrdp-color-manager.pkla
[Netowrkmanager]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF

sudo systemctl restart xrdp
sudo systemctl restart polkit

Run the two scripts in sequence.

$ sh /home/ubuntu/u_setting.sh
$ sh /home/ubuntu/g_setting.sh

Check and start the xrdp service, and enable automatic startup.

$ systemctl status xrdp
$ sudo systemctl start xrdp   #Not required if already started
$ sudo systemctl is-enabled xrdp
$ sudo systemctl enabled xrdp   #Not required if already enabled

4. Install GNS3

For the installation of GNS3, I referred to the official document. Reference: GNS3 Linux Install

Execute as follows.

python


$ sudo add-apt-repository ppa:gns3/ppa
$ sudo apt install gns3-gui gns3-server

When you execute the second command, as shown in the capture below When asked "whether to allow non-root users to use ubridge and wireshark", select "Yes" for both and press Enter. 20201115_GNS3サーバ構築キャプチャ01.PNG 20201115_GNS3サーバ構築キャプチャ02.PNG

The setting by CUI is completed. Reboot the OS.

python


$ sudo reboot

After the GNS3 server starts, the next step is to make a remote desktop connection from your PC to the GNS3 server.

The computer cannot be identified. Click "Yes" for the warning. 20201115_GNS3サーバ構築キャプチャ03.PNG

Since the xrdp authentication screen is displayed, username:ubuntu password: set password Enter and press OK. 20201115_GNS3サーバ構築キャプチャ04.PNG

The ubuntu desktop is displayed. The first setup screen will appear, but skip it with "Next" in the upper right. 20201115_GNS3サーバ構築キャプチャ07.PNG

Start the Ubuntu terminal by pressing the [Ctrl] + [Alt] + [t] keys at the same time on the desktop, and enter $ gns3 to execute. 20201115_GNS3サーバ構築キャプチャ08.PNG

The GNS3 setup wizard will be displayed. Select Run appliances on my local computer and press" Next ". Proceed with the default save destination path and port settings, and finally press "Finish". 20201115_GNS3サーバ構築キャプチャ12.PNG

Setup is complete and you can use GNS3. 20201115_GNS3サーバ構築キャプチャ13.PNG

5. Create Cisco Router Template in GNS3

I referred to this article. (Rather, it's almost the same, I'm sorry) Reference: [As a network engineer, "GNS3 --Setup"] (https://www.infraexpert.com/info/gns3z4.html)

Also, here, the IOS image of Cisco 3745 is pre-located in the ubuntu server with WinSCP.

Select Preferences from Edit in the GNS3 menu. 20201115_GNS3サーバ構築キャプチャ14.PNG

After selecting IOS routers for Dynamips, press "New" below. 20201115_GNS3サーバ構築キャプチャ15.PNG

IOS image: Select New Image, specify the IOS file of the Cisco router and press "Next" (selecting the .bin file will bring up the decompress menu and automatically convert it to an .image file). 20201115_GNS3サーバ構築キャプチャ16.PNG

Name and platform: Keep the default and press "Next". 20201115_GNS3サーバ構築キャプチャ17.PNG

Memory: Keep the default and press "Next". 20201115_GNS3サーバ構築キャプチャ18.PNG

Network adapters: Add Ethernet interfaces if you like (you can change them later) and press "Next". 20201115_GNS3サーバ構築キャプチャ19.PNG

WIC modules: Add a serial interface if you like (you can change it later) and press "Next". 20201115_GNS3サーバ構築キャプチャ20.PNG

Idle-PC: This setting is to prevent the CPU from rising on the host OS side. Click "Idle-PC finder" and press "Finish" below when the settings are auto-filled. 20201115_GNS3サーバ構築キャプチャ21.PNG

Now that you have a template for your Cisco router, you can use it with GNS3.

finally

As I wrote at the beginning, getting a Cisco IOS image may be a high hurdle for some people. In my case, the company had an actual Cisco 3745 for training, so I used the one that extracted the IOS image from it.

Also, it seems that you can create a switch template using the IOS image of Cisco 3745, and it seems that you can also verify vlan.

References

This article was written with reference to this document. I would like to take this moment to say thank you.

-Windows 10 → Ubuntu 18.04 Remote Desktop Connection Memo -[Remote Desktop Connection from Ubuntu / Windows to Ubuntu](https://linux.just4fun.biz/?Ubuntu/Windows%E3%81%8B%E3%82%89Ubuntu%E3%81%AB%E3%83 % AA% E3% 83% A2% E3% 83% BC% E3% 83% 88% E3% 83% 87% E3% 82% B9% E3% 82% AF% E3% 83% 88% E3% 83% 83 % E3% 83% 97% E6% 8E% A5% E7% B6% 9A% E3% 81% 99% E3% 82% 8B) -["GNS3 --Setup" as a network engineer] (https://www.infraexpert.com/info/gns3z4.html)

Recommended Posts

[CCNA] Construction of Cisco device emulator environment (EC2 + Ubuntu + GNS3)
Case that gave up environment construction of react with ubuntu
Laravel environment construction (Ubuntu 18.04 LTS)
[Windows] WSL2 + Ubuntu + Node.js environment construction
[Rails] AWS EC2 instance environment construction
[Processing x Java] Construction of development environment