[Python] Cisco IOU License invalid for GNS3

Discussão em 'Python' iniciado por Stack, Abril 20, 2025.

  1. Stack

    Stack Membro Participativo

    I am using GNS3 on VMWare Fusion to create Cisco topology with L2 and L3 devices. I am unable to start the devices. I keep getting the error that the IOU license is invalid. Used this Python script to create the license:

    #!/usr/bin/env python3
    import socket
    import hashlib
    import struct

    print("*********************************************************************")
    print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version")
    print("Modified to work with python3 by c_d 2014")

    # Use a manual hostid value, or generate one based on hostname
    hostname = "gns3vm"
    hostid = "hostid" # replaces with the hostid of my VM
    ioukey = int(hostid, 16)

    for x in hostname:
    ioukey += ord(x)

    print(f"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' * 32

    # Fix: use '!I' to support unsigned int
    md5input = iouPad1 + iouPad2 + struct.pack('!I', ioukey) + iouPad1
    iouLicense = hashlib.md5(md5input).hexdigest()[:16]

    print("\nAdd the following text to ~/.iourc:")
    print(f"[license]")
    print(f"{hostname} = {iouLicense};")


    Got the result of this code as:

    [license]
    gns3vm = xxxxxxxxxxxxxxxx; # instead of x I have the license


    Uploaded it to the GNS3 but it says invalid.

    What Am I doing wrong?

    Continue reading...

Compartilhe esta Página