Acesse o arquivo de licença e altere o conteúdo de acordo com o código abaixo:
# vi /opt/unetlab/addons/iol/bin/CiscoIOUKeygen.py
#! /usr/bin/python
print("*********************************************************************")
print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version")
print("Modified to work with python3 by c_d 2014")
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")
print("You can disable the phone home feature with something like:")
print(" echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n")
lic = ["[license]\n" + hostname + " = " + iouLicense + ";" + "\n"]
f = open('/opt/unetlab/addons/iol/bin/iourc','w')
f.writelines(lic)
f.close()
Nota: O script acima pode ser adquirido no link.
Testar a licença Cisco. Caso o resultado abaixo aparece igual, a licença esta aplicada corretamente.
# python3 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=pnetlab, ioukey=7f03e7
Add the following text to ~/.iourc:
[license]
pnetlab = b126e08dae13e962;
You can disable the phone home feature with something like:
echo '127.0.0.127 xml.cisco.com' >> /etc/hosts
Confira se a licença informada anteriormente esta aplicada no arquivo iourc, caso esteja correto pode pular este passo.
# cd /opt/unetlab/addons/iol/bin
# vi iourc
[license]
pnetlab = b126e08dae13e962; <- validar se a licença e a mesma do CiscoIOUKeygen.py
Caso ajustado o arquivo acima aplique a permissão com o comando abaixo:
# unl_wrapper -a fixpermissions
Nota: pode ser usada a interface gráfica para fixar as permissões.