Wednesday, 6 March 2013

GNS3 on Android

Having just received my new Nexus 4, what is the first question I should ask of it's quad-core snapdragon prowess?  That's right, will GNS3 work on it?  The answer is yes, yes indeed: you can emulate Cisco IOS on your smartphone.  And whilst I'm sure no-one will give the slightest hint of a monkey, here is an overview.

First you need to install Linux.  There are some pretty good apps for this, I'm using Complete Linux Installer as found in the Google Play store.  It will advise you to follow-up and install a terminal emulator and VNC client.  It is not a bad app; it will offer you the choice to install a number of distros, though if I'm honest my attempts at Ubuntu 10 failed, as did Debian.  The Ubuntu 12 image worked a treat.  Download that and unpack it to /sdcard/ubuntu.  As seen below. (Pointless screenshot, but I just discovered Ice Cream Sandwich has native screenshot built-in, so everything was being captured...)

So while you are downloading the Ubuntu image (in the working version I actually used Ubuntu 12) you can install Android Terminal Emulator and Android VNC Viewer.  Both great apps in their own right.

Once this is all installed you can run the Linux application and then configure it.  Tip: donate.  If you donate you will receive a key to open some extra options, most importantly setting the screen resolution.  The default resolution desktop looks pretty small on the Nexus 4 screen, the donation is worth it.  But anyway, here is a screenshot post-donation:

Next you will be given the option to launch the image, I advise you to press it.  Great!  Hop over to the terminal emulator and you will see you Linux device kick-starting.  You will need to enter in a new password, then basically that is that.  You are off.  As so:

This might be a good point to test network connectivity, as I needed to install a few more packages on the virtual machine to get GNS3 up and running (not least GNS3 itself).  Now, there is no reason this shouldn't work as the Linux system is a chroot image mounted in Android, so as long as your Android has network then so should your image.  But anyway, pings are great things, never miss an opportunity:

Ok, tickety boo, so next step is to open your VNC viewer and point it at localhost:5900 using the distro password ("ubuntu" - in this instance).  Lo and behold, a desktop will appear!  On the Nexus I found a resolution of 1280x768 was ok, though it needs slightly more tweaking, it was just good enough at the time.

Next, using the complicated VNC tools (you will just have to experiment, trust me) open up a terminal to install some packages.  I needed these packages:

sudo apt-get install gns3
sudo apt-get install telnet
sudo apt-get install konsole

The first is to obviously install GNS3 from the Ubuntu repos.  The second is to enable GNS3 telnet to the virtual router.  The third is to install konsole, as I was having real problems (or lazy solutions) getting xterm to work.  

Once all this is in place, don't forget GNS3 is nothing without root privilages.  Edit the shortcut command to read either: gksudo gns3 or in the case of the LXDE desktop I required gksu gns3  There are explanations on the net for this...

Now the application as root, otherwise = pain in the arse, it won't work very well.

Now GNS3 is actually running you can feel joy.  This is a good time to reflect on the fact and say to yourself, "GNS3 is running on my frikking smartphone!!".  Try not to fall over when the Dynamips connection tests ok - this is almost it, the last barrier.  Add in an IOS image which you can acquire via t'internet somehow, I use a 3700 image which has almost all the options I need to practice.

Finally you really need to mess around and get the terminal settings correct.  As I say, contrary to the below I ended up installing konsole and using the built-in GNS3 command.  The internet is full of alternatives if you wish.  Well, not full per se, but there are options, however it is fiddly on the smartphone and I'm all for path-of-least-resistance.

Giddy with excitement you can drag over a router and start it up.  If not giddy then at least be mildly amused.

Finally, console to your device.  I was really pleased to have emulated a Cisco router on my smartphone, I don't know exactly how practical it is, perhaps if you do a lot of public transport and like tiny screens (in addition to hating tablets/laptops) then this could be the solution for you. Otherwise it is pure gimmick.

Anyway, point proven, you can exit it by typing "exit" on the terminal emulator (below) and unlikely you will ever use it again.

Thanks for reading.  Really, if you  made it to the end, thanks.  Leave a comment, feel free!