cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
830
Views
0
Helpful
7
Replies

DevNet Always-On IOS XE Sandbox.- HOW TO GET INTO LINUX INTERPRETER ?

mal0304
Level 1
Level 1

I am following the "Coding and API Fundamentals" DevNet study material Lesson.
I am told to use the  DevNet Always-On IOS XE Sandbox to follow the example shown in that Lesson.
Below is a fragment of the code being shown in that Lesson:
!
 >>> import requests
>>> HOST = 'ios-xe-mgmt.cisco.com'
>>> USER = 'developer'
>>> PASS = 'C1sco12345'
!-------- truncated for brevity --------

I can reach the privilege & config mode as shown below...
csr1000v-1#
csr1000v-1(config)#
!----------------------------------
How do I enable bash shell so that I can access the Linux interpreter?

7 Replies 7

@mal0304 i am confused by your question here you have have posted two things. The first is the image and snip of python code, this code is meant to be ran from your local host/machine to the XE sandbox to update an interface details. This python script is not meant to be ran on the device itself.

If you are interested in Guestshell on XE, see this link here https://developer.cisco.com/docs/ios-xe/#!on-box-python-and-guestshell-quick-start-guide

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Bigevilbeard,
Thanks for your insights.
You are right, I had two different questions.
1- How to enable bash shel and linux interpreter in the XE  sandbox.

2- Where to run code provided in the learning material. The code is NOT to be run in the box itself.
Thanks for your clarification. 

No problem! The link i provided should enable you to configure the sandbox for Guestshell, there are some steps you need to take to enable connectivity between the guest shell, which is a container and the IOS XE. 

I would also take a look at setting up your local env here - https://developer.cisco.com/learning/modules/dev-setup/ having this set up correctly for running any other code you will encounter in your studies.

Hope this helps!

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Thanks again.
Something I came across in my own host when trying to run the code in the documentation (the snippet I sent earlier as an attachment) is a connection timeout.  After looking for possible url typo errors and finding none, I tried to run the url in my browser. No help.  Still timeout.  Finally I resolved the host ip by doing a nslookup to the host url => 131.226.217.149.
Then I tested if I could connect to the host using my putty....The result suggests the password might have been changed...see below:
!-----------------------------------------------------------
login as: developer
Keyboard-interactive authentication prompts from server:
| Password:
End of keyboard-interactive prompts from server
Access denied
Keyboard-interactive authentication prompts from server:
| Password:
End of keyboard-interactive prompts from server
Access denied
Keyboard-interactive authentication prompts from server:
| Password:



 

Finally I decided to reach the host 

I have to correct what I said earlier about SSH to the host. 
The result I showed earlier was from a SSH session using the default port 22. Using the port 9443 as specified in the Lab exercise, the connection times out as well (I do not even get a prompt from the host).  No idea what the problem could be... 

@mal0304 I just looked at your code/host again. From what I recall that sandbox was retired and replaced with https://devnetsandbox.cisco.com/RM/Diagram/Index/7b4d4209-a17c-4bc3-9b38-f15184e53a94?diagramType=Topology or https://devnetsandbox.cisco.com/RM/Diagram/Index/27d9747a-db48-4565-8d44-df318fce37ad?diagramType=Topology 

If you update your code to point to one of these devices and update the username/password you should be good.

Edit: also check the port in the sandbox details I would have thought this would be 443

Hope this helps!

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

mal0304
Level 1
Level 1

Joyce,
Thanks for suggestion.
However, I noticed that you do not need to be in config mode to run "guestshell run bash to enable the Linux interpreter.
Privilege mode should be good enough to run the command. See snnipet below.   
However, even though the command is allowed in privilege mode, there is another error as stated below, but that is a different issue.

!--------------------------------------------------------------------------------------------------------------

csr1000v-1(config)#guestshell ?
% Unrecognized command
csr1000v-1(config)#guestshell
!--------------------------------------------------------------------------------------------------------

csr1000v-1#guestshell ?
destroy Disable and uninstall the guest shell service package
disable Disable the guest shell service package
enable Enable the guest shell service
portforwarding Port forwarding through iptables
run Execute/run program in the guest shell
<cr> <cr>

csr1000v-1#guestshell run ?
LINE Linux executable command string, eg: bash, python

csr1000v-1#guestshell run bash
Error, guestshell is in disabled state, execute 'guestshell enable' before attempting this CLI
csr1000v-1#

csr1000v-1#guestshell enable ?
<cr> <cr>

csr1000v-1#guestshell enable
Interface will be selected if configured in app-hosting
Please wait for completion
% Error: No interface configuration for guestshell