Как добавить виртуальную машину в gns3

Настройка виртуального локального сервера GNS3

Разработчики GNS3 хорошо потрудились и в последних версиях добавили поддержку IOU, VIRL и образов многих других вендоров оборудования. Для запуска некоторых образов GNS3 настоятельно рекомендует использовать виртуальный сервер GNS3 VM (локальный или удаленный), к которому уже подключается сам клиент GNS3.

В этой статье мы рассмотрим как настроить локальный виртуальный сервер и добавим в него образ маршрутизатора серии 7200. Виртуальный сервер необходим на машинах под управлением ОС Windows, на машинах с Linux такая необходимость отпадает.

Итак, GNS3 у нас уже установлен. Для установки виртуального сервера нам понадобится VirtualBox или VMWare Player. Обе программы бесплатные, поэтому смело скачиваем и инсталлируем.

GNS3 рекомендует использовать VMWare ввиду его лучшей производительности по сравнению с VirtualBox. Вам решать какую программу использовать. В данной статье приводится описание для VirtualBox, однако установка сервера на VMWare аналогична и не составит вам труда.

Образы виртуальных машин GNS3 VM можете скачать здесь. Скачиваем сервер соответствующей версии (в моем случае это было 2.02, VirtualBox)

После распаковки файла импортируем его в VirtualBox

В результате импортирования настроек сервер GNS3 VM имеет 2 сетевых интерфейса:

— Virtual adapter
— NAT

Оставляем интерфейсы как есть, остальные настройки можно по желанию подкорректировать.

Выбираем GNS VM и настраиваем как указано на рисунке

GNS3 сам определит установленный сервер. Если этого не произошло, то жмем на кнопку Refresh. После этого жмем на Apply и ждем запуска сервера. Удачный запуск отобразится в правой панели клиента

Сервер у нас установлен и запущен, однако чтобы воспользоваться его преимуществами необходимо импортировать образы на сервер. Именно на сервере и будут запускаться наши образы.

Возвращаемся к окну настроек, перейдя по Edit → Preferences. Выбираем Dynamips → IOS Routers (либо QEMU или IOS on UNIX в зависимости от типа образа) и нажимаем на кнопку New, чтобы добавить образ

Выбираем наш локальный виртуальный сервер

Затем выбираем образ и распаковываем его

Если платформа образа поддерживается эмулятором, то GNS3 автоматически определит версию платформы

По умолчанию GNS3 выставляет определенные значения ОЗУ для данной модели платформы, однако при желании можно проверить это значение на самом сайте Cisco

Рекомендую использовать значения по умолчанию. Если возникнут проблемы с запуском устройства или устройство неожиданно выключается, то в этом случае необходимо увеличить размер выделенной памяти.

Итак, значение памяти проверено и выставлено. Теперь настроим саму физическую конфигурацию устройства, в нашем случае маршрутизатора серии 7200

Затем вычисляем значение Idle-PC, чтобы наш процессор не загружался на все 100%. Если не получается с первого раза, то пробуем еще раз. Либо уже можно установить данное значение в самой топологии

Вот как выглядит у нас эмулируемая платформа

Нажимаем OK и можем приступать к созданию самой топологии.

Источник

GNS3 Setup wizard with the GNS3 VM

Which Virtualization Software? VirtualBox or VMware?#

In this document we will explain the import of the GNS3 VM for VMware but instructions for VirtualBox are similar.

VMware is a better option because it’s faster and supports nested virtualization (the VMs inside the VM are accelerated by your CPU). The speed difference is important and some VM will be too slow on VirtualBox* (see note).

VMware Workstation vs. Player#

GNS3 supports both VMware Workstation Pro and VMware Fusion (Paid software), as well as VMware Player (Free software).

VMware Player requires the installation of additional free software (VMware VIX). If you forget to install this, GNS3 will prompt you to do so (and open a browser to the link on VMware’s website). The option for “VIX version 1.17 and later” is sufficient for VMware Workstation Player version 16.x. For older versions of Player, you’ll need to select a previous version of VIX that matches your version of Player.

You can get 20% off VMware Workstation Pro and VMware Fusion thanks to our deal with VMware.

VMware ESXi#

VMware ESXi is for advanced users only and is not covered by this document.

Import GNS3 VM into VMware Workstation#

In this section, you will learn how to import the GNS3 VM into VMware Workstation on your local Windows PC.

This document assumes that you already have VMware Workstation installed on your local Windows PC. Please refer to VMware documentation for the process to download and install VMware Workstation.

1

This extracts the “GNS3 VM.ova” file stored within the compressed archive, in order to import it into VMware Workstation.

In VMware Workstation, click ‘Open a Virtual Machine’:

2

Navigate to the directory where the extracted GNS3 VM.ova is located, and click ‘Open’ to open the OVA:

3

Leave the virtual machine name as ‘GNS3 VM’, and click ‘Import’:

4

With VMware Player it’s recommended to keep the default location. GNS3 will try to detect VMs outside, but unlike Workstation VMware Player doesn’t offer a central database with all VMs location.

VMware Workstation will import the GNS3 VM:

5

The GNS3 VM will show as available in VMware Workstation. Leave all settings at their defaults:

6

Congratulations! You have successfully imported the GNS3 VM. In the next section you will integrate GNS3 with the GNS3 VM.

If you encounter a message in the GNS3-VM where it states that KVM support is not available, even if you have a CPU capable of hardware virtualization (modern Intel and AMD CPUs all support this), please confirm that it has been enabled in your system BIOS/UEFI (consult the documentation supplied by your motherboard manufacturer or PC vendor, to learn how to access this)

Local GNS3 VM Setup Wizard#

The GNS3 Setup Wizard is displayed when GNS3 starts up for the first time. This provides an easy way to initially configure GNS3 options:

7

Manually Starting the Setup Wizard#

You can also manually start the Setup Wizard at any time by clicking Help->Setup Wizard in the GNS3 software:

8

Disable Setup Wizard#

Optional: You can disable the Setup Wizard from displaying by selecting the ‘Don’t show this again’ checkbox:

9

Using the GNS3 Setup Wizard#

Select ‘Run Modern IOS (IOSv or IOU), ASA, and appliances from non-Cisco manufacturers’ in the Wizard and click ‘Next’:

10

This guide explains the Local GNS3 VM server configuration. For a Local Server (Dynamips) configuration click here.

Even though you’ll be using the GNS3-VM to perform the “heavy lifting” of running your VMs/images/containers, it’s still necessary to configure the local server settings in GNS3 before proceeding with the remaining process of configuring the GNS3-VM.

11

Ensure that the path to the gns3server executable is correct (typically C:\Program Files\GNS3 in a default installation), and select a Host binding and Port. Selecting the 127.0.0.1 local loopback address tends to be the most trouble-free option to use as a host binding, but the dropdown menu does contain additional options. Click ‘Next’.

A connection validation screen will appear:

12

If successful, click ‘Next’. If this connection attempt was unsuccessful for any reason, there possible remedies are to:

An additional step that may be necessary is to allow the gns3server, ubridge, and dynamips executables through the Windows Firewall. The default behavior is for these to already be allowed through, but it’s well worth double-checking.

The Virtualization software you are going to use needs to be selected. In this example, VMware (recommended) is selected:

13

The Setup Wizard will detect the presence of the GNS3 VM in VMware Workstation. If the GNS3 VM is not displayed, click the ‘Refresh’ button and ensure that the VM was imported correctly into VMware Workstation:

14

Change the vCPU cores and RAM values to the amount that your computer supports and then click ‘Next’:

GNS3 recommends a minimum of 1 vCPU core and 2GB RAM. However, if you want to run large topologies with many devices, more CPU cores and RAM are recommended. You can adjust the settings later using the GNS3 GUI. A good rule of thumb is to assign it half the total amount of available vCPU cores and physical RAM available in your PC. The below example uses a minimal resource allocation, as it’s being run on a laptop. On a desktop with an i7 quad-core CPU with hyperthreading and 32GB RAM, allocating the GNS3 VM 4-6 vCPUs and 16GB RAM will allow for respectable GNS3 topologies to be running, while still reserving enough resources to task switch between GNS3 and Windows (or Linux).

15

After making your allocation choices, click ‘Next’:

16

The next page will show a summary of the settings you chose for the GNS3 VM. You may see a pop up saying “Please Wait”. That’s perfectly normal, as it’s due to GNS3 starting the GNS3 VM up:

17

Once booted successfully, the IP address of the GNS3 VM will be displayed:

18

While devices are normally installed using appliance templates found in the GNS3 Marketplace (via the Import Appliance wizard), we’ll manually add a router using a compatible IOS image, just for a quick example. GNS3 is not limited to just those IOS images. Other articles (here and here cover importing devices via those appliance templates via the aforementioned Import Appliance wizard, even compatible IOS images.

In the GNS3 GUI, click Edit->Preferences->IOS Routers, to reach the correct section we need to be in:

1920

Click ‘New’ to begin manually importing and configuring the image.

21

In the New IOS router template window, select Run the IOS router on the GNS3 VM and click ‘Next’:

22

The New IOS router template window displays. Click ‘Browse…’ to find a local IOS image on your computer:

23

Browse to the folder where you have stored your Cisco IOS images (you must supply your own), select the image and click ‘Open’:

24

GNS3 can decompress IOS images to allow for quicker booting of routers in your GNS3 topologies. This is recommended for a better user experience, as IOS image decompression can take several minutes, even on physical hardware. Click ‘Yes’ to uncompress the image:

25

The image is automatically uploaded to the GNS3 VM (this may take a few moments, depending on the speed of your PC, and the size of the image/VM).

The uploaded image is shown. Click ‘Next’ to continue the setup:

26

The Name and platform window displays. Confirm the Platform selection, and configure the router Name as desired and click ‘Next’:

27

A Default RAM setting is displayed. It is important that you check your Router’s minimum memory requirements using the Cisco website. Click the Check for minimum and maximum RAM requirement option:

28

The Cisco Feature Navigator is opened in your default web browser. Select Image Name and enter the name of the image you are using:

29

Click Search for Image(s):

30

The minimum DRAM requirements for the IOS are displayed. Note the value for your IOS image:

31

Set the Default RAM value to the value recommended by the Cisco Feature Navigator (yours may be different to the screenshot) and click ‘Next’:

32

Select your preferred Network adapters. This is device dependant. With this c3725 image, we can only add adapters to slots 0, 1, and 2, with slot 0 prepopulated with GT96100-FE dual Fast Ethernet adapter. Which adapters you can add, and how many slots you are allowed to install adapters to is device dependent. Click ‘Next’:

33

WIC modules can now be added. Again, it’s device dependent on whether WIC slots are available, but WIC-1T and WIC-2T serial modules will be available on devices that support WICs. Once completed, click Click ‘Next’:

34

It is important for optimum GNS3 performance that an Idle-PC value be selected. If a green Idle-PC value is NOT shown then click the ‘Idle-PC finder’ button to find an Idle-PC value. This c3725 happens to already have an optimum idle-pc value predefined, so it’s OK to click ‘Finish’:

35

If your device does NOT have an idle-pc value predefined, click the Idle-PC finder button in the upper-right to initiate that process.

It is important for optimum GNS3 performance that an Idle-PC value be selected. If a green Idle-PC value is NOT shown then click the ‘Idle-PC finder’ button to find an Idle-PC value.

If you selected the Idle-PC finder button (only necessary if no value was detected automatically), GNS3 will calculate a value:

36

An Idle-PC value is displayed. Click ‘OK’ to complete:

37

If no Idle-PC value is displayed, try clicking the ‘Idle-PC finder’ button again. You may also need to reboot your computer and try again is no value is found.

Click ‘Finish’ to complete the GNS3 Setup Wizard.

The Preferences window displays showing the settings you have configured through the Setup Wizard. Click ‘OK’ to complete the process:

38

The New Project Window displays. Give your new Project a Name and click ‘OK’:

39

The GNS3 workspace displays:

40

Congratulations! You are now ready to create your first GNS3 topologies.

The Virtualbox developers announced that nested hardware virtualization support was added to Virtualbox 6.0 for desktops/laptops that have AMD CPUs and since 6.1 supports also Intel CPUs. Questions regarding Virtualbox should be directed Virtualbox user forums, and not the GNS3 community forums!

As of GNS3 2.2.3, the issue where users with AMD CPUs wanting to run the GNS3 VM in VMware Workstation needed to install a newer kernel has been resolved! It now works, like it did in past versions, so this workaround is no longer necessary.

Legacy#

In case anyone intends on using the older, affected version, We’ve left the instructions below. But it is highly recommended to update to the latest version.

(There’s potential risk of data loss, if this process goes awry! Proceed at your own risk!)

Start the GNS3 VM in VMware, while GNS3 itself is shut down. Access the GNS3 VM’s shell using its text menu. Click OK on the Information screen:

41

Press the down arrow to highlight “Shell”, and press the Enter key again:

42

You’ll now be in Bash (the default shell for Ubuntu): We need to upgrade the GNS3 VM’s kernel by entering the following in the CLI:

Источник

Как добавить виртуальную машину в gns3

beb926b2315e461d5dc5274a0e6bd3a3

Сегодня мы поговорим о том, как дополнить ваш домашний парк виртуальных машин cisco-роутером при помощи эмулятора GNS3.

Зачастую очень полезно иметь под рукой роутер, работающий на IOS для тестирования конфигурации или в качестве площадки для практики во время обучения.

Преимуществом перед использованием симулятора, вроде Cisco Packet Tracer, в том, что с GNS3 мы имеем роутер непосредственно в сети с нашими виртуальными машинами, и он является полноценным участником сети.

Сразу приведу ссылку на официальный сайт: www.gns3.com

Для данной статьи я использовал дистрибутив Ubuntu Server 16.04.1 LTS запущенный на VritualBox и GNS3 Version 1.5.2.
VirtualBox запущен под Windows.
Также вам понадобится ISO образ одного из cisco-роутеров. Я использовал образ роутера Cisco c3725.

Что мы хотим

У нас есть виртуальная машина Kali Linux и мы хотим иметь с нее доступ к cisco-роутеру по ssh. Также мы хотим получать от роутера cdp-пакеты и использовать протокол SNMP.

Установка

Установка из репозитария проходит достаточно просто и описана на официальном сайте.
Заключается она в добавлении репозитария GNS и установки из него пакетов.

sudo add-apt-repository ppa:gns3/ppa
sudo apt-get update
sudo apt-get install gns3-gui

после установки, GNS3 можно запустить командой gns3 (для запуска необходима графическая оболочка, я использовал LXDE)
В случае возникновения каких-то проблем, вы всегда найдете актуальную инструкцию на официальном сайте:

Настройка виртуальных машин

Для начала настроим наши виртуальные машины Kali Linux и Ubuntu Server для работы в одной сети.
Останавливаем машины.
Я хочу, чтобы они работали в виртуальной сети, недоступной для внешнего мира.
Для этого я использую тип подключения «Внутренняя сеть», имя можно оставить стандартное.

image1

То же саме делаем и для виртуальной машины с установленным GNS3. Следите, чтобы имя сети было тем же.

image2

Я считаю, что очень экономит время, когда в нашей внутренней сети IP адреса раздаются DHCP сервером. Это очень легко сделать при помощи VirtualBox.
Открываем cmd и выполняем команду

Если команда VBoxManage не распознается, значит, вы забыли прописать путь в переменной окружения PATH.

image3

Запускаем обе машины.
Проверяем, раздались ли IP адреса

image4
image5

# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.07 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.552 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.987 ms

Как видим, машины видят друг друга.

Запускаем GNS3

Пришло время добавить наш роутер в сеть. Запускаем gns3 на хосте Ubuntu server. После запуска выбираем Local, а не GNS3 VM. На вопрос о добавлении роутера отвечаем отрицательно.
Создаем проект.

image6
Заходим в настройки Edit=>Preferences
Будем загружать IOS образ. Выбираем IOS routers и жмем New
image7
Выбираем New image и жмем Browse, указываем iso файл с образом и жмем Оpen.
image8
Далее нам будет предложено изменить имя роутера, имя платформы, объем RAM. Все это можно оставить без изменения.
На странице с выбором Slot стоит выбрать доступный FE (Fast-Ethernet) модуль. У меня это модуль GT96100-FE
WIC-интерфейс не указываем. Idle-PC оставляем без изменений.
Жмем Finish и выходим из настроек GNS3.

На панели слева нажимаем большую кнопку Browse Routers и видим на панели Routers добавленный нами роутер.
image9

Хватаем и перетаскиваем его на поле справа

image10

Я оставил название без изменения – R1
Справа, в секции Topology Summary мы видим, что R1 горит красным, что означает, что наш роутер выключен. Скоро мы исправим это.

Настройка роутера в GNS3

Кликаем правой кнопкой на роутер и выбираем Start.

image11

Значок в Topology summary должен позеленеть. Наводим курсор на роутер и видим, что консольный порт у нас 5000

image12

Давайте подключимся к нему. Открываем консоль и выполняем

telnet 127.0.0.1 5000

получаем строку приглашения

image13

Давайте посмотрим, какие интерфейсы у нас доступны

R1#sh ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down

У нас есть два интерфейса, оба, пока, в выключенном состоянии.

Давайте включим интерфейс FastEthernet0/1 и присвоим ему IP из нашей подсети.

R1#config t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface fa0/1
R1(config-if)#ip addr
R1(config-if)#ip add 192.168.1.200 255.255.255.0
R1(config-if)#no shut
*Mar 1 00:05:23.983: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:05:24.983: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#end
R1#
*Mar 1 00:05:53.055: %SYS-5-CONFIG_I: Configured from console by console
R1#wr
Building configuration.
[OK]
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…

Проверим статус интерфейса

R1#sh ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 192.168.1.200 YES manual up up

Хорошо, интерфейс получил IP, но давайте взглянем на нашу топологию в GNS3

image14

Выглядит так, будто наш роутер никак не связан с чем-либо.
Так оно и есть. Интерфейсу присвоен IP, но сам интерфейс ни к чему не подключен.
Давайте исправим это недоразумение.
Добавляем в нашу топологию объект Cloud

image15

Нажимаем правой кнопкой и выбираем Configure.
Нам предлагается присвоить один из интерфейсов.
Generic Ethernet NIO отличается от Linux Ethernet NIO лишь реализацией на уровне кода (использованием библиотеки pcap или нет). Я выбираю Generic Ethernet NIO и добавляю адаптер, который подключен к виртуальной сети 192.168.1.0/24. Жмем ОК и выходим из режима редактирования.

image16

В левой части главного окна выбираем Add a link

image17

Курсор примет крестообразный вид.
Левой кнопкой мыши кликаем на облаке и выбираем интерфейс, далее кликаем на роутере и выбираем сконфигурированный нами FastEthernet 0/1
Должна получиться такая картина.

image18

На техническом уровне подключение к облаку, грубо говоря, равнозначно подключению роутера в коммутатор, к которому были бы подключены и наши виртуальные машины.
Давайте попробуем пропинговать наш роутер с Kali.

Не работает. Давайте разбираться, что происходит с нашими пакетами.
Для наглядности я запустил wireshark, чтобы посмотреть, что происходит при выполнении команды ping.
Как видим на скриншоте ниже, выполняется широковещательный ARP-запрос и ищется владелец IP-адреса 192.168.1.200.

image19

Сетевой интерфейс виртуальной машины Ubuntu server, получив такой пакет отвечает на его MAC-адресом cisco-роутера
MAC-адрес правильный, его мы можем проверить в конфигурации роутера R1.

image20

Так же сервер Ubuntu отвечает и на свой ARP запрос по IP 192.168.1.1

image21

Получается что-то вроде виртуальных интерфейсов в Linux-системах.
Если запустить wireshark на Ubuntu server, мы не увидим никаких пакетов, кроме широковещательных ARP-запросов и CDP-пакетов.

image22

image23

Перезапускаем виртуальную машину.
Пробуем пропинговать снова.
Работает! Wireshark так же указывает нам, что приходят ICMP-ответы

image24

Настройка доступа по SSH

Мы настроим доступ по SSH и активируем SNMP, чтобы убедиться в том, что наш роутер не только виден в сети, но и ведет себя как настоящий.

Теперь наш роутер доступен для сети 192.168.1.0/24
Просканировав порты nmap, мы видим, что открыт доступ по telnet

Это не очень безопасно, так что лучше заменить telnet на SSH.
Подключаемся к роутеру с Ubuntu Server и настраиваем.

R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip domain name cisco.vbox
R1(config)#crypto key generate rsa
The name for the keys will be: R1.cisco.vbox
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]: 2048
% Generating 2048 bit RSA keys, keys will be non-exportable. [OK]
*Mar 1 00:05:53.339: %SSH-5-ENABLED: SSH 1.9 has been enabled
R1(config)#service password-encryption
R1(config)#username user privilege 15 password Pa$$w0rd
R1(config)#aaa new-model
R1(config)#line vty 0 4
R1(config-line)#transport input ssh
R1(config-line)#logging synchronous
R1(config-line)#exec-timeout 60 0
R1(config-line)#privilege level 15
R1(config-line)#exit
R1(config)#ip ssh version 2
R1#wr
R1#copy running-config sta
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration.
[OK]

Снова сканируем nmap

Подробнее можно прочитать тут:

Активация SNMP

CDP-пакеты вы уже могли видеть на скриншотах wireshark, так что осталось лишь настроить SNMP.
Логинимся на роутер по SSH.

R1>sh snmp
%SNMP agent not enabled

Как видим, SNMP не настроен.
Настраиваем.

R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#snmp-server community public RO
R1(config)#snmp-server community private RW
R1(config)#exit
R1#wr
R1# copy running-config startup-config
R1>sh snmp
R1#sh snmp
Chassis: FTX0945W0MY
0 SNMP packets input
0 Bad SNMP version errors
0 Unknown community name
0 Illegal operation for community name supplied
0 Encoding errors
0 Number of requested variables
0 Number of altered variables
0 Get-request PDUs
0 Get-next PDUs
0 Set-request PDUs
0 Input queue packet drops (Maximum queue size 1000)
0 SNMP packets output
0 Too big errors (Maximum packet size 1500)
0 No such name errors
0 Bad values errors
0 General errors
0 Response PDUs
0 Trap PDUs
SNMP Trap Queue: 0 dropped due to resource failure.
SNMP logging: disabled

Проверяем открыт ли теперь 161 порт

Порт доступен и мы можем работать с роутером по протоколу SNMP.

Заключение

При помощи GNS3 можно создавать гораздо более сложные топологии, подключать ваши виртуальные роутеры к реальным сетям и Интернет. Применений можно найти массу. GNS3 доступна не только для Linux, но и для Windows и MAC.

Спасибо за внимание и до новых встреч!

Оставить комментарий Отменить ответ

Для отправки комментария вам необходимо авторизоваться.

Источник

Оцените статью
AvtoRazbor.top - все самое важное о вашем авто