Monday, May 11, 2015

My virtual GNS3 lab

For most of my experiments I use great program GNS3. Recently I switched from legacy 0.8, included in most distributions, to modern branch version 1.3. It was difficult in the beginning to figure out how to install it but once I made it, things became much easier. New features, like auto discovery of IdlePC for any Cisco router saves a lot of time, and ability to move server to another machine is really helpful. Here I would like to describe my lab and task I use it for.



Personally I use GNS3 in distributed mode, moving server to dedicated host in my home lab. Actually, it is just a common desktop PC with installed Ubuntu Server. It allows me to save a lot of resources on my laptop for Chromium, which is extremely hungry for memory, and I google a lot during work.

My server configuration is nothing special: it is Intel-i3-2120 CPU with 8Gb of DDR3 RAM and 500Gb of hard drive. Not too powerful, many people have their desktop with better characteristics. When I built it I had a task to create a cheapest server possible and this one provides me with what I requested. It is able to emulate a LOT of 7200 routers as they eat almost no CPU and RAM. However, for CCNP Service Provider certification I need to play more with XR and XE IOS, and these require much more resources than legacy 7200.

For example, one instance of XR requires around 1.4 Gb of RAM and constantly consume about than 1-10% of one core during its work:

CPU%  MEM%  VIRT   RES   PID USER       Command 
 1.6  17.8 3.69G 1.33G  3372 bashioo    /usr/bin/qemu-system-x86_64 -name XR-1

So, on this hardware I am able to run maximum up to 4 instances simultaneously, which is quite enough. To double the number of XR routers I just need to double the size of RAM.

XE routers, on the other hand, are much worse regarding required resources:

CPU%  MEM%  VIRT   RES   PID USER       Command 
47.9  36.4 3.69G 2.72G  3318 bashioo    /usr/bin/qemu-system-x86_64 -name XE-2

As it can be seen, one instance of it running consumes 2.7Gb of RAM and about 50% of one of 4 cores of my CPU. I don't know what it is thinking about but it is probably something really important, as CPU load never drops below 50%. Therefore I am limited with maximum of 2 instances, again as a limitation of available RAM.

Of course I need to use XR and XE together in some topologies, so I can have 1 x XE plus 2 x XR plus a dozen of good old 7200, which is good enough for most of scenarios.

For emulation of XR and XE I use qemu, as it allows to share the same image between instances, support kvm acceleration and can utilize all 4 cores for single VM if required. To activate these features for my XR and XE virtual machines I use advanced options in GNS3:

-nographic -machine accel=kvm -smp 4

One of the problems though, is that I am unable to start topology containing 2 XE or 4 XR routers at once. They will just fight over CPU and will never boot. I need to start each instance one by one and wait for in to boot, as all of them are extremely hungry for CPU during startup process.

Another problem is a consequence of distributed architecture. Simple click on "Capture this link" do not work anymore, as .pcap is created on server, and wireshark expects to see it on local machine. Of course there are more than one solution for that: mounting remote directory containing .pcap to local system, or piping tail command from server through ssh into local socket. They both work for sure but it is not as convenient as it was before.

No comments:

Post a Comment