Страницы

28 июня 2018 г.

EVE-NG. Добавление образов Cisco IOU/IOL и генерация лицензии

Загрузить имеющиеся образы в EVE-NG, используя, FileZilla или WinSCP в каталог
/opt/unetlab/addons/iol/bin/

Образы IOL должны обязательно заканчиваться расширением «.bin» и быть исполняемыми. 
Ввести команду для исправления разрешений:
/opt/unetlab/wrappers/unl_wrapper -a fixpermissions

Лицензия (файл iourc) должна храниться там же где расположены образы.
Если лицензии нет, то при запуске образа получим сообщение:

root@eve-ng:/opt/unetlab/addons/iol/bin# D_LIBRARY_PATH=/opt/unetlab/addons/iol/lib /opt/unetlab/addons/iol/bin/L2-ADVENTERPRISEK9-M-15.2-20150703.bin 1
***************************************************************
IOS On Unix - Cisco Systems confidential, internal use only
IOU License Error: invalid license
License for key 7f0343 required on host "eve-ng".
Obtain a license for this key and host from the following location:
http://wwwin-enged.cisco.com/ios/iou/license/index.html
Place in your iourc file as follows (see also the web page
for further details on iourc file format and location)
[license]
eve-ng = <16 char license>;

После загрузки файлов IOL необходимо выполнить python скрипт для генерации лицензии, которая позволит эмулировать IOU/IOL образы.

В каталоге /opt/unetlab/addons/iol/bin/ создать файл script.py и скопировать в него код приведенный ниже:

#! /usr/bin/python
#print "*********************************************************************"
#print "Cisco IOU License Generator - Kal 2011, python port of 2006 C version"
import os
import socket
import hashlib
import struct
# get the host id and host name to calculate the hostkey
hostid=os.popen("hostid").read().strip()
hostname = socket.gethostname()
ioukey=int(hostid,16)
for x in hostname:
 ioukey = ioukey + ord(x)
print "hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2:]
# create the license using md5sum
iouPad1='\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A'
iouPad2='\x80' + 39*'\0'
md5input=iouPad1 + iouPad2 + struct.pack('!i', ioukey) + iouPad1
iouLicense=hashlib.md5(md5input).hexdigest()[:16]
print "\nAdd the following text to ~/.iourc:"
print "[license]\n" + hostname + " = " + iouLicense + ";\n"
print "You can disable the phone home feature with something like:"
print " echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n"

В консоли EVE-NG перейти в каталог /opt/unetlab/addons/iol/bin
Запустить скрипт командой python2 script.py

При успешном выполнении скрипта получим что-то вроде этого:

root@eve-ng:/opt/unetlab/addons/iol/bin# python2 script.py
hostid=007f0101, hostname=eve-ng, ioukey=7a0353
Add the following text to ~/.iourc:
[license]
eve-ng = 972f34529ef51616;
You can disable the phone home feature with something like:
 echo '127.0.0.127 xml.cisco.com' >> /etc/hosts

Теперь необходимо открыть файл iourc и прописать в него полученный лицензионный ключ:

nano /opt/unetlab/addons/iol/bin/iourc 

[license]
eve-ng = 972f34529ef51616;

Если все было сделано верно, то при выполнении команд:
cd /opt/unetlab/addons/iol/bin
touch NETMAP
LD_LIBRARY_PATH=/opt/unetlab/addons/iol/lib /opt/unetlab/addons/iol/bin/<iosname.bin> 1

Образ должен запуститься:

root@eve-ng:/opt/unetlab/addons/iol/bin# D_LIBRARY_PATH=/opt/unetlab/addons/iol/lib /opt/unetlab/addons/iol/bin/L2-ADVENTERPRISEK9-M-15.2-20150703.bin 1
***************************************************************
IOS On Unix - Cisco Systems confidential, internal use only
              Restricted Rights Legend
Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.
           cisco Systems, Inc.
           170 West Tasman Drive
           San Jose, California 95134-1706
Cisco IOS Software, Linux Software (I86BI_LINUXL2-ADVENTERPRISEK9-M), Version 15.2(CML_NIGHTLY_20150703)FLO_DSGS7, EARLY DEPLOYMENT DEVELOPMENT BUILD, synced to DSGS_PI5_POSTCOLLAPSE_TEAM_TRACK_CLONE
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2015 by Cisco Systems, Inc.
Compiled Sat 04-Jul-15 01:30 by mmen
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.

Linux Unix (Intel-x86) processor with 150372K bytes of memory.
Processor board ID 1
8 Ethernet interfaces
8 Serial interfaces

16K bytes of NVRAM.