Here’s a structured technical guide for converting a Cisco .bin image (typically an IOS or IOS-XE firmware) into a qcow2 disk image, suitable for use in KVM/QEMU (like GNS3, EVE-NG, or standalone QEMU).
qemu-img create -f qcow2 "$QCOW2_FILE" "$DISK_SIZE"
.bin file expects specific hardware identifiers. You may need to pass CPU flags to QEMU, such as -cpu host or specific NIC models (e.g., e1000 or virtio)..pkg, .trust) are preserved.sudo parted /dev/nbd0 mklabel msdos sudo parted /dev/nbd0 mkpart primary ext4 1MiB 100% sudo mkfs.ext4 /dev/nbd0p1
Converting to QCOW2 offers three distinct advantages over running raw BIN files or using legacy wrappers: convert cisco bin to qcow2
1. Snapshot Capability
This is the "killer feature." With a .bin file, if you misconfigure a router, you must reload the image. With a QCOW2 image running on KVM, you can take an instant snapshot of the VM state.
2. Efficient Storage (Copy-On-Write) QCOW2 only stores changes made to the disk.
ios-17-base.qcow2).3. Hypervisor Agnosticism Once converted, the image is no longer tied to GNS3 or Cisco hardware. It can be imported into: Here’s a structured technical guide for converting a Cisco
To perform the conversion, the following environment and tools are required:
qemu-utils (specifically qemu-img).binwalk (for firmware analysis and extraction).unzip, gzip, squashfs-tools (for filesystem extraction)..bin file (e.g., c7200-adventerprisek9-mz.152-4.S6.bin).Some Cisco images require extraction:
Use unzip or tar if applicable:
tar -xvf image.bin
Extract vmlinuz and iosxe-rootfs.
Then create qcow2 with those two files + GRUB pointing to kernel + initrd.
Cisco’s IOS on Linux (IOL) images (usually .bin files for L2/L3) run natively on Linux using a wrapper called i86bi_linux. These can be converted to .qcow2 using a chroot jail. Create empty qcow2 qemu-img create -f qcow2 "$QCOW2_FILE"