wjlovezzd 发表于 2018-3-16 09:57:07

3.EVE-NG导入Dynamips和IOL(转)

Dynamips导入过程一、查看EVE的地址,并用SFTP工具连接(本文以SecureFX为例)http://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602561588.pnghttp://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602561496.png二、上传镜像文件到相应目录镜像保存目录:/opt/unetlab/addons                           —/dynamipsDynamips镜像保存目录                           —/iol            IOL镜像保存目录(运行IOU的镜像)                           —/qemu      QEMU镜像(运行ASAv、ISE、F5等等镜像)
将dynamips镜像上传到/opt/unetlab/addons/dynamips目录下http://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602561684.png三、修正镜像权限用SSH登录到EVE,运行如下命令/opt/unetlab/wrappers/unl_wrapper -a fixpermissionshttp://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602561714.png
注意:有可能您的机器跑Dynamips后CPU利用率非常高,计算idlepc后利用率会降到最低,此处就先不介绍idlepc计算方法了,今后如各位有需要再补充!个人觉得,有了vios和iol后,dynamips就没必要使用了!如果各位有兴趣,进QQ群:593920308(EmulatedLab)获取idle值计算方法!
IOL导入过程一、上传镜像到相应目录
与IOL有关的文件包含IOL的镜像iourc文件(IOL的license文件)CiscoIOUKeygen.py(python脚本,用于生成license)
将如上文件全部上传到/opt/unetlab/addons/iol/bin目录下http://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602561893.png二、生成并编写license第一种方法:命令自动生成确保CiscoIOUKeygen.py已经上传后,执行命令cd /opt/unetlab/addons/iol/bin/
python CiscoIOUKeygen.py | grep -A 1 ‘license’ > iourc
生成license代码http://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602562540.jpg第二种方法:手动修改生成license代码root@eve-ng:~#cd /opt/unetlab/addons/iol/bin
root@eve-ng:/opt/unetlab/addons/iol/bin# ls
CiscoIOUKeygen.py
i86bi-linux-l2-adventerprisek9-15.1a.bin
i86bi-linux-l2-ipbasek9-15.1a.bin
i86bi-linux-l2-upk9-12.2.bin
i86bi-linux-l2-upk9-15.0a.bin
i86bi-linux-l3-adventerprisek9-12.4.bin
i86bi-linux-l3-adventerprisek9-15.2.2.15T.bin
i86bi-linux-l3-adventerprisek9-15.2.4M1.bin
i86bi-linux-l3-adventerprisek9-15.4.1T.bin
iourc
root@eve-ng:/opt/unetlab/addons/iol/bin# python CiscoIOUKeygen.py
*********************************************************************
Cisco IOU License Generator – Kal 2011, python port of 2006 C version
Modified to work with python3 by c_d 2014
hostid=007f0101, hostname=eve-ng, ioukey=7f0343
Add the following text to ~/.iourc:

eve-ng = 972f30267ef51616;
You can disable the phone home feature with something like:
echo ‘127.0.0.127 xml.cisco.com’ >> /etc/hosts
root@eve-ng:/opt/unetlab/addons/iol/bin#红色字体即IOL的license,这段代码随着EVE-NG的hostname变动,hostname不同,计算的结果也不同。
编写license文件安装vim(确保EVE联网)apt-get updateapt-get install vimroot@eve-ng:/opt/unetlab/addons/iol/bin# vim iourchttp://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602561918.png把原来的删除掉,重新粘贴新的license代码:wq! 保存退出三、修正镜像权限运行如下命令/opt/unetlab/wrappers/unl_wrapper -a fixpermissions运行镜像测试不会的朋友请看历史文章,不做详细介绍用web界面登录并添加设备,这时候能看到Cisco IOS与Cisco IOL几项已经被点亮。http://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602562077.png选择一个Cisco IOS 7206VXR和一个Cisco IOL做测试http://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602562124.pnghttp://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602562248.pnghttp://www.emulatedlab.com/wp-content/uploads/2017/06/2017072602562349.pnghttp://www.emulatedlab.com/wp-content/uploads/2017/06/201707260256248.png
已经通了!此处有必要说一下,以前用GNS3时Dynamips与IOL的设备中间直连会报错,中间必须增加一个GNS3自带的二层交换机才能正常通信。而EVE-NG不需要~~~

如未注明,均为原创,版权归EmulatedLab所有!转载请注明出处,否则追究法律责任!

andyzhang209 发表于 2018-7-9 11:37:12

那么请问,哪里才能下载到CiscoIOUKeygen.py 呢?

jacques95 发表于 2018-11-28 16:37:29

受教了,感谢感谢。

appleokgogmail 发表于 2018-12-24 12:18:37

andyzhang209 发表于 2018-7-9 11:37
那么请问,哪里才能下载到CiscoIOUKeygen.py 呢?

#! /usr/bin/python
print "\n*********************************************************************"
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)
# 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('!L', ioukey) + iouPad1
iouLicense=hashlib.md5(md5input).hexdigest()[:16]
# add license info to $HOME/.iourc
print "\n*********************************************************************"
print "Create the license file $HOME/.iourc with this command:"
print " echo -e '\\n" + hostname + " = " + iouLicense + ";'" + " | tee $HOME/.iourc "
print "\nThe command adds the following text to $HOME/.iourc:"
print "\n" + hostname + " = " + iouLicense + ";"
# disable phone home feature
print "\n*********************************************************************"
print "Disable the phone home feature with this command:"
print " grep -q -F '127.0.0.1 xml.cisco.com' /etc/hosts || echo '127.0.0.1 xml.cisco.com' | sudo tee -a /etc/hosts"
print "\nThe command adds the following text to /etc/hosts:"
print "127.0.0.1 xml.cisco.com"
print "\n*********************************************************************"



存到記事本,另存成CiscoIOUKeyGen.py檔

connor 发表于 2019-6-22 21:39:20

我导入镜像之后只点亮了Cisco IOL一项,点开Cisco IOL里面的image有好多,全在里面了,这是怎么回事?

yxezzwzp 发表于 2021-4-6 14:38:32

dddd咕咕咕咕咕咕过。
页: [1]
查看完整版本: 3.EVE-NG导入Dynamips和IOL(转)