Test V1 – GNS3 + KVM On Fedora 33

Wouhou Fedora 33 + GNS 3 = 333 (half devil)

As I am a returning student, I have projects to do and for my third one, I needed GNS3 to emulate network. My different options where:

  • to install Windows ?!? WinWhat ? Let’s be serious for once
  • to Debian or Ubuntu or whatever user friendly linux distro
  • finding a way to use and test my brand new Fedora 33

Obviously, I chose, from my point of view, the least bad idea, so we’ll install GNS3 working with KVM (and we’ll try Docker in a future post) on the Fedora 33

sudo dnf install gns3-server gns3-gui

If you want to use GNS3, you need dynamips:

sudo dnf install cmake elfutils-libelf-devel libpcap-devel 
sudo mkdir -p /opt/addSoft/
sudo chown $(whoami):$(whoami) /opt/addSoft/
cd /opt/addSoft/
git clone git://github.com/GNS3/dynamips.git
cd dynamips
mkdir build
cd build
cmake ..
sudo make install

No path to vpcs? oopsy daisy. Don’t panic, let’s install it (we’re going to install VPCS from github because as I write these lines, the package is sucks and using the terminal, it’s typing every 2 characters)

cd /opt/addSoft/
git clone https://github.com/GNS3/vpcs.git
cd vpcs/src
sh ./mk.sh
chmod +x vpcs
sudo cp vpcs /usr/local/bin/

It’s time to configure the terminal, I use gnome terminal, to do this, go to
Edit/Preferences/Console applications Click on Edit and chose your Terminal

Wouhouu we can use GNS3 and Qemu and use cisco appliances?!? You can do what you want, personally I flashed my cisco router to use openwrt instead.

Now, let’s install and configure virt-manager to manage KVM VMs:

sudo yum install virt-viewer virt-manager libvirt

If you are a super cool person, you can switch off virt-manager and use virsh, but let’s be serious. I only use virsh to debug my hypervisor and if I don’t have my personal laptop (you can configure several remote hypervisors in virt-manager, see below)

sudo usermod -aG libvirt $(whoami)
sudo usermod -aG qemu $(whoami)

Well, we still have 2 small manipulations to do, first, we have to tell SElinux that we want to use the virtual machines in the GNS3 image folder as a standard VM.

sudo chcon -R --reference=/var/lib/libvirt/images /home/$(whoami)/GNS3/images/QEMU

In virt-manager we can add a directory for the GNS3 Qemu folder or, if we only use GNS3, we can change the default folder by changing the XML. First, go to Edit/Settings and activate Enable XML Editing. Then, in connection details/Storage, shut down the default storage, go into the XML and change /var/lib/livirt/images to /home/YourUserName/GNS3/images/QEMU and restart the Storage.

It’s Alive

Now let’s go back to GNS3 and configure the VM terminal (Spice or VNC). Remember, I made you install vier-viewer, it’s time to configure it the same way as the terminal but in the Spice and VNC tabs:

We are almost there. There’s just a little problem with user rights for VMs, and every time you create a new template, you have to change the VM user from qemu to you.

sudo chown $(whoami) ~/GNS3/images/QEMU/*

Now you can insert the stopped vm in VM in GNS3 🙂 (click on the 5th icon from top)

During config, chose qemu-kvm, it may take some time before you can choose the existing images, because the md5 is not present. Then, edit and change the hard drive controller from ide to virtio and choose how many network card you want, ram, etc.

Ah, if you want to make changes in your VM, start virt-manager, and, when you’re done and turn off the VM, you can reload the changes into your GNS3 appliance by right-clicking on its name and choosing “refresh template” and reinsert it into your project. Now the next level will be Docker on Fedora 33 but, because of cgroupv2 and rootless containers, this will be hard to do… mmmh yeah!