PNETlab IOL image

PNETlab IOL image 사용

  1. image 가 저장되는 경로
    cd /opt/unetlab/addons/iol/
  2. image 사용을 위한 코드 입력
    /opt/unetlab/wrappers/unl_wrapper -a fixpermissions
  3. 본인 host의 iourc 파일 찾기
    해당 경로의 python 파일 실행
    python CiscoIOUKeygen.py
    
    *********************************************************************
    Cisco IOU License Generator - Kal 2011, python port of 2006 C version
    hostid=4b8638f8, hostname=name, ioukey=x
    
    *********************************************************************
    Create the license file $HOME/.iourc with this command:
    
    The command adds the following text to $HOME/.iourc:
    [license]
    hostname = xxf70048422db6;
    
    *********************************************************************
    Disable the phone home feature with this command:
     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
    
    The command adds the following text to /etc/hosts:
    127.0.0.1 xml.cisco.com
    
    *********************************************************************
    
    
  4. 편집기를 사용해 iourc 파일 변경
    vi iourc 또는 nano iourc
    
    [license]
    hostname = xxf70048422db6;
    
    python 실행 후 생성된 내용 추가
    꼭 본인 hostname 입력
  5. 자동으로 iourc 파일 생성 스크립트
    import os
    import socket
    import hashlib
    import struct
    
    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:])
    
    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]
    
    f = open("iourc", "w")
    f.write("[license]\n" + hostname + " = " + iouLicense + ";\n")
    f.close()
    
    print("iou license file (iourc) is created ")