Do you know that Cisco IOS has evolved? Do you know that you can run applications on your Cisco router?? Do you know this doesn’t involve any additional license ??
Well………!! all this is true and very exciting. You must try the new guesshell available on Cisco routers .It gives immense power to you and your device.
Until now Cisco router IOS was very restrictive for obvious reasons that the router is designed for routing/forwarding and as long as it is doing that, you do not think of doing anything extra on these critical network devices. But this is not something that can please an evolutionary mind, hence the change!!! Cisco has decided to move all of their product to the operating system which can provide more interfaces to user/network admins so that they can play around if they want to. Now the challenge was to give something to users which can help them in their daily job, and can also market well. Also the challenge was to provide customers a working solution which they can run, touch , feel, understand etc . All these things boiled down to something called Container platforms. Cisco has integrated container capability to its devices (check Cisco website for current supported platforms). There are platform like ISR 4k where you can run applications like waas, so now you do not need to buy any other appliance or software for web caching its all just on your router.Then there are other products which cannot run applications for now but they still have basic guesshell support. Now the Guestshell gives you capability like executing/writing/compiling a python code , it also provides you bash shell .
In this blog we are going to see the method to enable guestshell on Cisco asr1001-HX router. And also we would see that with the help of this guestshell how we can execute a trigger based EEM + python script. So lets get started…
Platform : ASR1001-HX Software : asr1000-universalk9.16.06.06.SPA.bin
In order to enable guestshell you need to enable IOx on the router, the router must support IOx. Cisco IOx enables the hosting capability on Cisco router. It integrates Cisco IOS and Linux capabilities on the router. Following is the commands that you need to enable to run guestshell on the router.
Router(config)#iox Router(config)#app-hosting appid guestshell Router(config-app-hosting)#vnic management guest-interface 0
Once the above is done we need to enable guestshell with following command but you may see following message when you put the command.
Router#guestshell enable Interface will be selected if configured in app-hosting Please wait for completion The process for the command is not responding or is otherwise unavailable
So as the message says just wait for around 5 mins and then again try to enable it.
Router#guestshell enable Interface will be selected if configured in app-hosting Please wait for completion guestshell started successfully Current state is: RUNNING Guestshell enabled successfully
Now our guestshell is enabled on the router. Following are few verification commands which we can use to see if everything is enabled correctly.
Router#show iox-service Virtual Service Global State and Virtualization Limits: Infrastructure version : 1.7 Total virtual services installed : 0 Total virtual services activated : 0 Machine types supported : LXC Machine types disabled : KVM Maximum VCPUs per virtual service : 1 Resource virtualization limits: Name Quota Committed Available -------------------------------------------------------------- system CPU (%) 80 0 80 memory (MB) 4096 0 4096 bootflash (MB) 2000 0 2000 IOx Infrastructure Summary: --------------------------- IOx service (CAF) : Running IOx service (HA) : Not Running IOx service (IOxman) : Not Running Libvirtd : Running
Here we can see that Iox is running fine now we can run python or bash shell on the router.
Router#guestshell run python Python 2.7.5 (default, Jun 17 2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> print "this is python 2.7.5 prompt" this is python 2.7.5 prompt
Another better way to get into python is via bash, this is very similar to your linux machine.
Router#guestshell run bash [guestshell@guestshell ~]$ python Python 2.7.5 (default, Jun 17 2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>>
In my next posts on guestshell we will install applications and run python codes with the help of it.
Thank you for visiting, stay tuned!! Do not forget to rate follow this blog if you found it helpful.