[Cisco][GNS3]Install IOU device in GNS3

1. 下載並安裝GNS3

  下載位置 https://gns3.com/software

  安裝 gns3-all-in-one

  部屬GNS3 VM至virtualbox

  下載並安裝VIX API https://www.vmware.com/support/developer/vix-api/,重啟GNS3 GUI

2. 新增一個文件命名為"CiscoIOUKeygen3f.py",內容新增下列程式碼,上傳CiscoIOUKeygen3f.py至GNS3 VM中的/opt/gns3/images/IOU/目錄下, 

#! /usr/bin/python3
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 = b'\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A'
iouPad2 = b'\x80' + 39*b'\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")
with open("iourc.txt", "wt") as out_file:
   out_file.write("[license]\n" + hostname + " = " + iouLicense + ";\n")
print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAlready copy to the file iourc.txt\n ")

print("You can disable the phone home feature with something like:")
print(" echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n")

3. 在GNS3 VM中執行此程式

cd /opt/gns3/images/IOU/
python3 CiscoIOUKeygen3f.py

4. 下載iourc.txt,並導入至gns3 GUI中

  edit -> preferences -> IOS on UNIX

  browse -> 找到iourc.txt並匯入再應用

5. 新增IOU設備

  edit -> preferences -> IOS on UNIX -> IOU Devices

  new -> "Run this IOU device on the GNS3 VM" ->

  

   name this device -> select image -> finish

  

 6. 新增設備至GNS3 GUI 中

  

猜你喜欢

转载自www.cnblogs.com/jbite9057/p/12230272.html