Network: GNS3

В любом случае всегда надо помнить что l2 в той или иной мере забагован. Это как полная деградация трафика до перезагрузки (при том что визуально проблем нет), так и, к примеру, различные трейсбеки.

Эмуляция VoIP
Для работы с VoIP можно поднять Cisco Unified Communications Manager Express (CUCM/CME, telephony-service, SKINNY Client Control Protocol SCCP over TCP Server port 2000) на базе сервера в виде роутера Cisco типо с3725 и клиентов в виде софтфонов Cisco IP phone (Cisco IP Communication), которые получают по DHCP адрес этого сервера и взаимодействуют с ним. Пример из курса Wireshark: Packet Analysis and Ethical Hacking: Core Skills.



Posted on January 5, 2018 November 5, 2023 Author weril Categories Uncategorized
Leave a Reply Cancel reply
You must be logged in to post a comment.
RX-TX
GNS3 — эмулятор устройств Cisco, в отличии от Packet Tracer он требует наличие IOS образов и более требователен к ресурсам компьютера, но в месте с тем позволяет создавать лабораторную среду максимально приближенную к настоящей. Скачать последнюю версию всегда можно здесь.
После установки заходим в меню «Редактировать» — «Образы IOS и гипервизоры», добавляем те образы которые будем использовать. Далее важно настроить параметр IDLE PC, так чтобы GNS3 не выбирал все процессорное время нашего компьютера и позволял комфортно работать. Самый удобный способ сделать это в автоматическом режиме, для этого необходимо:
- Выбираете router, для которого надо определить Idle PC, перетягиваете его на рабочую область;
- Запускаете работу роутера по нажатию кнопки Start;
- Запускаете Console;
- Нажимаете в ней Enter, если просит;
- Вводите en;
- Ждете минут 5-10 — время необходимо для выбора оптимального параметра IDLE PC;
- Закрываете Console;
- Не останавливая router, нажимаете Idle PC, ждете появления небольшого окошка и выбираете значение, отмеченное звездочкой (*). Их может быть несколько.
Idle pc gns3 что это
Firstly let me say thanks to Jeremy Grossmann (principal programmer for GNS3) for helping me finally get my head around this concept. I have to admit that I’d I had only a vague idea of what was happening when I wrote this post on the GNS3 forum, but recently I decided I had to nail it.
In a nutshell:
Without an Idle-PC set, dynamips attempts to emulate instructions one at a time as fast as it can, consuming up to 100% of the available CPU.
The Idle-PC is a guess at where the Program Counter might be pointing to an idle-loop in the emulated router.
When emulator has visits this PC value Idle-Max times, it suspends itself for Idle-Sleep ms to allow other processes to get on their tasks.
Details
To understand the dynamips/GNS3 Idle-PC concept, you have to start by looking at the way software operates.
A normal piece of software generally has one or more places in the code where the program just sits in an “idle” loop – say waiting for a key press. Or a message to arrive. Or for a timer to expire to remind it to send a message.
However dynamips is a different kind of program. It is an emulator. It takes a binary image of MIPS machine code and interprets each instruction one at a time and then executes that instruction on the host computer. The basic logic is something like this:
Set the program counter (PC) to 1 Repeat forever
So there are no idle states – dynamips just screams through those instructions one at a time around and around – except that there will be many, many places where the instruction that is executed is one that changes the program counter, causing dynamips to extract the instructions in a non-linear sequence.
And some of those instructions will be be in little groups where the emulated router is sitting in an idle state – as in waiting for a packet to arrive or a key to be pressed at the console. The problem is, dynamips has no idea whether the current Program Counter (PC) is pointing to an instruction that is doing something important, or one that is just part of the few instructions that get repeated over and over in an idle loop.
Now if dynamips could somehow know that when the Program Counter (PC) was pointing to a certain pice of code that was just an idle loop, it could suspend itself for a while, so the logic would change to:
Repeat forever < Fetch MIPS instruction number PC Emulate it on the host computer Increment the Program Counter (PC++) IF the new PC is pointing to an idle loop < THEN have a sleep and let the host computer get on with something else ELSE continue >>
But dynamips has no way of knowing “IF the new PC is pointing to an idle loop” – because dynamips cannot predict future instructions nor understand them. This makes it impossible to optimise the executed code like compilers do or to know if the instructions are worth being executed.
So we make some guesses at when the Program Counter MIGHT be executing an idle loop. We call this value the Idle-PC value.
If we guess at a place where the emulated router spends a lot of idle time, then the host computer gets lots of chances to get on with other stuff. If we guess a PC (remember PC=Program Counter) where the code is only executed rarely, then the host computer will spend 100% of its CPU executing the dynamips simple loop.
Since every Cisco router image has a different set of instructions, these idle lops will be in different places on different images. But once a good Idle-PC has been found for one image, it should be good for all emulations of that image – no matter whether you are running your dynamips on a Windows computer, and OS X Macintosh, a Linux box or an iPad :J
The only other issue then, is how long and low often should dynamips sleep for when it has found the PC for the idle loop? This is where the Idle-Max and Idle-Sleep values found under the Advanced settings of the GNS3 IOS images and hypervisors dialogue come in. (Note: This feature was added to GNS3 in version 0.8.4)
Dynamips doesn’t go to sleep EVERY time the PC hits the Idle-PC. It waits until it has hit the Idle-PC Idle-Max times before sleeping for Idle-Sleep ms. That way the router still gets a chance to do the things it needs to do between visits to the Idle-PC value. If you adjust the Idle-Max too low or the Idle-Sleep too high, your emulated routers will slow to a crawl, they will loose connections with their neighbours and bad things will happen. However some folk have had good success at playing with these numbers.
To summarise:
Without an Idle-PC set, dynamips attempts to emulate instructions one at a time as fast as it can, consuming up to 100% of the available CPU.
The Idle-PC is a guess at where the Program Counter might be pointing to an idle-loop in the emulated router.
When emulator has visits this PC value Idle-Max times, it suspends itself for Idle-Sleep ms to allow other processes to get on their tasks.
Remember, if you found this post helpful, you can make it easier for others to find by giving it a good rating, or by clicking on one of the sharing options.
Создание сети с выходом в Интернет в среде GNS3 на Windows 10
GNS3 (Graphical Network Simulator) — это графический симулятор сети, который позволяет смоделировать виртуальную сеть из маршрутизаторов и виртуальных машин. Незаменимый инструмент для обучения и тестов. Работает практически на всех платформах. Отлично подходит для создания стендов на десктоп машинах.
В зависимости от аппаратной платформы, на которой будет использоваться GNS3, возможно построение комплексных проектов, состоящих из маршрутизаторов Cisco, Cisco ASA, Juniper, а также серверов под управлением сетевых операционных систем.
GNS3 имеет два серьёзных недостатка:
- Сильно требователен к CPU и памяти. 10 маршрутизаторов уже всерьёз нагрузят ПК. Использование процессора можно снизить с помощью механизма Idle PC. Без этого и 3-4 с трудом бы, пожалуй, пошли.
- Очень слабо поддерживает функции L2. Есть только подобие коммутаторов, на которых можно максимум настроить Access/Trunk порты и свичовые платы для маршрутизаторов, L2-функционал которых также очень ограничен.
Окно программы и его структура представлены ниже.

Так как задача выходит за пределы моделирования сети внутри эмулятора, нам необходимо подготовить операционную систему к дальнейшему взаимодействию с GNS3. Для этого нам необходимо настроить сеть, взаимодействующую с GNS3, а не с внешними протоколами передачи данных. Все сети, которые подключены к вычислительной машине направлены на передачу файлов вне её системы. Машина переводит файлы в биты, собирает их в пакеты, помечает и отправляет по протоколу TCP/IP в сеть. Принимающая машина взаимодействует не с сеть, а с переданным пакетом. Она распаковывает его всё по тому же протоколу TCP/IP и предоставляет файл пользователю через свою файловую систему. Наша задача – пустить трафик таким образом, чтобы компьютер смоделировал сеть внутри себя и проанализировал ответ на свой же запрос в сети. Задача не из простых, но есть и усложняющий факто – Wi-Fi. Кабельные сети легко построить на эмуляторе, как и беспроводные, а эмулировать сеть, которая работает по определённым принципам упрощения передачи – это уже не так просто. Для решения поставленной задачи создадим loop-back adapter. Это сеть, которая обращается сама к себе. Чтобы создать loop-back сеть в Windows Win+R и введём hdwwiz.exe


Нажимаем кнопку «Далее» и выбираем пункт «Установка оборудования, выбранного из списка вручную». Сразу оговорюсь, что я в данной лабораторной работе использовал операционную систему Windows 10 (64 бита), так как она является последней и самой актуальной.

Нажимаем кнопку «Далее» и выбираем пункт «Сетевые адаптеры»

Нажимаем кнопку «Далее» и в левом меню выбираем компанию Microsoft, а в правом – «Адаптер замыкания на себя Microsoft KM-TEST»

Далее выполняем установку и переходим в настройки адаптера. Для этого переходим «Пуск» -> «Панель управления» -> «Сеть и Интернет» -> «Центр управления сетями и общим доступом» -> «Изменение параметров адаптера».
Далее нам необходимо настроить систему так, чтобы наша lookback сеть имела доступ в Интернет. Для этого переходим в свойства беспроводной сети и во вкладке «Доступ» ставим галочки на «Разрешить другим пользователям сети использовать подключение к Интернету данного компьютера» и на «Разрешить другим пользователям сети управлять общим доступом к подключению к Интернет». В случае если у Вас несколько сетей выберете созданную нами замкнутую сеть, так как с другими сетями способ работать не будет.

Если Вы сделали всё правильно, то у Вас должно быть две сети с такими расшифровками:

В моём случае «Беспроводная сеть 2» — это сеть Wi-Fi, а «Ethernet 3» -это замкнутая сеть.
Подготовительная работа с системой окончена. Я не буду рассказывать как установить ISO образы на GNS3, так как у каждого пользователя свои версии и в каждой системе устойчивы свои роутеры. Я использовал версию 0.87 и роутер c3660, так как в моей версии это самый устойчивы маршрутизатор.
Перетаскиваем на рабочую область роутер и облако, чтобы получилась схема как на рисунке ниже

Настроим облако. Перейдя во вкладку NIO Ethernet (Network Input Output Ethernet) выбираем нашу замкнутую сеть и нажимаем кнопку «Add», а затем ОК.

Соединяем облако и роутер кабелем FastEthernet и запускаем роутер нажатием на зеленую кнопку «Play».
Настроим роутер. Введём последовательность команд:
conf t int fa 0/0 no shut ip address dhcp ip domain-lookup
Разберём каждую команду.
conf t (Режим глобальной конфигурации)
int fa 0/0 (Режим конфигурирования интерфейса)
no shut (команда включения интерфейса)
ip address dhcp (указывает, что интерфейс получает IP-адрес через DHCP)
ip domain-lookup (разрешения имён хостов на IP-адреса и наоборот)
Осталось проверить есть ли подключение к сети Интернет. Для этого пропингуем любой сайт. Например, гугл.

Как видно на скрине, всё работает.
Дополнительно прикреплю дамп настроек роутера, так как процедура оказалась сложнее, чем кажется на первый взгляд.
Connected to Dynamips VM "R1" (ID 0, type c3600) - Console port Press ENTER to get the prompt. This product contains cryptographic features and is subject to United States and local country laws governing import, export, transfer and use. Delivery of Cisco cryptographic products does not imply third-party authority to import, export, distribute or use encryption. Importers, exporters, distributors and users are responsible for compliance with U.S. and local country laws. By using this product you agree to comply with applicable laws and regulations. If you are unable to comply with U.S. and local laws, return this product immediately. A summary of U.S. laws governing Cisco cryptographic products may be found at: http://www.cisco.com/wwl/export/crypto/tool/stqrg.html If you require further assistance please contact us by sending email to export@cisco.com. Cisco 3660 (R527x) processor (revision 1.0) with 124928K/6144K bytes of memory. Processor board ID FTX0945W0MY R527x CPU at 250MHz, Implementation 40, Rev 1.2, 512KB L2 Cache 3660 Chassis type: ENTERPRISE 2 FastEthernet interfaces DRAM configuration is 64 bits wide with parity enabled. 125K bytes of NVRAM. 8192K bytes of processor board System flash (Read/Write) SETUP: new interface FastEthernet0/0 placed in "shutdown" state SETUP: new interface FastEthernet0/1 placed in "shutdown" state Press RETURN to get started! *Mar 1 00:00:03.091: %LINEPROTO-5-UPDOWN: Line protocol on Interface VoIP-Null0, changed state to up *Mar 1 00:00:03.183: %SYS-5-CONFIG_I: Configured from memory by console *Mar 1 00:00:03.319: %LINEPROTO-5-UPDOWN: Line protocol on Interface IPv6-mpls, changed state to up *Mar 1 00:00:03.463: %SYS-5-RESTART: System restarted -- Cisco IOS Software, 3600 Software (C3660-A3JK9S-M), Version 12.4(15)T14, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 17-Aug-10 11:00 by prod_rel_team *Mar 1 00:00:03.467: %SNMP-5-COLDSTART: SNMP agent on host R1 is undergoing a cold start *Mar 1 00:00:03.491: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down *Mar 1 00:00:03.503: %CRYPTO-6-GDOI_ON_OFF: GDOI is OFF *Mar 1 00:00:03.507: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is OFF *Mar 1 00:00:03.507: %CRYPTO-6-GDOI_ON_OFF: GDOI is OFF *Mar 1 00:00:03.507: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is OFF *Mar 1 00:00:03.543: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down *Mar 1 00:00:04.491: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down *Mar 1 00:00:04.543: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down R1# R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#int fa 0/0 R1(config-if)#no shut R1(config-if)# *Mar 1 00:00:45.887: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up *Mar 1 00:00:46.887: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up R1(config-if)#ip address dhcp R1(config-if)# *Mar 1 00:01:13.071: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.137.31, mask 255.255.255.0, hostname R1 R1(config-if)#ip domain-lookup R1(config)#^Z R1# *Mar 1 00:02:15.551: %SYS-5-CONFIG_I: Configured from console by console R1#ping google.ru Translating "google.ru". domain server (192.168.137.1) [OK] Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 173.194.73.94, timeout is 2 seconds: . Success rate is 100 percent (5/5), round-trip min/avg/max = 28/35/44 ms R1#