Using guestfish to modify VM disk image

EarIier I wrote about some ways to modify VM disk images used by Unetlab. Basically it boils down to running a VM, console to it and change things through its shell. Obviously, this approach is no way near a handy way to do small changes like:

  • loading basic config
  • adding license files

In this post I will talk about guestfish utility which is a part of libguestfs tools set. With guestfish one could easily get a shell-like access to the filesystem located on a disk image (qcow2, vmdk, iso and many others). That is how authors of libguestfs tools describe it:

libguestfs is a set of tools for accessing and modifying virtual machine (VM) disk images. You can use this for viewing and editing files inside guests, scripting changes to VMs, monitoring disk used/free statistics, creating guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting disks, resizing disks, and much more.

libguestfs can access almost any disk image imaginable. It can do it securely — without needing root and with multiple layers of defence against rogue disk images. It can access disk images on remote machines or on CDs/USB sticks. It can access proprietary systems like VMware and Hyper-V.

To demonstrate the way how guestfish works I will solve a particular task of adding a license file to Nokia (Alcatel-Lucent) 7750 Virtual Service Router (VSR) by embedding it to the disk image itself. Tune in!


How to get rid of VNC and use telnet access for your Linux image?

We are, network engineers, have many *nix tools at our disposal: exaBGP, nmap, tcpdump, to name a few. And with UNetlab its very easy to run a linux system inside a topology (not to mention that you could use cloud pnet interface to bridge unetlab topology with the real world). By default UNetLab’s linux template opts to VNC access, which is cool if you have a GUI, but for a networker – CLI is the only love. In this post I will share with you a method to get telnet access to a linux image inside the UNetLab.

All credits go to my colleague – Anatoliy Kolpakov.


Adding Spirent Virtual Test Center traffic generator to Unetlab


Having a traffic generator in a lab is a huge advantage, hands down. As to this moment Unified Networking Lab supports software-based traffic generator called Ostinato. But I had an opportunity to use another traffic generator – Spirent Test Center, virtual edition.

Spirent’s images are not officially integrated/supported by UNL, so you will see how to add something that is not supported yet by Unetlab.


How to run Juniper vMX in UNetLab


Juniper offers its brilliant MX routers for virtual environments – namely vMX. And we cant name ourselves engineers if we wouldn’t try to run one in the Unetlab. Running vMX in the unetlab is a simple task, yet I see many complaints about vMX not working. With this being said I invite you to a journey called “running vMX in Unetlab. Painless edition”.


How to permanently change qemu’s qcow2 image?


Of course you heard of qemu. Its a hypervisor used by UNetLab and GNS3 to integrate virtual routers like Alcatel-Lucent’s 7750 SR, Junipers vMX and Cisco’s XRv. And it is well-known that those virtual routers come in the form of qemu disk images with an odd  qcow2 extension. But how can we alter those disc images if we need, for example, preconfigure and distribute an image with some interfaces configured, or got system name changed or even upload a license file?

I invite you to acquire this useful knowledge under the cut section.

ADD: I wrote another post on how to do this stuff automatically with libguestfs tools.


Unified Networking Lab for Nokia (Alcatel-Lucent), Juniper, Cisco and many more…


A long time ago in a galaxy far, far away engineers hunted eBay for used routers to meet their demand for home labbing. Rack-rental services were kings and an ability to run cisco ios under dynamips felt like pure magic. Those dark days are gone… Thanks to massive eruption of virtualization technologies.

In this topic I will introduce you to Unified Networking Lab (UNL) – web-based tool which is capable to run so many images in a so convenient way that you might read this whole topic with your jaw opened.

Want to know how to run Cisco, Juniper, Alcatel-Lucent, F5, Vyatta, Mikrotik and dozens of other networking OSes? You came to the right place.

This post is the most popular one at this blog, it outstands other topics by far and the reason is simple — UNL is a solid tool that helped many of us to reach our goals and it was completely free.

At this moment UNL team is looking for our help in their pursuit of making a better product — EVE-NG — which is an evolution of UNL and has a lot of planned improvements and new features. For a complete list of features and a demo of EVE refer to their campaign on Indiegogo.

We are community, we help each other.