Type "help", "copyright", "credits" or "license" for more information. Below I give a show how we can use them send commands to IOS and process the ~]$ python
Note… if your environment requires Proxy Servers to access the internet, you will need to configure them within Guest Shell as well as DNS.Īlright, we are all set and ready for some Python Magic!Īs Guest Shell is based on Cent OS 7, it comes with Python 2.7.5 ~]$ python -versionĪlong with Guest Shell, a few Python libraries are included for interacting with the underlying IOS platform.
# Test to see if things are working by using pip to install ~]$ sudo -E pip install requestsĭownloading requests-2.13.0-py2.p圓-none-any.whl (584kB)ġ00% |#| 593kB 610kB/s Here I use Open ~]$ echo "nameserver 208.67.222.222" | sudo tee -append /etc/nf # Use echo to add your DNS Server to the file.
We do this by setting them within “/etc/nf” just like a typical Linux OS. To do anything of real interest, you need to tell Guest Shell what DNS servers to use. Step 3: Setup Guest Shell for Network Access - DNS Management Interface will be selected if configured It will take a few minutes to finish the startup procedure. The HA service may not start on all platforms.įrom enable mode, you can now start the Guest Shell. It should take only a few minutes for IOX start up. Virtual Service Global State and Virtualization Limits: Before we can jump into doing something interesting with Python, we need to get Guest Shell up and running.Įnter configuration commands, one per line. The router was recently upgraded to 16.5 and has little other configuration in place. In fact the feature within IOS-XE is modeled after how it works within NX-OS so much of what we’ll look at here applies to NX-OS as well!Įnough talk… let’s get into some config and code! For this blog post I am using an ISR 4431 running 16.5.1b.
Guest Shell is isolated from the underlying host software to prevent interference of the core network functions of the device.Īnd I can’t go any further without mentioning that though a new feature to IOS-XE, Open NX-OS has offered Guest Shell and Python for awhile now. From within Guest Shell you and your applications have access to the networks of the host platform, bootflash, and IOS CLI.
On the ISR 4000 platforms, Guest Shell provides a CentOS 7 environment in which you can install and run applications, such as Python scripts. GuestShell is a containerized Linux runtime that can be enabled on your IOS-XE device. We’ll go deeper into GuestShell on another day, but for now it is important to understand just some of the basics.
The ability to execute Python code directly on an end device is a part of the Application Hosting capabilities provided by GuestShell. In future blog posts I’ll dive deeper into all of these features, but today we’re going to look at the new Python execution capabilities. Future software releases will extend features to other platforms. Note: Not all IOS-XE platforms support all features in release 16.5.