Devnet-1695 (2018)
Devnet-1695 (2018)
How
1. Find this session in the Cisco Live Mobile App
2. Click “Join the Discussion”
3. Install Spark or go directly to the space
4. Enter messages/questions in the space
cs.co/ciscolivebot#DEVNET-1695
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Agenda
• Introduction
• Enabling Guest Shell
• Accessing Guest Shell
• Installing and Running Applications
• Wrap Up
How Did I Get Here?
It Started with a Simple Question:
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 5
Why would I run apps in the network?
Current Application Challenges
Not enough network bandwidth Data Reduction
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 7
Empowering the Edge – Leverage the Network!
• Existing hardware
footprint Business
Applications
Management Analytic
• No need for IoT
Systems
machinery
• Integrated security
• Reduced latency &
bandwidth cost
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 8
Network Application Hosting Spectrum
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 9
Network Application Hosting Spectrum
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 10
What is Cisco IOx?
•
platforms
A compute platform, Linux
+
application framework, and
software development kit +
Cisco IOS
• Manage life cycle aspects of
applications
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 11
What is Cisco UCS Express
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 12
What is Guest Shell and Why do I care?
What is the Guest Shell?
Network OS
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 14
What is the Guest Shell?
• Maintain host system integrity
• Isolated user space
• Fault isolation
• Resource isolation
• Access to bootflash Linux
applications
• On-box rapid prototyping
Guest Shell
• Integrate into existing Linux
workflows Open Application Container
API
Network OS
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 15
Cisco Guest Shell Capabilities
Guest Shell 1.0 (Lite) Guest Shell 1.0 Guest Shell 2.1
Platforms CAT 3650, CAT3850 CAT 9000, ISR 4000 Nexus 3000, 9000
Python 2.7 ✓ ✓ ✓
Python 3.0 ✗ ✓ ✓
RPM Install ✗ ✓ ✓
OVA Enable/Upgrade ✗ ✗ ✓
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 16
ISR 4000 Guest Shell Support
ISR 4221 ISR 4321 ISR 4331 ISR 4351 ISR 4431 ISR 4451
Default/Max DRAM 4 GB 4 GB / 4 GB / 4 GB / 4 GB / 4 GB /
8 GB 16 GB 16 GB 16 GB 16 GB
✗ ✓ ✓ ✓ ✓ ✓
Guest Shell Support
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 17
Enabling the Guest Shell
Enabling Guest Shell
Task Overview
• Enable IOX on the device
• IOX is the manager that handles guest shell and other 3rd party applications in IOS-XE
• Configure the Virtual Port Group and NAT Statements
• The Virtual Port Group is the interface the device uses to communicate with guest shell
• The device provides access to off-box resources through a NAT
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 19
Step 1: Enabling IOX
DEVNET-1695#conf t • IOx is the manager handling application
DEVNET-1695(config)#iox hosting in IOS-XE
DEVNET-1695(config)#exit
DEVNET-1695#
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 20
Step 2: Create the Virtual Port Group
conf t • Configuration only valid on routing platforms
interface VirtualPortGroup 0
ip add 192.168.35.1 255.255.255.0 • Used to provide network connectivity to the
no shut Guest Shell
exit
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 21
Step 3: Create NAT Entry
conf t • Configuration only valid on routing platforms
interface VirtualPortGroup0
ip nat inside • Used to NAT traffic from Guest Shell off box
• Example: to access Internet resources
! Interface connected to local network (ex.: code repository)
interface GigabitEthernet1
ip nat outside • Inbound access to the Guest Shell
requires additional NAT configuration
ip access-list standard NAT_ACL
permit 192.168.0.0 0.0.255.255
• Alternative to using NAT is to advertise the
ip nat inside source list NAT_ACL \* Virtual-Port Group into the routing domain
interface GigabitEthernet1 overload
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 22
Step 4a: Enable the Guest Shell
• Virtual-Port Group and IP address only
! Entered from Enable Mode
needed on routing platforms
! Command is entered on a single line
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 26
Direct Access to the Guest Shell
DEVNET-1695#guestshell run bash
• Log into the Guest Shell by running
[guestshell@guestshell ~]$ pwd ‘guestshell run bash’
/home/guestshell
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
echo "Welcome to DEVNET-1695"
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 27
Setting Up Name Resolution
[guestshell@guestshell ~]$ cat /etc/resolv.conf
nameserver 208.67.222.222 • DNS can be pushed into the Guest Shell as
part of the ‘guestshell enable’ command.
[guestshell@guestshell ~]$ ping pool.ntp.org • Does not add the DNS server to
PING pool.ntp.org (104.131.139.195) 56(84) bytes of data.
64 bytes from acheron.bitsrc.net • Note: Guestshell in NX-OS must
(104.131.139.195): icmp_seq=1 ttl=62 time=111 ms explicitly configure within /etc/resolv.com
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
Accessing the CLI from the Guest Shell
• ‘dohost’ command built into Guest Shell
• Send commands directly to the router
• Limited to exec privilege commands. No access to config mode.
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 29
Install and Run Applications
Installing Applications within Guest Shell
• YUM • Git
• Package manager for Linux • Installed via yum
systems. • Access code from GitHub and
• Install, update and remove other repositories
applications • Useful for distribution of custom
• ’repos’ or file repositories applications.
[guestshell@guestshell ~]$ sudo yum install git
Loaded plugins: fastestmirror
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
git x86_64 1.8.3.1-6.el7_2.1 base 4.4 M
Installed:
git.x86_64 0:1.8.3.1-6.el7_2.1
Complete!
[guestshell@guestshell ~]$ git –version
git version 1.8.3.1
Output edited for brevity and clarity
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 31
Install and Run Applications
Application Examples
• MTR – Combines ping and traceroute. Tracks response time and reachability
over time.
• Launch custom apps from IOS-XE based Embedded Event Manager applets
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 33
MTR
Application Examples
• Combines the function of traceroute and ping into a single tool.
• Probes routers over time and tracks response times.
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 34
tcpdump
Application Examples
• IOS-XE has a built-in packet capture but depending on the size the capture
finding data can be difficult
• tcpdump is a well known Linux tool that can view the exported packet capture
csr1kv#guestshell run sudo tcpdump -qns 0 -X -r flash:BUFF.pcap
The run command has been modified to: sudo tcpdump -qns 0 -X -r /flash/BUFF.pcap
reading from file /flash/BUFF.pcap, link-type EN10MB (Ethernet)
13:55:27.533968 IP 10.0.2.15.ssh > 10.0.2.2.56095: tcp 96
0x0000: 45c0 0088 b82e 0000 ff06 ea70 0a00 020f E..........p....
0x0010: 0a00 0202 0016 db1f 8a2a a4c3 0e72 f907 .........*...r..
0x0020: 5018 0f20 976c 0000 dcea ead2 ab06 36fa P....l........6.
0x0030: 8dd4 f5a4 f0ed aa16 9bb3 43e8 5961 bab8 ..........C.Ya..
0x0040: a220 269a a6b5 0072 edd3 f22e 291f be27 ..&....r....)..'
0x0050: 8318 6847 9429 7a5a 4aa3 b4c3 c643 2d63 ..hG.)zZJ....C-c
0x0060: 5f99 085a 846c 804d 4610 fe84 02e2 c5d1 _..Z.l.MF.......
0x0070: 1cbe e42f 1a36 4472 1fe6 6b61 c19d b2d8 .../.6Dr..ka....
0x0080: 4ed2 bbf3 3460 e6af N...4`..
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 35
Extending Application Support Through Python
Application Examples
http://www.python.org/
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 36
Using Python with IOS-XE Devices
Application Examples • IOS-XE “Off-Box” Python
IOS-XE “On-Box” Python
External Python
Python
Execution Environment
Python SSH/NETCONF
IOS-XE Device
IOS
IOS IOS-XE Device
• scripts executed locally on switch or router • scripts executed externally from switch or
• Ideal for: router
• provisioning automation (ZTP) • Ideal for:
• automating Embedded Event Manager • configuration management automation
responses • telemetry / operational data
• application development • controller use cases including APIC-EM /
• IOT Cisco Network PNP
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 37
Using Python with IOS-XE
Use Case Example – “Are you sure nothing has changed on the network?”
• By leveraging a combination of EEM and On-Box Python the router can notify
when the configuration has been modified.
• Python script posts
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 38
Cisco Spark
Questions?
Use Cisco Spark to communicate
with the speaker after the session
How
1. Find this session in the Cisco Live Mobile App
2. Click “Join the Discussion”
3. Install Spark or go directly to the space
4. Enter messages/questions in the space
cs.co/ciscolivebot#DEVNET-1695
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Please complete your Online Complete Your Online
Session Evaluations after each
session
Session Evaluation
• Complete 4 Session Evaluations
& the Overall Conference
Evaluation (available from
Thursday) to receive your Cisco
Live T-shirt
• All surveys can be completed via
the Cisco Live Mobile App or the
Communication Stations
Don’t forget: Cisco Live sessions will be available
for viewing on-demand after the event at
www.ciscolive.com/global/on-demand-library/.
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Continue Your Education
• Demos in the Cisco campus
• Walk-in Self-Paced Labs
• Tech Circle
• Meet the Engineer 1:1 meetings
• Related sessions
DEVNET-1695 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 41
Thank you