- IOS-XE Versions 16.6 and above come with Guest Shell.
- Guest Shell is a virtualized CentOS environment.
- Ultimately a container managed through Cisco’s IOx.
- Enabling and Working with Guest Shell
Once IOx is enabled, we need to configure network interface settings for the guest shell. We will first create a Virtual Port Group that will act as the gateway for guest shell. The port group will need to NAT traffic outbound for the virtual environment to reach the outside world (or just to reach IOS-XE).
Once NAT and gateway configuration has been completed, the vNIC settings will be configured under the app-hosting appid guestshell.
And last but not least, the command to enable Guest Shell:
Once the enable command has succeeded, the command ‘guestshell’ is all it takes to reach the linux prompt.
The Guest Shell will out of the box have Python2.7 installed. In Python you can create scripts with vim, specifically with the ‘cli’ module, to interact with the command line. Below is a basic script that will display a show ip int brief.
Once exited out of the Guest Shell and on our typical IOS-XE CLI prompt, you can run this script with the following:
Once it’s confirmed the command ‘guestshell run python’ will work from IOS-XE, it’s very simple to use EEM for a python script to run after specific events happen.