b-application-hosting-configuration-guide-asr9000
b-application-hosting-configuration-guide-asr9000
Americas Headquarters
Cisco Systems, Inc.
170 West Tasman Drive
San Jose, CA 95134-1706
USA
http://www.cisco.com
Tel: 408 526-4000
800 553-NETS (6387)
Fax: 408 527-0883
THE SPECIFICATIONS AND INFORMATION REGARDING THE PRODUCTS IN THIS MANUAL ARE SUBJECT TO CHANGE WITHOUT NOTICE. ALL STATEMENTS,
INFORMATION, AND RECOMMENDATIONS IN THIS MANUAL ARE BELIEVED TO BE ACCURATE BUT ARE PRESENTED WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. USERS MUST TAKE FULL RESPONSIBILITY FOR THEIR APPLICATION OF ANY PRODUCTS.
THE SOFTWARE LICENSE AND LIMITED WARRANTY FOR THE ACCOMPANYING PRODUCT ARE SET FORTH IN THE INFORMATION PACKET THAT SHIPPED WITH
THE PRODUCT AND ARE INCORPORATED HEREIN BY THIS REFERENCE. IF YOU ARE UNABLE TO LOCATE THE SOFTWARE LICENSE OR LIMITED WARRANTY,
CONTACT YOUR CISCO REPRESENTATIVE FOR A COPY.
The Cisco implementation of TCP header compression is an adaptation of a program developed by the University of California, Berkeley (UCB) as part of UCB's public domain version of
the UNIX operating system. All rights reserved. Copyright © 1981, Regents of the University of California.
NOTWITHSTANDING ANY OTHER WARRANTY HEREIN, ALL DOCUMENT FILES AND SOFTWARE OF THESE SUPPLIERS ARE PROVIDED “AS IS" WITH ALL FAULTS.
CISCO AND THE ABOVE-NAMED SUPPLIERS DISCLAIM ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THOSE OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE.
IN NO EVENT SHALL CISCO OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, OR INCIDENTAL DAMAGES, INCLUDING, WITHOUT
LIMITATION, LOST PROFITS OR LOSS OR DAMAGE TO DATA ARISING OUT OF THE USE OR INABILITY TO USE THIS MANUAL, EVEN IF CISCO OR ITS SUPPLIERS
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network
topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional
and coincidental.
All printed copies and duplicate soft copies of this document are considered uncontrolled. See the current online version for the latest version.
Cisco has more than 200 offices worldwide. Addresses and phone numbers are listed on the Cisco website at www.cisco.com/go/offices.
Cisco and the Cisco logo are trademarks or registered trademarks of Cisco and/or its affiliates in the U.S. and other countries. To view a list of Cisco trademarks, go to this URL:
https://www.cisco.com/c/en/us/about/legal/trademarks.html. Third-party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a
partnership relationship between Cisco and any other company. (1721R)
© 2016–2024 Cisco Systems, Inc. All rights reserved.
Date Summary
December 2024 Republished for Release 24.4.1
• To get the business results you’re looking for with the technologies that matter, visit Cisco Services.
• To discover and browse secure, validated enterprise-class apps, products, solutions and services, visit Cisco DevNet.
• To obtain general networking, training, and certification titles, visit Cisco Press.
• To find warranty information for a specific product or product family, access Cisco Warranty Finder.
Cisco Bug Search Tool (BST) is a web-based tool that acts as a gateway to the Cisco bug tracking system that maintains a comprehensive list of defects and vulnerabilities in Cisco products
and software. BST provides you with detailed defect information about your products and software.
© 2016–2024 Cisco Systems, Inc. All rights reserved.
CONTENTS
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
v
Contents
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
vi
Contents
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
vii
Contents
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
viii
Changes to This Document
This table lists the technical changes made to this document since it was first released.
Date Summary
December 2024 Republished for Release 24.4.1
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
ix
Changes to This Document
Changes to This Document
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
x
CHAPTER 1
New and Changed Feature Information
This section lists all the new and changed features for the Application Hosting Configuration Guide.
• New and Changed Application Hosting Features, on page 1
Cisco Secure DDoS Edge This feature was Release 24.3.1 Cisco Secure DDoS Edge
Protection introduced. Protection
Telemetry Data Export This feature was Release 24.1.1 Telemetry Data Export
from Line Card Port via introduced. from Line Card Port via
User Defined VRF User Defined VRF
MPLS Explicit Null for This feature was Release 24.1.1 MPLS Explicit Null for
IPv6 Data packets introduced. IPv6 Data packets
Customize Docker Run This feature was Release 24.1.1 Customize Docker Run
Options using Application introduced. Options using Application
Manager Manager
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
1
New and Changed Feature Information
New and Changed Application Hosting Features
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
2
CHAPTER 2
Getting Started with Application Hosting
This section introduces application hosting and the Linux environment used for hosting applications on the
Cisco IOS XR Operating System.
• Need for Application Hosting, on page 3
• Deep Dive Into Application Hosting, on page 4
• Application Hosting on the Cisco IOS XR Linux Shell, on page 5
• Support for Docker Run Options via AppMgr Commands, on page 16
• Getting Started with Using Vagrant for Application Hosting, on page 20
When network devices are managed by configuration management applications, such as Chef and Puppet,
network administrators are freed of the task of focusing only on the CLI. Because of the abstraction provided
by the application, while the application does its job, administrators can now focus on the design, and other
higher level tasks.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
3
Getting Started with Application Hosting
Deep Dive Into Application Hosting
• Admin Plane: The admin plane is the first Linux container to be launched on booting IOS XR. The
admin plane is responsible for managing the life cycle of the IOS XR control plane container.
• XR Control Plane: Applications are hosted natively in the 64-bit IOS XR control plane. You can access
the IOS XR Linux bash shell through the control plane.
• Data Plane: The data plane substitutes and provides all the features of a line card in a modular router
chassis.
• Third-Party Container: You can create your own Linux container (LXC) for hosting third-party
applications and use the LC interfaces that are provided.
Apart from the Linux containers, several interfaces are offered on the host Linux.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
4
Getting Started with Application Hosting
Application Hosting on the Cisco IOS XR Linux Shell
• Third-Party Container (third-party applications reside here): The 64-bit IOS XR provides you an
option to create and launch your own Linux container, known as the third-party container. You can install
applications within the container that shares the network namespace with XR. You can access the
namespace through the XR Linux shell.
The network namespace on XR is shared across all applications and is known as global-vrf.
The Third-Party Application (TPA) IP is configured so that applications can communicate outside XR through
the fwdintf interface, which is bound to the Loopback0 interface of XR. All applications communicate with
XR through the fwd_ew interface, which is bound to the Loopback1 interface of XR.
Figure 2: Application Hosting Architecture
To host a Linux application on IOS XR, you must be familiar with the Linux shell on XR.
A typical Linux OS provides a single set of network interfaces and routing table entries that are shared across
the OS. With the introduction of network namespaces, Linux provides multiple instances of network interfaces
and routing tables that operate independently.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
5
Getting Started with Application Hosting
Accessing the Third-Party Network Namespace on Cisco IOS XR Linux Shell
Note Support for network namespaces varies across different distributions of the Linux OS. Ensure that the
distribution you are planning to use for application hosting supports network namespaces.
Note This procedure is applicable only on Cisco IOS XR Versions 5.3.2 and 6.0.0. For accessing this namespace
on other versions of Cisco IOS XR, see Accessing Global VRF on the Cisco IOS XR Linux Shell, on page
12.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
6
Getting Started with Application Hosting
Accessing the Third-Party Network Namespace on Cisco IOS XR Linux Shell
The output displays the IP and MAC addresses of the GigabitEthernet0/0/0/0 interface.
3. Enter the run command to launch the IOS XR Linux bash shell.
You can also check the version of IOS XR when you are at the bash prompt.
RP/0/RP0/CPU0:ios# run
Wed Oct 28 18:45:56.168 IST
[xr-vm_node0_RP0_CPU0:~]$ uname -a
Linux xr-vm_node0_RP0_CPU0 3.10.19-WR7.0.0.2_standard #1 SMP Mon Jul 6
13:38:23 PDT 2015 x86_64 GNU/Linux
[xr-vm_node0_RP0_CPU0:~]$
Note To exit the Linux bash shell and launch the IOS XR console, enter the exit command:
[xr-vm_node0_RP0_CPU0:~]$ exit
exit
RP/0/RP0/CPU0:ios#
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
7
Getting Started with Application Hosting
Accessing the Third-Party Network Namespace on Cisco IOS XR Linux Shell
The output displays the internal interfaces (eth0 through eth-vf1.3074) used by IOS XR. These interfaces
exist in XR Network Namespace (XRNNS) and do not interact with the network outside IOS XR. Interfaces
that interact with the network outside IOS XR are found in the Third Party Network Namespace (TPNNS).
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
8
Getting Started with Application Hosting
Accessing the Third-Party Network Namespace on Cisco IOS XR Linux Shell
The interfaces displayed in the output are replicas of the IOS XR interfaces in the Linux environment.
(They have the same MAC and IP addresses.)
• Gi0_0_0_0 is the IOS XR GigabitEthernet 0/0/0/0 interface.
• Mg0_RP0_CPU0_0 is the IOS XR management interface, used for administrative operations on XR.
• fwd_ew is the interface used for communication (east to west) between third-party applications and
IOS XR.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
9
Getting Started with Application Hosting
Accessing the Third-Party Network Namespace on Cisco IOS XR Linux Shell
• fwdintf is the interface used for communication between third-party applications and the network
outside IOS XR.
• lo:0 is the IOS XR loopback0 interface used for communication between third-party applications
and the outside network through the fwdintf interface. The loopback0 interface must be configured
for applications to communicate outside XR. Alternatively, applications can also configure a GigE
interface for external communication, as explained in the Communication Outside Cisco IOS XR,
on page 45 section.
All interfaces that are enabled (with the no shut command) are added to TPNNS on IOS XR.
7. (Optional) View the IP routes used by the fwd_ew and fwdintf interfaces.
[xr-vm_node0_RP0_CPU0:~]$ ip route
default dev fwdintf scope link src 1.1.1.1
8.8.8.8 dev fwd_ew scope link
192.168.122.0/24 dev Mg0_RP0_CPU0_0 proto kernel scope link src 192.168.122.213
Note The fwdintf and fwd_ew interfaces is not support from IOS XR software release 7.9.1.
Note On IOS XR, prior to starting a service that binds to an interface, ensure that the interface is configured, up,
and operational.
To ensure that a service starts only after an interface is configured, include the following function in the service
script:
. /etc/init.d/tpnns-functions
tpnns_wait_until_ready
The addition of the tpnns_wait_until_ready function ensures that the service script waits for one or more
interfaces to be configured before starting the service.
1. (Optional) If you want the TPNNS service to start automatically on reload, add the sshd_tpnns service
and verify its presence.
bash-4.3# chkconfig --add sshd_tpnns
bash-4.3# chkconfig --list sshd_tpnns
sshd_tpnns 0:off 1:off 2:off 3:on 4:on 5:on 6:off
bash-4.3#
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
10
Getting Started with Application Hosting
Accessing the Third-Party Network Namespace on Cisco IOS XR Linux Shell
3. Log into the sshd_tpnns session as the non-root user created in Step 1.
host@fe-ucs36:~$ ssh [email protected] -p 57722
[email protected]'s password:
Last login: Tue Sep 8 20:14:11 2015 from 192.168.122.1
XR-vm_node0_RP0_CPU0:~$
You are ready to use the IOS XR Linux shell for hosting applications.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
11
Getting Started with Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell
The output displays the IP and MAC addresses of the GigabitEthernet0/0/0/0 interface.
3. Verify whether the bash command runs in global VRF by running the bash -c ifconfig command to view
the network interfaces.
RP/0/RP0/CPU0:ios# bash -c ifconfig
...
Gi0_0_0_0 Link encap:Ethernet HWaddr 52:46:04:87:19:3c
inet addr:192.164.168.10 Mask:255.255.255.0
inet6 addr: fe80::5046:4ff:fe87:193c/64 Scope:Link
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
12
Getting Started with Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell
The presence of the following two interfaces confirms that you are in Global VRF:
fwd_ew is the interface used for communication (east to west) between third-party applications and IOS
XR.
fwdintf is the interface used for communication between third-party applications and the network outside
IOS XR.
4. Access the Linux shell by running the bash command.
RP/0/RP0/CPU0:ios# bash
Tue Aug 02 13:44:07.627 UTC
[xr-vm_node0_RP0_CPU0:~]$
5. (Optional) View the IP routes used by the fwd_ew and fwdintf interfaces.
[xr-vm_node0_RP0_CPU0:~]$ ip route
default dev fwdintf scope link src 1.1.1.1
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
13
Getting Started with Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell
Note On IOS XR, prior to starting a service that binds to an interface, ensure that the interface is configured, up,
and operational.
To ensure that a service starts only after an interface is configured, include the following function in the service
script:
. /etc/init.d/operns-functions
operns_wait_until_ready
The addition of the operns_wait_until_ready function ensures that the service script waits for one or more
interfaces to be configured before starting the service.
1. (Optional) If you want the operns service to start automatically on reload, add the sshd_operns service
and verify its presence.
bash-4.3# chkconfig --add sshd_operns
bash-4.3# chkconfig --list sshd_operns
sshd_operns 0:off 1:off 2:off 3:on 4:on 5:on 6:off
bash-4.3#
3. Log into the sshd_operns session as the non-root user created in Step 1.
host@fe-ucs36:~$ ssh [email protected] -p 57722
[email protected]'s password:
Last login: Tue Sep 8 20:14:11 2015 from 192.168.122.1
XR-vm_node0_RP0_CPU0:~$
4. Verify whether you are in global VRF by viewing the network interfaces.
[XR-vm_node0_RP0_CPU0:~]$ ifconfig
Gi0_0_0_0 Link encap:Ethernet HWaddr 52:46:04:87:19:3c
inet addr:192.164.168.10 Mask:255.255.255.0
inet6 addr: fe80::5046:4ff:fe87:193c/64 Scope:Link
UP RUNNING NOARP MULTICAST MTU:1514 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:210 (210.0 B)
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
14
Getting Started with Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell
You are ready to use the IOS XR Linux shell for hosting applications.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
15
Getting Started with Application Hosting
Support for Docker Run Options via AppMgr Commands
Support for Docker Run Options Release 24.1.1 You can now leverage Application
via AppMgr Commands Manager to efficiently overwrite
default docker runtime
configurations, tailoring them to
specific parameters like CPU usage,
security settings, and health
checks.You can thus optimize
application performance, maintain
fair resource allocation among
multiple dockers, and establish
non-default network security
settings to meet specific security
requirements. Additionally, you can
accurately monitor and reflect the
health of individual applications.
This feature modifies the
docker-run-opts option command.
With this feature, runtime options for docker containerized applications on IOS-XR can be configured during
launch using the "appmgr activate" command. AppMgr, which oversees docker containerized applications,
ensures that these runtime options can effectively override default configurations, covering aspects like CPU,
security, and health checks during the container launch.
This feature introduces multiple runtime options that allow users to customize different parameters of docker
containers. The configuration of these runtime options is flexible, as users can use either command or Netconf
for the configuration process. Regardless of the chosen method, runtime options must be added to
docker-run-opts as needed.
The following are the docker run option commands introduced in IOS-XR software release 24.1.1.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
16
Getting Started with Application Hosting
Support for Docker Run Options via AppMgr Commands
Prior to IOS-XR software release 24.1.1, only the below mentioned docker run option commands were
supported.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
17
Getting Started with Application Hosting
Support for Docker Run Options via AppMgr Commands
The below section provides the information on how to configure the docker run time options. In this example
we configure the docker run time option using appmgr and Netconf.
Procedure
Step 1 Use the pids-limit command to limit the number of process IDs in the docker run command, as shown below:
Example:
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
18
Getting Started with Application Hosting
Verification
appmgr application alpine_app activate type docker source alpine docker-run-opts "-it –pids-limit
90" docker-run-cmd "sh"
Router#
Step 2 This step shows example for Netconf request for enabling pids-limit:
Example:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<candidate/>
</target>
<config>
<appmgr xmlns=http://cisco.com/ns/yang/Cisco-IOS-XR-um-appmgr-cfg>
<applications>
<application>
<application-name>alpine_app</application-name>
<activate>
<type>docker</type>
<source-name>alpine_pids_limit</source-name>
<docker-run-cmd>/bin/sh</docker-run-cmd>
<docker-run-opts>-it --pids-limit=10</docker-run-opts>
</activate>
</application>
</applications>
</appmgr>
</config>
</edit-config>
Verification
Procedure
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
19
Getting Started with Application Hosting
Getting Started with Using Vagrant for Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell by Using a Vagrant Box
The Third-Party Network Namespace (TPNNS) is renamed as Global VRF (global-vrf) in Cisco IOS XR
Version 6.0.2 and higher. From Cisco IOS XR Version 6.1.1 and higher, you can use a Linux-based vagrant
box to directly access the Global VRF on IOS XR, as described in the following procedure.
Procedure
To access Global VRF by using a vagrant box, use the following steps.
1. Generate an API key and a CCO ID by using the steps described in https://xrdocs.github.io/getting-started/
steps-download-iosxr-vagrant.
2. Download the latest stable version of the IOS XR vagrant box.
$ curl <cco-id>:<API-KEY>
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
20
Getting Started with Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell by Using a Vagrant Box
==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default:
==> default:
==> default: Welcome to the IOS XRv (64-bit) Virtualbox.
==> default: To connect to the XR Linux shell, use: 'vagrant ssh'.
==> default: To ssh to the XR Console, use: 'vagrant port' (vagrant version > 1.8)
==> default: to determine the port that maps to guestport 22,
==> default: then: 'ssh vagrant@localhost -p <forwarded port>'
==> default:
==> default: IMPORTANT: READ CAREFULLY
==> default: The Software is subject to and governed by the terms and conditions
==> default: of the End User License Agreement and the Supplemental End User
==> default: License Agreement accompanying the product, made available at the
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
21
Getting Started with Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell by Using a Vagrant Box
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
22
Getting Started with Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell by Using a Vagrant Box
The interfaces displayed in the output are replicas of the IOS XR interfaces in the Linux environment.
(They have the same MAC and IP addresses.)
• Gi0_0_0_0 is the IOS XR GigabitEthernet 0/0/0/0 interface.
• Mg0_RP0_CPU0_0 is the IOS XR management interface, used for administrative operations on XR.
• fwd_ew is the interface used for communication (east to west) between third-party applications and
IOS XR.
• fwdintf is the interface used for communication between third-party applications and the network
outside IOS XR.
• lo:0 is the IOS XR loopback0 interface used for communication between third-party applications
and the outside network through the fwdintf interface. The loopback0 interface must be configured
for applications to communicate outside XR. Alternatively, applications can also configure a GigE
interface for external communication, as explained in the Communication Outside Cisco IOS XR,
on page 45 section.
The presence of fwd_ew and fwdintf interfaces confirm that you are in the global VRF namespace.
All interfaces that are enabled (with the no shut command) are added to global-vrf on IOS XR.
11. (Optional) View the IP addresses used by the fwd_ew and fwdintf interfaces.
[xr-vm_node0_RP0_CPU0:~]$ ip route
default dev fwdintf scope link src 1.1.1.1
8.8.8.8 dev fwd_ew scope link
192.168.122.0/24 dev Mg0_RP0_CPU0_0 proto kernel scope link src 192.168.122.213
12. To access the IOS XR router prompt, use the following steps.
a. Log out of the XR Linux shell virtual box.
xr-vm_node0_RP0_CPU0:~$ exit
logout
Connection to 127.0.0.1 closed.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
23
Getting Started with Application Hosting
Accessing Global VRF on the Cisco IOS XR Linux Shell by Using a Vagrant Box
c. Use the port number, 2223, and the password, vagrant, for accessing XR through SSH .
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs/lxc-app-topo-bootstrap (master)
$ ssh -p 2223 vagrant@localhost
vagrant@localhost's password:
RP/0/RP0/CPU0:ios#
13. View the network interfaces by using the bash -c ifconfig command at the XR router prompt.
RP/0/RP0/CPU0:ios# bash -c ifconfig
Thu Jul 21 06:03:49.098 UTC
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
24
Getting Started with Application Hosting
Applying Bootstrap Configuration to Cisco IOS XR by Using a Vagrant Box
You can view all the interfaces available in global VRF namespace through the XR router prompt.
14. (Optional) To navigate to the XR Linux shell, you can use the run command. To navigate back to the
router prompt, you can use the exit command.
RP/0/RP0/CPU0:ios# run
Thu Jul 21 05:57:04.232 UTC
[xr-vm_node0_RP0_CPU0:~]$
[xr-vm_node0_RP0_CPU0:~]$ exit
exit
RP/0/RP0/CPU0:ios#
You are ready to use the IOS XR Linux shell for hosting applications.
Procedure
To bootstrap configuration to an instance of XR running on a vagrant box, use the following steps.
1. Generate an API key and a CCO ID by using the steps described in https://xrdocs.github.io/getting-started/
steps-download-iosxr-vagrant.
2. Download the latest stable version of the IOS XR vagrant box.
$ curl <cco-id>:<API-KEY>
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
25
Getting Started with Application Hosting
Applying Bootstrap Configuration to Cisco IOS XR by Using a Vagrant Box
annseque@ANNSEQUE-WS02 MINGW64 ~
$ git clone https://github.com/ios-xr/vagrant-xrdocs.git
7. Navigate to the vagrant-xrdocs repository and locate the vagrant file containing the configuration with
which you want to bootstrap the XR.
annseque@ANNSEQUE-WS02 MINGW64 ~
$ cd vagrant-xrdocs/
8. Create the bootstrap configuration file which uses a vagrant shell provisioner.
You would need a shell provisioner section for each node in your network. A sample configuration file
is as follows:
In the shown sample file, you are using a vagrant file provisioner (config.vm.provision "file") to
transfer a file from your host machine to the XR Linux shell. The root of the source directory is the
working directory for your vagrant instance. Hence, the rtr_config file is located in the configs
directory.
You are using a shell script (config.vm.provision "shell") to apply the bootstrap configuration to
XR. The shell script eventually runs on the XR Linux shell of the vagrant instance. This script is placed
in the scripts directory and is named as apply_config.sh. The script uses the location of the router
configuration file as the destination parameter in the vagrant file provisioner.
9. Verify the directory structure for the single node bootstrap configuration example used in this section.
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs (master)
$ cd single_node_bootstrap/
2 directories, 3 files
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
26
Getting Started with Application Hosting
Applying Bootstrap Configuration to Cisco IOS XR by Using a Vagrant Box
Note The bootstrap configuration is appended to the existing configuration on the instance of XR.
11. Verify the contents of the shell script you are using to apply the configuration to XR.
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs/single_node_bootstrap (master)
$ cat scripts/apply_config.sh
#!/bin/bash
function configure_xr()
{
## Apply a blind config
xrapply $1
if [ $? -ne 0 ]; then
echo "xrapply failed to run"
fi
xrcmd "show config failed" > /home/vagrant/config_failed_check
}
In this example, the shell script blindly applies the configuration file specified as an argument ($1) and
then checks to see if there was an error while applying the configuration.
The following new commands are introduced in the shell script:
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
27
Getting Started with Application Hosting
Applying Bootstrap Configuration to Cisco IOS XR by Using a Vagrant Box
• xrcmd: Allows you to run privileged exec commands at the XR router prompt on the XR Linux
shell.
For example, show run, show version, and so on.
• xrapply: Allows you to apply (append) a configuration file to the existing configuration.
• xrapply_string: Applies a configuration directly using a single inline string.
For example, xrapply_string "interface Gig0/0/0/0\n ip address 1.1.1.2/24 \n no shutdown
12. Verify if the shell provisioner code has been included in the vagrant file.
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs/single_node_bootstrap (master)
$ cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "IOS-XRv"
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
28
Getting Started with Application Hosting
Applying Bootstrap Configuration to Cisco IOS XR by Using a Vagrant Box
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running:
C:/Users/annseque/AppData/Local/Temp/vagrant-shell20160825-3292-1wncpa3.sh
==> default: Configuration was successful!
==> default: Last applied configuration was:
==> default: Building configuration...
==> default: !! IOS XR Configuration version = 6.1.1.18I
==> default: grpc
==> default: port 57789
==> default: !
==> default: end
==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default:
==> default:
==> default: Welcome to the IOS XRv (64-bit) Virtualbox.
==> default: To connect to the XR Linux shell, use: 'vagrant ssh'.
==> default: To ssh to the XR Console, use: 'vagrant port' (vagrant version > 1.8)
==> default: to determine the port that maps to guestport 22,
==> default: then: 'ssh vagrant@localhost -p <forwarded port>'
==> default:
==> default: IMPORTANT: READ CAREFULLY
==> default: The Software is subject to and governed by the terms and conditions
==> default: of the End User License Agreement and the Supplemental End User
==> default: License Agreement accompanying the product, made available at the
==> default: time of your order, or posted on the Cisco website at
==> default: www.cisco.com/go/terms (collectively, the 'Agreement').
==> default: As set forth more fully in the Agreement, use of the Software is
==> default: strictly limited to internal use in a non-production environment
==> default: solely for demonstration and evaluation purposes. Downloading,
==> default: installing, or using the Software constitutes acceptance of the
==> default: Agreement, and you are binding yourself and the business entity
==> default: that you represent to the Agreement. If you do not agree to all
==> default: of the terms of the Agreement, then Cisco is unwilling to license
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
29
Getting Started with Application Hosting
Applying Bootstrap Configuration to Cisco IOS XR by Using a Vagrant Box
==> default: the Software to you and (a) you may not download, install or use the
==> default: Software, and (b) you may return the Software as more fully set forth
==> default: in the Agreement.
You can see the vagrant file and shell provisioner applying the gPRC server port configuration to XR.
14. (Optional) You can verify the bootstrap configuration on the XR router console from the XR Linux
shell.
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs/single_node_bootstrap (master)
$ vagrant port
The forwarded ports for the machine are listed below. Please note that
these values may differ from values configured in the Vagrantfile if the
provider supports automatic port collision detection and resolution.
RP/0/RP0/CPU0:ios#
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
30
CHAPTER 3
Accessing the Networking Stack
The Cisco IOS XR Software serves as a networking stack for communication. This section explains how
applications on IOS XR can communicate with internal processes, and with servers or outside devices.
• Packet I/O on IOS XR, on page 31
• Communication Outside Cisco IOS XR, on page 45
• East-West Communication for Third-Party Applications, on page 47
• Telemetry Data Export from Line Card Port via User Defined VRF, on page 49
• MPLS Explicit Null Label for IPv6 Data Packets, on page 50
For additional information on secondary IPv4 addresses, see ipv4 address (network).
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
31
Accessing the Networking Stack
Exposed IOS-XR Interfaces in Linux
You can run bash commands at the IOS XR router prompt to view the interfaces and IP addresses stored in
global VRF. When you access the Cisco IOS XR Linux shell, you directly enter the global VRF.
SUMMARY STEPS
1. From your Linux box, access the IOS XR console through SSH, and log in.
2. View the ethernet interfaces on IOS XR.
3. Check the IP and MAC addresses of the interface that is in Up state. Here, interfaces HundredGigE0/0/0/24
and MgmtEth0/RP0/CPU0/0 are in the Up state.
4. Verify that the bash command runs in global VRF to view the network interfaces.
5. Access the Linux shell.
6. (Optional) View the IP routes used by the to_xr interfaces.
DETAILED STEPS
Procedure
Step 1 From your Linux box, access the IOS XR console through SSH, and log in.
Example:
cisco@host:~$ ssh [email protected]
[email protected]'s password:
Router#
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
32
Accessing the Networking Stack
Exposed IOS-XR Interfaces in Linux
Note
Use the ip addr show or ip link show commands to view all corresponding interfaces in Linux. The IOS XR interfaces
that are admin-down state also reflects a Down state in the Linux kernel.
Step 3 Check the IP and MAC addresses of the interface that is in Up state. Here, interfaces HundredGigE0/0/0/24 and
MgmtEth0/RP0/CPU0/0 are in the Up state.
Example:
Router#show interfaces HundredGigE0/0/0/24
...
HundredGigE0/0/0/24 is up, line protocol is up
Interface state transitions: 4
Hardware is HundredGigE0/0/0/24, address is 5246.e8a3.3754 (bia
5246.e8a3.3754)
Internet address is 10.1.1.1/24
MTU 1514 bytes, BW 1000000 Kbit (Max: 1000000 Kbit)
reliability 255/255, txload 0/255, rxload 0/255
Encapsulation ARPA,
Duplex unknown, 1000Mb/s, link type is force-up
output flow control is off, input flow control is off
loopback not set,
Last link flapped 01:03:50
ARP type ARPA, ARP timeout 04:00:00
Last input 00:38:45, output 00:38:45
Last clearing of "show interface" counters never
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
12 packets input, 1260 bytes, 0 total input drops
0 drops for unrecognized upper-level protocol
Received 2 broadcast packets, 0 multicast packets
0 runts, 0 giants, 0 throttles, 0 parity
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
12 packets output, 1224 bytes, 0 total output drops
Output 1 broadcast packets, 0 multicast packets
Step 4 Verify that the bash command runs in global VRF to view the network interfaces.
Example:
Router#bash -c ifconfig
Hu0_0_0_24 Link encap:Ethernet HWaddr 78:e7:e8:d3:20:c0
inet addr:10.1.1.10 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:360 (360.0 B) TX bytes:0 (0.0 B)
Mg0_RP0_CPU0_0 Link encap:Ethernet HWaddr 54:00:00:00:bd:49
inet addr:192.168.122.22 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3859 errors:0 dropped:0 overruns:0 frame:0
TX packets:1973 errors:0 dropped:0 overruns:0 carrier:0
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
33
Accessing the Networking Stack
Exposed IOS-XR Interfaces in Linux
collisions:0 txqueuelen:1000
RX bytes:2377782 (2.2 MiB) TX bytes:593602 (579.6 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:242 errors:0 dropped:0 overruns:0 frame:0
TX packets:242 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:12100 (11.8 KiB) TX bytes:12100 (11.8 KiB)
to_xr Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:60 (60.0 B)
Note
You can also enter the global VRF directly after logging into IOS XR using the run ip netns exec vrf-default bash
command.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
34
Accessing the Networking Stack
Setting up Virtual IP Addresses
Virtual IP address in the Linux Release 7.5.2 Virtual IP addresses allow a single
networking stack IP address to connect to the current
active RP after an RP switchover
event. In addition, this functionality
enables your network stack to
support virtual IP addresses for
third-party applications and IOS
XR applications that use the Linux
networking stack.
The following commands are
modified:
• ipv4 virtual address
• ipv6 virtual address
• show linux networking
interfaces address-only
Interfaces configured on IOS XR are programmed into the Linux kernel. These interfaces allow Linux
applications to run as if they were running on a regular Linux system. This packet I/O capability ensures that
off-the-shelf Linux applications can be run alongside IOS XR, allowing operators to use their existing tools
and automate deployments with IOS XR.
The IP address on the Linux interfaces, MTU settings, MAC address are inherited from the corresponding
settings of the IOS XR interface. Accessing the global VRF network namespace ensures that when you issue
the bash command, the default or the global VRF in IOS XR is reflected in the kernel. This ensures default
reachability based on the routing capabilities of IOS XR and the packet I/O infrastructure.
Virtual addresses can be configured to access a router from the management network such as gRPC using a
single virtual IP address. On a device with two or more RPs, the virtual address refers to the management
interface that is currently active. This functionality can be used across RP failover without the information of
which RP is currently active. This is applicable to the Linux packet path.
Procedure
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
35
Accessing the Networking Stack
Program Routes in Linux
Procedure
[ios:~]$ip route replace default dev to_xr scope link src 192.168.122.22 metric 2048
[ios:~]$ip route
default dev to_xr scope link src 192.168.122.22 metric 2048
10.1.1.0/24 dev Hu0_0_0_24 proto kernel scope link src 10.1.1.10
192.168.122.0/24 dev Mg0_RP0_CPU0_0 proto kernel scope link src 192.168.122.22
With this updated source hint, any default traffic exiting the system uses the Management port IP address as the
source IP address.
• Local or Connected Routes: The routes are associated with the subnet configured on interfaces. For example, the
10.1.1.0/24 network is associated with the Hu0_0_0_24 interface, and the 192.168.122.0/24 subnet is associated with
the Mg0_RP0_CPU0 interface .
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
36
Accessing the Networking Stack
Configure VRFs in Linux
Procedure
Router(config)#vrf blue
Router(config-vrf)#commit
[ios:~]$ls -l /var/run/netns
total 0
-r--r--r--. 1 root root 0 Jul 30 04:17 default
-r--r--r--. 1 root root 0 Jul 30 04:17 global-vrf
-r--r--r--. 1 root root 0 Jul 30 04:17 tpnns
-r--r--r--. 1 root root 0 Aug 1 17:01 vrf-blue
-r--r--r--. 1 root root 0 Jul 30 04:17 vrf-default
-r--r--r--. 1 root root 0 Jul 30 04:17 xrnns
Step 5 Access VRF blue to launch and execute processes from the new network namespace.
Example:
[ios:~]$ip netns exec vrf-blue bash
[ios:~]$
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
37
Accessing the Networking Stack
Configure VRFs in Linux
Running an ifconfig command shows only the default to-xr interface because there is no IOS XR interface in this VRF.
[ios:~]$ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
to_xr Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
[ios:~]$
Step 6 Configure an interface in the VRF blue in IOS XR. This interface will be configured automatically in the network
namespace vrf-blue in the kernel.
Example:
The following example shows how to configure HundredGigE 0/0/0/24 interface in vrf-blue from IOS XR:
Router#conf t
Router(config)#int HundredGigE 0/0/0/24
Router(config-if)#no ipv4 address
Router(config-if)#vrf blue
Router(config-if)#ipv4 address 10.1.1.10/24
Router(config-if)#commit
Step 7 Verify that the HundredGigE 0/0/0/24 interface is configured in the VRF blue in IOS XR.
Example:
Router#show run int HundredGigE 0/0/0/24
interface HundredGigE0/0/0/24
vrf blue
ipv4 address 10.1.1.10 255.255.255.0
!
Step 8 Verify that the interface is configured in the VRF blue in the kernel.
Example:
Router#bash
Thu Aug 1 17:09:39.314 UTC
[ios:~]$
[ios:~]$ip netns exec vrf-blue bash
[ios:~]$
[ios:~]$ifconfig
Hu0_0_0_24 Link encap:Ethernet HWaddr 78:e7:e8:d3:20:c0
inet addr:10.1.1.10 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
38
Accessing the Networking Stack
Open Linux Sockets
Procedure
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
39
Accessing the Networking Stack
Send and Receive Traffic
Netcat starts listening on port 5000, which appears as an IPv4 TCP socket in the netstat output like a typical Linux kernel.
This socket gets programmed to LPTS, creating a corresponding entry in the hardware to the lookup tcp port 5000. The
incoming traffic is redirected to the kernel of the active RP where the netcat runs.
Procedure
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
40
Accessing the Networking Stack
Configure an Interface to be Linux-Managed
linux networking
exposed-interfaces
interface HundredGigE0/0/0/24 linux-managed
!
!
!
[ios:~]$ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
to_xr Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
41
Accessing the Networking Stack
Configure New IP address on the Interface in Linux
[ios:~]$ifconfig -a
Hu0_0_0_24 Link encap:Ethernet HWaddr 78:e7:e8:d3:20:c0
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
to_xr Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Procedure
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
42
Accessing the Networking Stack
Configure Custom MTU Setting
Procedure
[ios:~]$
[ios:~]$ ip link set dev Hu0_0_0_24 mtu 4096
[ios:~]$
[ios:~]$Router:Aug 1 17:42:46.830 UTC: xlncd[253]: %MGBL-CONFIG-6-DB_COMMIT : Configuration
committed by user 'system'. Use 'show configuration commit changes 1000000024' to view the changes.
Step 2 Verify that the MTU setting has been updated in Linux.
Example:
[ios:~]$ifconfig
Hu0_0_0_24 Link encap:Ethernet HWaddr 78:e7:e8:d3:20:c0
inet addr:10.1.1.10 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::7ae7:e8ff:fed3:20c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:4096 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:648 (648.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
to_xr Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Step 3 Check the effect on the IOS XR configuration with the change in MTU setting on this interface.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
43
Accessing the Networking Stack
Configure Traffic Protection for Linux Networking
Example:
Router#show running-config int HundredGigE0/0/0/24
interface HundredGigE0/0/0/24
mtu 4110
vrf blue
ipv4 mtu 4096
ipv4 address 10.1.1.10 255.255.255.0
ipv6 mtu 4096
ipv6 address fe80::7ae7:e8ff:fed3:20c0 link-local
!
!
!
Router#
Router#show ip int br | i HundredGigE0/0/0/24
HundredGigE0/0/0/24 10.1.1.10 Up Up blue
The output indicates that the interface acts as a regular Linux interface, and IOS XR configuration receives inputs from
Linux.
Note If traffic is received on a protocol or port combination that has no traffic protection rules configured, then all
traffic is allowed by default.
This example explains how to configure a traffic protection rule on IOS XR to deny all traffic on port 999
except for traffic arriving on interface HundredGigE0/0/0/25.
Procedure
where —
• address-family: Configuration for a particular IPv4 or IPv6 address family.
• protection: Configure traffic protection for Linux networking.
• protocol: Select the supported protocol - TCP or UDP.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
44
Accessing the Networking Stack
Communication Outside Cisco IOS XR
• local-port: L4 port number to specify traffic protection rules for Linux networking.
• port number: Port number ranges from 1 to 65535 or all ports.
• default-action: Default action to take for packets matching this traffic protection service.
• deny: Drop packets for this service.
• permit: Permit packets to reach Linux application for this service.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
45
Accessing the Networking Stack
Communication Outside Cisco IOS XR
3. Enter the Linux bash shell and verify if the configured interface is up and running.
/* If you are using Cisco IOS XR Version 6.0.0, run the following command */
RP/0/RP0/CPU0:ios# run ip netns exec tpnns bash
/* If you are using Cisco IOS XR Version 6.0.2, run the following command */
RP/0/RP0/CPU0:ios# bash
[xr-vm_node0_RP0_CPU0:~]$ ifconfig
Gi0_0_0_0 Link encap:Ethernet HWaddr 52:46:04:87:19:3c
inet addr:192.164.168.10 Mask:255.255.255.0
inet6 addr: fe80::5046:4ff:fe87:193c/64 Scope:Link
UP RUNNING NOARP MULTICAST MTU:1514 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:210 (210.0 B)
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
46
Accessing the Networking Stack
East-West Communication for Third-Party Applications
4. Exit the Linux bash shell and configure the GigE interface as the source address for external communication.
[xr-vm_node0_RP0_CPU0:~]$ exit
RP/0/RP0/CPU0:ios# config
Fri Oct 30 08:55:17.992 UTC
RP/0/RP0/CPU0:ios(config)# tpa address-family ipv4 update-source gigabitEthernet 0/0/0/1
RP/0/RP0/CPU0:ios(config)# commit
Fri Oct 30 08:55:38.795 UTC
Note By default, the fwdintf interface maps to the loopback0 interface for external communication. This is similar
to binding a routing process or router ID to the loopback0 interface. When you use the tpa address-family
ipv4 update-source command to bind the fwdintf interface to a Gigabit Ethernet interface, network
connectivity can be affected if the interface goes down.
5. Enter the Linux bash shell and verify whether the GigE interface address is used by the fwdintf interface
for external communication.
/* If you are using Cisco IOS XR Version 6.0.0, run the following command */
RP/0/RP0/CPU0:ios# run ip netns exec tpnns bash
/* If you are using Cisco IOS XR Version 6.0.2, run the following command */
RP/0/RP0/CPU0:ios# bash
[xr-vm_node0_RP0_CPU0:~]$ ip route
default dev fwdintf scope link src 192.57.43.10
8.8.8.8 dev fwd_ew scope link
192.168.122.0/24 dev Mg0_RP0_CPU0_0 proto kernel scope link src 192.168.122.197
[xr-vm_node0_RP0_CPU0:~]$
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
47
Accessing the Networking Stack
East-West Communication for Third-Party Applications
The application sends data to the Forwarding Information Base (FIB) of IOS XR. The application is hosted
in the east portion of IOS XR, while the XR control plane is located in the west region. Therefore, this form
of communication between a third-party application and the XR control plane is termed as East-West (E-W)
communication.
Third-party applications such as Chef Client and Puppet Agent use this mode of communication to configure
and manage containers, packages, and applications on IOS XR. In the future, this support could be extended
to IOS XR, configured and managed by such third-party applications.
Note East-West communication is not supported on IOS XR from software release 7.9.1.
For a third-party application to communicate with IOS XR, the Loopback1 interface must be configured. This
is explained in the following procedure.
1. Configure the Loopback1 interface on IOS XR.
RP/0/RP0/CPU0:ios(config)# interface Loopback1
RP/0/RP0/CPU0:ios(config-if)# ipv4 address 8.8.8.8/32
RP/0/RP0/CPU0:ios(config-if)# no shut
RP/0/RP0/CPU0:ios(config-if)# commit
RP/0/RP0/CPU0:ios(config-if)# exit
RP/0/RP0/CPU0:ios(config)#
3. Enter the third-party network namespace or global VRF depending on the version of IOS XR version you
are using for your network.
/* If you are using Cisco IOS XR Version 6.0.0, run the following command */
RP/0/RP0/CPU0:ios# run ip netns exec tpnns bash
/* If you are using Cisco IOS XR Version 6.0.2, run the following command */
RP/0/RP0/CPU0:ios# bash
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
48
Accessing the Networking Stack
Telemetry Data Export from Line Card Port via User Defined VRF
4. Verify whether the Loopback1 interface address has been mapped to the E-W interface.
[xr-vm_node0_RP0_CPU0:~]$ ip route
default dev fwdintf scope link src 192.57.43.10
8.8.8.8 dev fwd_ew scope link
192.168.122.0/24 dev Mg0_RP0_CPU0_0 proto kernel scope link src 192.168.122.197
[xr-vm_node0_RP0_CPU0:~]$
Telemetry Data Export from Line Card Port via User Defined VRF
Table 7: Feature History Table
Telemetry Data Export from Line Release 24.1.1 You can now ensure that the
Card Port via User Defined VRF collection and transmission of
telemetry data does not interfere
with your primary network
operations, thus enhancing network
isolation and security by reducing
the risk of the data being tampered
with or intercepted. This is
achieved by exporting telemetry
data from the router to your
specified destination address
through line card data ports, using
either user-defined or default VRFs.
Starting from Cisco IOS XR 24.1.1 software release, we ensure that the collection and transmission of telemetry
data do not interfere with your primary network operations, thus enhancing network isolation and security by
reducing the risk of the data being tampered with or intercepted. This is achieved by exporting telemetry data
from user-defined VRFs to a specified destination address through data ports of line cards. Using this
functionality, you can export telemetry data through user-defined or default VRFs.
Prior to this release, telemetry data export was supported only through the default VRF. By leveraging data
ports of line cards and user-defined VRFs, this release expands the scope of telemetry data export configurations
on the Cisco ASR 9000 platform.
2. This example shows how to configure gRPC on a user-defined port for telemetry data export.
Router(config)#grpc
Router(config-grpc)#port 57400
Router(config-grpc)#vrf vrf_telemetry
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
49
Accessing the Networking Stack
MPLS Explicit Null Label for IPv6 Data Packets
Router(config-grpc)#!
Router#grpc no-tls
Verification
This example shows how to verify VRF forwarding through user defined port.
The "source" field shows the source for VRF forwarding, and the "value" field indicates the retrieved VRF
MTU value of 1514 bytes.
MPLS Explicit Null Label for IPv6 Release 24.1.1 You now get a comprehensive
Data packets insight into telemetry data for IPv6
gRPC sessions for Linux Third
Party Applications (TPAs) within
your network, providing data for
swift identification and resolution
of network issues as they arise. This
is achieved by supporting IPv6
explicit null labels, which allows
MPLS-labeled packets to be
forwarded to Linux TPAs without
removing their labels.
Starting with the Cisco IOS XR 24.1.1 software release, you can now retain MPLS labels for telemetry
streaming of gRPC sessions over IPv6 traffic and gain visibility over MPLS labeled packets in your network.
This empowers you to handle telemetry gRPC streams in-band, where IPv6 traffic is carried over RSVP-TE
IPv4 tunnels. Previously, explicit null was only supported on IPv4 traffic. The MPLS labeled packets destined
for Linux TPA are processed and forwarded to their respective TPAs, ensuring that their MPLS labels are
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
50
Accessing the Networking Stack
MPLS Explicit Null Label for IPv6 Data Packets
retained and received at the egress router without them being removed. This is achieved by using the
explicit-null command.
Note The null label does not use the Border Gateway Protocol (BGP) to transport labels.
Verification
This example shows how to verify explicit null label configuration.
Router(config)# show cef ipv6 58:1:1:1:: detail
58:1:1:1::/64, version 15294, internal 0x1000001 0x20 (ptr 0xa2ea9c68) [1], 0x600
(0xbeb55ee8), 0xa28 (0xa4610ab0)
Updated Dec 19 06:45:20.809
Prefix Len 64, traffic index 0, precedence n/a, priority 2, encap-id 0x100c700000001
gateway array (0xc020ca58) reference count 2, flags 0x28, source rib (7), 0 backups
[3 type 1 flags 0x8401 (0xc1004ab8) ext 0x0 (0x0)]
LW-LDI[type=1, refc=1, ptr=0xbeb55ee8, sh-ldi=0xc1004ab8]
gateway array update type-time 1 Dec 19 06:45:20.809
LDI Update time Dec 19 06:45:20.809
LW-LDI-TS Dec 19 06:45:20.809
Accounting: Disabled
via ::/128, named_TE_R2_R1_, 5 dependencies, weight 0, class 0 [flags 0x0]
path-idx 0 NHID 0x0 [0xc1ee20a0 0x0]
next hop VRF - 'default', table - 0xe0000000
next hop ::/128
local adjacency
labels imposed {ExpNullv6}
[
{
"source": "[58:1:1:1::1]:57400",
"timestamp": 1702969041524464897,
"time": "2023-12-19T06:57:21.524464897Z",
"updates": [
{
"Path": "openconfig:interfaces/interface[name=MgmtEth0/RSP1/CPU0/0]/state/mtu",
"values": {
"interfaces/interface/state/mtu": 1514
}
}
]
}
]
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
51
Accessing the Networking Stack
MPLS Explicit Null Label for IPv6 Data Packets
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
52
CHAPTER 4
Hosting Applications on IOS XR
This section explains the different kinds of application hosting, and demonstrates how a simple application,
such as iPerf, can be hosted natively or in a third-party container on IOS XR.
• Application Hosting in IOS XR Container, on page 53
• Container Application Hosting, on page 53
• Customize Docker Run Options Using Application Manager, on page 59
• Using Vagrant for Hosting Applications, on page 63
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
53
Hosting Applications on IOS XR
Container Application Hosting
This figure illustrates the workflow for creating a Linux container for application hosting. For the complete
configuration procedure, see Running iPerf as a Container Application, on page 55.
Figure 4: Container Application Hosting Workflow
2. Connect to the router running IOS XR, and copy the root file system.
3. Create the configuration file for the container in .xml format. This file specifies the attributes for the
container, such as name of the container, default namespace, and so on.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
54
Hosting Applications on IOS XR
Running iPerf as a Container Application
Note If you specify a network namespace (third-party), then by default, the LXC is launched in that namespace.
Topology
The following illustration describes the topology used in this example.
Figure 5: iPerf as a Container Application
iPerf server is installed on Router A, and iPerf client is installed on Router B. Both installations are done
within containers on the 64-bit IOS XR. The iPerf client communicates with the iPerf server through the
interfaces offered by IOS XR.
Prerequisites
Ensure that you have configured the two routers as shown in the topology.
Configuration Procedure
To run iPerf as a container application, follow these steps:
1. Log into Router A, and enter the XRNNS.
RP/0/RP0/CPU0:ios# run
[xr-vm_node0_RP0_CPU0:~]$
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
55
Hosting Applications on IOS XR
Running iPerf as a Container Application
8. Launch the iPerf client instance on Router B, by specifying the same port number used for the iPerf server,
and the management IP address of Router A.
In this example, 192.168.122.213 is the management IP address of Router A, and 57730 is the port number
used to access the iPerf server.
[root@host ~]#iperf -c 192.168.122.213 -p 57730
------------------------------------------------------------
Client connecting to 192.168.122.213, TCP port 57730
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.122.1 port 46974 connected with 192.168.122.213 port 57730
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 146 MBytes 122 Mbits/sec
To use UDP, instead of TCP, to communicate with the iPerf server, use the following command.
[root@host ~]#iperf -c 192.168.122.213 -p 57730 -u
------------------------------------------------------------
Client connecting to 192.168.122.213, UDP port 57730
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.122.1 port 41466 connected with 192.168.122.213 port 57730
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 1.25 MBytes 1.05 Mbits/sec
[ 3] Sent 893 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 1.25 MBytes 1.05 Mbits/sec 0.233 ms 0/ 893 (0%)
[root@hostB ~]#
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
56
Hosting Applications on IOS XR
Using Docker for Hosting Applications on Cisco IOS XR
The iPerf client hosted on Router B can access the iPerf server hosted on Router A.
The docker containers are created alongside the LXC on XR. To create and manage the containers, you can
use the XR bash shell. This is where the docker client is installed. The application binaries for the applications
to be hosted are installed inside the docker container.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
57
Hosting Applications on IOS XR
Using Docker for Hosting Applications on Cisco IOS XR
1. The docker file in the source repository is used to build the application binary file on your (docker engine
build) host machine.
2. The application binary file is pushed into the docker image registry.
3. The application binary file is pulled from the docker image registry and copied to the docker container
on XR (docker engine target host).
4. The application is built and hosted in the docker container on XR.
1. The application update is generated as a base libs update file (delta update file) and pushed to the docker
image registry.
2. The delta update file (containing only the difference in application code) is pulled from the docker image
registry and copied to the docker containers on XR (docker engine target host).
3. The docker containers are restarted with the delta update file.
TPA security
IOS XR is equipped with inherent safeguards to prevent third party applications from interfering with its role
as a Network OS.
Although IOS XR doesn't impose a limit on the number of TPAs that can run concurrently, it does impose
constraints on the resources allocated to the Docker daemon, based on the following parameters:
• CPU: By default, ¼ of the CPU per core available in the platform.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
58
Hosting Applications on IOS XR
Customize Docker Run Options Using Application Manager
Starting from IOS XR Release 24.4.1, you can hard limit the default CPU usage in the range between
25-75% of the total system CPU using the appmgr resources containers limit cpu valuevalue command.
This configuration restricts the TPAs from using more CPU than the set hard limit value irrespective of
the CPU usage by other XR processes.
This example provides the CPU hard limit configuraion.
RP/0/RSP0/CPU0:ios(config)#appmgr resources containers limit cpu ?
<25-75> In Percentage
RP/0/RSP0/CPU0:ios(config)#appmgr resources containers limit cpu 25
Customize Docker Run Options Release 24.1.1 You can now leverage Application
Using Application Manager Manager to efficiently overwrite
default docker runtime
configurations, tailoring them to
specific parameters like CPU usage,
security settings, and health checks.
You can thus optimize application
performance, maintain fair resource
allocation among multiple dockers,
and establish non-default network
security settings to meet specific
security requirements. Additionally,
you can accurately monitor and
reflect the health of individual
applications.
This feature modifies the
docker-run-opts option command.
With this feature, runtime options for docker containerized applications on IOS-XR can be configured during
launch using the appmgr activate" command. AppMgr, which oversees docker containerized applications,
ensures that these runtime options can effectively override default configurations, covering aspects like CPU,
security, and health checks during the container launch.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
59
Hosting Applications on IOS XR
Customize Docker Run Options Using Application Manager
This feature introduces multiple runtime options that allow users to customize different parameters of docker
containers. The configuration of these runtime options is flexible, as users can use either command or Netconf
for the configuration process. Regardless of the chosen method, runtime options must be added to
docker-run-opts as needed.
The following are the docker run option commands introduced in IOS-XR software release 24.1.1.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
60
Hosting Applications on IOS XR
Customize Docker Run Options Using Application Manager
Prior to IOS-XR software release 24.1.1, only the below mentioned docker run option commands were
supported.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
61
Hosting Applications on IOS XR
Customize Docker Run Options Using Application Manager
Configuration
This section provides the information on how to configure the docker run time options.
In this example we configure the docker run time option --pids-limit to limit the number of process IDs using
appmgr.
Router#appmgr application alpine_app activate type docker source alpine docker-run-opts
"-it –pids-limit 90" docker-run-cmd "sh"
Router#
In this example we configure the docker run time option --pids-limit to limit the number of process IDs using
Netconf.
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<candidate/>
</target>
<config>
<appmgr xmlns=http://cisco.com/ns/yang/Cisco-IOS-XR-um-appmgr-cfg>
<applications>
<application>
<application-name>alpine_app</application-name>
<activate>
<type>docker</type>
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
62
Hosting Applications on IOS XR
Using Vagrant for Hosting Applications
<source-name>alpine</source-name>
<docker-run-cmd>/bin/sh</docker-run-cmd>
<docker-run-opts>-it
--pids-limit=90</docker-run-opts>
</activate>
</application>
</applications>
</appmgr>
</config>
</edit-config>
Verification
This example shows how to verify the docker run time option configuration.
Router# show running-config appmgr
Thu Mar 23 08:22:47.014 UTC
appmgr
application alpine_app
activate type docker source alpine docker-run-opts "-it –pids-limit 90" docker-run-cmd
"sh"
!
!
You can also use docker inspect container id to verify the docker run time option configuration.
Router# docker inspect 25f3c30eb424
[
{
"PidsLimit": 90,
}
]
Note IOS-XR software version 6.x.x and above is not supported on Vagrant.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
63
Hosting Applications on IOS XR
Setting up an Application Development Topology By Using Vagrant
Procedure
To create an application development topology on vagrant, follow these steps.
1. Generate an API key and a CCO ID by using the steps described on Github.
2. Download the latest stable version of the IOS-XRv vagrant box.
$ curl <cco-id>:<API-KEY>
annseque@ANNSEQUE-WS02 MINGW64 ~
$ git clone https://github.com/ios-xr/vagrant-xrdocs.git
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
64
Hosting Applications on IOS XR
Setting up an Application Development Topology By Using Vagrant
annseque@ANNSEQUE-WS02 MINGW64 ~
$ cd vagrant-xrdocs/
8. (Optional) View the contents of the vagrant file in the lxc-app-topo-bootstrap directory.
The vagrant file (Vagrantfile) contains the two node topology for application development. You can
modify this by using a vi editor, if required.
Vagrant.configure(2) do |config|
e/vagrant/rtr_config"
end
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
65
Hosting Applications on IOS XR
Deploying an Application Development Topology by Using Vagrant
.20"
end
end
You have successfully created an application development topology on vagrant. See Deploying an Application
Development Topology by Using Vagrant, on page 66 for information on deploying the topology on vagrant.
Procedure
To deploy an application development topology on vagrant, follow these steps.
Note Ensure you have created an application development topology as described in Setting up an Application
Development Topology By Using Vagrant, on page 64, before proceeding with the following steps.
1. Ensure you are in the lxc-app-topo-bootstrap directory, and launch the vagrant instance.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
66
Hosting Applications on IOS XR
Deploying an Application Development Topology by Using Vagrant
rtr: This is not an error message; everything may continue to work properly,
rtr: in which case you may ignore this message.
==> rtr: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> rtr: flag to force provisioning. Provisioners marked to run always will still run.
==> devbox: Checking if box 'ubuntu/trusty64' is up to date...
==> devbox: A newer version of the box 'ubuntu/trusty64' is available! You currently
==> devbox: have version '20160801.0.0'. The latest is version '20160826.0.1'. Run
==> devbox: `vagrant box update` to update.
==> devbox: Clearing any previously set forwarded ports...
==> devbox: Fixed port collision for 22 => 2222. Now on port 2200.
==> devbox: Clearing any previously set network interfaces...
==> devbox: Preparing network interfaces based on configuration...
devbox: Adapter 1: nat
devbox: Adapter 2: intnet
==> devbox: Forwarding ports...
devbox: 22 (guest) => 2200 (host) (adapter 1)
==> devbox: Booting VM...
==> devbox: Waiting for machine to boot. This may take a few minutes...
devbox: SSH address: 127.0.0.1:2200
devbox: SSH username: vagrant
devbox: SSH auth method: private key
devbox: Warning: Remote connection disconnect. Retrying...
devbox: Warning: Remote connection disconnect. Retrying...
==> devbox: Machine booted and ready!
==> devbox: Checking for guest additions in VM...
devbox: The guest additions on this VM do not match the installed version of
devbox: VirtualBox! In most cases this is fine, but in rare cases it can
devbox: prevent things such as shared folders from working properly. If you see
devbox: shared folder errors, please make sure the guest additions within the
devbox: virtual machine match the version of VirtualBox you have installed on
devbox: your host and reload your VM.
devbox:
devbox: Guest Additions Version: 4.3.36
devbox: VirtualBox Version: 5.0
==> devbox: Configuring and enabling network interfaces...
==> devbox: Mounting shared folders...
devbox: /vagrant => C:/Users/annseque/vagrant-xrdocs/lxc-app-topo-bootstrap
==> devbox: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> devbox: flag to force provisioning. Provisioners marked to run always will still
run.
==> rtr: Machine 'rtr' has a post `vagrant up` message. This is a message
==> rtr: from the creator of the Vagrantfile, and not from Vagrant itself:
==> rtr:
==> rtr:
==> rtr: Welcome to the IOS XRv (64-bit) Virtualbox.
==> rtr: To connect to the XR Linux shell, use: 'vagrant ssh'.
==> rtr: To ssh to the XR Console, use: 'vagrant port' (vagrant version > 1.8)
==> rtr: to determine the port that maps to guestport 22,
==> rtr: then: 'ssh vagrant@localhost -p <forwarded port>'
==> rtr:
==> rtr: IMPORTANT: READ CAREFULLY
==> rtr: The Software is subject to and governed by the terms and conditions
==> rtr: of the End User License Agreement and the Supplemental End User
==> rtr: License Agreement accompanying the product, made available at the
==> rtr: time of your order, or posted on the Cisco website at
==> rtr: www.cisco.com/go/terms (collectively, the 'Agreement').
==> rtr: As set forth more fully in the Agreement, use of the Software is
==> rtr: strictly limited to internal use in a non-production environment
==> rtr: solely for demonstration and evaluation purposes. Downloading,
==> rtr: installing, or using the Software constitutes acceptance of the
==> rtr: Agreement, and you are binding yourself and the business entity
==> rtr: that you represent to the Agreement. If you do not agree to all
==> rtr: of the terms of the Agreement, then Cisco is unwilling to license
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
67
Hosting Applications on IOS XR
Deploying an Application Development Topology by Using Vagrant
==> rtr: the Software to you and (a) you may not download, install or use the
==> rtr: Software, and (b) you may return the Software as more fully set forth
==> rtr: in the Agreement.
You have successfully deployed the two nodes, rtr and devbox on your host machine.
2. To access the XR router console, check the port number that maps to the guest port number 22.
You need to use port number 2223 to SSH to the rtr node (XR).
3. Access the XR router console (rtr console) through SSH.
The password for vagrant@localhost is vagrant.
RP/0/RP0/CPU0:ios#
You are at the XR router console, or the console of the rtr node in this example.
4. Check the GigE interface IP address of the rtr.
You will need the GigE interface IP address to access the rtr console from the devbox console at a later
stage.
Note To access the XR Linux shell from the rtr console, use the run command.
RP/0/RP0/CPU0:ios# run
Wed Aug 31 04:01:45.119 UTC
[xr-vm_node0_RP0_CPU0:~]$
5. Exit the rtr console, and access the devbox console through SSH.
RP/0/RP0/CPU0:ios# exit
Connection to localhost closed.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
68
Hosting Applications on IOS XR
Hosting a Wind River Linux (WRL7) Application Natively By Using Vagrant
* Documentation: https://help.ubuntu.com/
vagrant@vagrant-ubuntu-trusty-64:~$
6. Verify if you can access the rtr console from the devbox console, by pinging the GigE interface of the
rtr.
Note To access the XR Linux console, exit the devbox console and run the vagrant ssh rtr command from the
lxc-app-topo-bootstrap directory.
vagrant@vagrant-ubuntu-trusty-64:~$ exit
logout
Connection to 127.0.0.1 closed.
You have successfully deployed an application development topology on your host device.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
69
Hosting Applications on IOS XR
Hosting a Wind River Linux (WRL7) Application Natively By Using Vagrant
Procedure
Use the following steps to host an application natively on IOS XR.
Note Ensure you have created an application development topology as described in Setting up an Application
Development Topology By Using Vagrant, on page 64, before proceeding with the following steps.
1. Verify if you have the IOS-XRv and the ciscoxr/appdev-xr6.1.1 vagrant boxes installed on your
machine.
annseque@ANNSEQUE-WS02 MINGW64 ~
$ vagrant box list
IOS-XRv (virtualbox, 0)
ciscoxr/appdev-xr6.1.1 (virtualbox, 1.0)
ubuntu/trusty64 (virtualbox, 20160602.0.0)
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
70
Hosting Applications on IOS XR
Hosting a Wind River Linux (WRL7) Application Natively By Using Vagrant
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
71
Hosting Applications on IOS XR
Hosting a Wind River Linux (WRL7) Application Natively By Using Vagrant
5. Access the WRL7 build instance through SSH, and retrieve the source code of the application you want
to host natively.
In this example, we fetch the source code for the iPerf application.
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs/native-app-topo-bootstrap (master)
$ vagrant ssh wrl7_build
---------------------------------------------------------------------------------------------
100%[=================================================================>] 277,702
153KB/s in 1.8s
-----------------------------------------------------------------------------------------
localhost:~$ ls
iperf-2.0.9-source.tar.gz
localhost:~$
6. Copy the source code tar ball to the /usr/src/rpm/SOURCES/ build location.
localhost:~$ sudo cp /home/vagrant/iperf-2.0.9-source.tar.gz /usr/src/rpm/SOURCES/
7. Retrieve the XML spec file (iperf.spec) for building the RPM.
localhost:~$ wget http://10.30.110.214/iperf.spec
--2016-09-13 01:58:44-- http://10.30.110.214/iperf.spec
Connecting to 10.30.110.214:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 609
Saving to: 'iperf.spec'
------------------------------------------------------------------------------------------------
localhost:~$ ls
iperf-2.0.9-source.tar.gz iperf.spec
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
72
Hosting Applications on IOS XR
Hosting a Wind River Linux (WRL7) Application Natively By Using Vagrant
+ umask 022
+ cd /usr/lib64/rpm/../../src/rpm/BUILD
+ cd /usr/src/rpm/BUILD
+ rm -rf iperf-2.0.9
+ /bin/tar -xf -
...
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.7)(64bit)
libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libm.so.6()
(64bit) libm.so.6(GLIBC_2.2.5)(64bit) libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit) libpthread.so.0(GLIBC_2.3.2)(64bit)
librt.so.1()(64bit) librt.so.1(GLIBC_2.2.5)(64bit) libstdc++.so.6()(64bit)
libstdc++.so.6(CXXABI_1.3)(64bit) libstdc++.so.6(GLIBCXX_3.4)(64bit) rtld(GNU_HASH)
Checking for unpackaged file(s): /usr/lib64/rpm/check-files
/usr/lib64/rpm/../../../var/tmp/iperf-root
Wrote: /usr/src/rpm/SRPMS/iperf-2.0.9-XR_6.1.1.src.rpm
Wrote: /usr/src/rpm/RPMS/x86_64/iperf-2.0.9-XR_6.1.1.x86_64.rpm
...
localhost:~$ ls -l /usr/src/rpm/RPMS/x86_64/
total 48
-rw-r--r-- 1 root root 48118 Sep 13 02:03 iperf-2.0.9-XR_6.1.1.x86_64.rpm
b. Access the WRL7 build instance, and copy the RPM file by using the SCP command with the port
number of XR.
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs/native-app-topo-bootstrap (master)
$ vagrant ssh wrl7_build
Last login: Tue Sep 13 01:49:37 2016 from 10.0.2.2
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
73
Hosting Applications on IOS XR
Hosting a Wind River Linux (WRL7) Application Natively By Using Vagrant
xr-vm_node0_RP0_CPU0:~$ ls -l iperf-2.0.9-XR_6.1.1.x86_64.rpm
-rw-r--r-- 1 vagrant vagrant 48118 Sep 13 06:33 iperf-2.0.9-XR_6.1.1.x86_64.rpm
...
Installed:
iperf.x86_64 0:2.0.9-XR_6.1.1
Complete!
xr-vm_node0_RP0_CPU0:~$
RP/0/RP0/CPU0:ios# config
Tue Sep 13 06:46:56.368 UTC
RP/0/RP0/CPU0:ios(config)# tpa address-family ipv4 update-source loopback 0
RP/0/RP0/CPU0:ios(config)# commit
Tue Sep 13 06:47:04.642 UTC
RP/0/RP0/CPU0:ios(config)# end
RP/0/RP0/CPU0:ios# bash -c ip route
Tue Sep 13 06:47:43.792 UTC
default dev fwdintf scope link src 1.1.1.1
10.0.2.0/24 dev Mg0_RP0_CPU0_0 proto kernel scope link src 10.0.2.15
b. Exit the XR router console, and launch the iPerf server on XR.
RP/0/RP0/CPU0:ios# exit
Connection to localhost closed.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
74
Hosting Applications on IOS XR
Hosting a Wind River Linux (WRL7) Application Natively By Using Vagrant
xr-vm_node0_RP0_CPU0:~$ iperf -s -u
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size: 64.0 MByte (default)
------------------------------------------------------------
xr-vm_node0_RP0_CPU0:~$ exit
logout
Connection to 127.0.0.1 closed.
b. Test if the iPerf client on devbox can communicate with the iPerf server on XR.
vagrant@vagrant-ubuntu-trusty-64:~$ iperf -c 1.1.1.1 -u
------------------------------------------------------------
Client connecting to 1.1.1.1, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 11.1.1.20 port 34348 connected with 1.1.1.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 1.25 MBytes 1.05 Mbits/sec
[ 3] Sent 893 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 1.25 MBytes 1.05 Mbits/sec 0.256 ms 0/ 893 (0%)
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
75
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
You have successfully built an application RPM and hosted it natively by using vagrant.
Procedure
To host your application within your own container, use the following steps.
Note Ensure you have created an application development topology as described in Setting up an Application
Development Topology By Using Vagrant, on page 64, before proceeding with the following steps.
1. Navigate to the lxc-app-topo-bootstrap directory and ensure the vagrant instance is running. If not,
launch the vagrant instance.
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs/lxc-app-topo-bootstrap (master)
$ vagrant status
Current machine states:
This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
76
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
==> rtr: Machine 'rtr' has a post `vagrant up` message. This is a message
==> rtr: from the creator of the Vagrantfile, and not from Vagrant itself:
==> rtr:
==> rtr:
==> rtr: Welcome to the IOS XRv (64-bit) Virtualbox.
==> rtr: To connect to the XR Linux shell, use: 'vagrant ssh'.
==> rtr: To ssh to the XR Console, use: 'vagrant port' (vagrant version > 1.8)
==> rtr: to determine the port that maps to guestport 22,
==> rtr: then: 'ssh vagrant@localhost -p <forwarded port>'
...
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
77
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.
* Documentation: https://help.ubuntu.com/
------------------------------------------------------------------------------------------------
Last login: Wed Aug 31 04:02:20 2016 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get update
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://security.ubuntu.com trusty-security InRelease [65.9 kB]
...
Get:33 http://archive.ubuntu.com trusty-backports/universe Translation-en [36.8 kB]
Hit http://archive.ubuntu.com trusty Release
...
Hit http://archive.ubuntu.com trusty/universe Translation-en
Ign http://archive.ubuntu.com trusty/main Translation-en_US
Ign http://archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://archive.ubuntu.com trusty/universe Translation-en_US
Fetched 4,022 kB in 16s (246 kB/s)
Reading package lists... Done
----------------------------------------------------------------------------------------------
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get -y install lxc
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
78
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
4. Create the LXC container with a standard Ubuntu base template and launch it in devbox.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo lxc-create -t ubuntu --name xr-lxc-app
Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ...
Installing packages in template: ssh,vim,language-pack-en
Downloading ubuntu trusty minimal ...
I: Retrieving Release
I: Retrieving Release.gpg
...
Generation complete.
Setting up perl-modules (5.18.2-2ubuntu1.1) ...
Setting up perl (5.18.2-2ubuntu1.1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Processing triggers for initramfs-tools (0.103ubuntu4.4) ...
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
79
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
Download complete
Copy /var/cache/lxc/trusty/rootfs-amd64 to /var/lib/lxc/xr-lxc-app/rootfs ...
Copying rootfs to /var/lib/lxc/xr-lxc-app/rootfs ...
Generating locales...
en_US.UTF-8... up-to-date
Generation complete.
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match ssh
Default-Stop values (none)
invoke-rc.d: policy-rc.d denied execution of start.
##
# The default user is 'ubuntu' with password 'ubuntu'!
# Use the 'sudo' command to run tasks as root in the container.
##
* Documentation: https://help.ubuntu.com/
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
ubuntu@xr-lxc-app:~$
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
80
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
8. Change the SSH port inside the container and verify that it has been correctly assigned.
When you deploy your container to IOS XR, it shares the network namespace with XR. Since IOS XR
already uses Ports 22 and 57722 for other purposes, you must pick some other port number for your
container.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo -s
root@vagrant-ubuntu-trusty-64:~# whoami
root
11. Navigate to the /var/lib/lxc/xr-lxc-app/ directory and package the rootfs into a tar ball.
root@vagrant-ubuntu-trusty-64:~# cd /var/lib/lxc/xr-lxc-app/
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app# ls
config fstab rootfs
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app# cd rootfs
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
81
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
12. Transfer the rootfs tar ball to the home directory (~/ or /home/vagrant) and verify if the transfer is
successful.
13. Create an LXC spec XML file for specifying attributes required to launch the LXC container with the
application.
You must navigate to the /home/vagrant directory on devbox and use a vi editor to create the XML
file. Save the file as xr-lxc-app.xml.
A sample LXC spec file to launch the application within the container is as shown.
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/xr-lxc-app/rootfs# exit
exit
vagrant@vagrant-ubuntu-trusty-64:~$ pwd
/home/vagrant
vagrant@vagrant-ubuntu-trusty-64:~$ vi xr-lxc-app.xml
-------------------------------------------------------------------------------------
<domain type='lxc' xmlns:lxc='http://libvirt.org/schemas/domain/lxc/1.0' >
<name>xr-lxc-app</name>
<memory>327680</memory>
<os>
<type>exe</type>
<init>/sbin/init</init>
</os>
<lxc:namespace>
<sharenet type='netns' value='global-vrf'/>
</lxc:namespace>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/lib64/libvirt/libvirt_lxc</emulator>
<filesystem type='mount'>
<source dir='/misc/app_host/xr-lxc-app/'/>
<target dir='/'/>
</filesystem>
<console type='pty'/>
</devices>
</domain>
In IOS-XR the global-vrf network namespace contains all the XR GigE or management interfaces.
The sharenet configuration in the XML file ensures that the container on being launched has native
access to all XR interfaces.
/misc/app_host/ on IOS XR is a special mount volume that is designed to provide nearly 3.9GB of
disk space. This mount volume can be used to host custom container rootfs and other large files without
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
82
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
occupying disk space on XR. In this example, we expect to untar the rootfs to the
/misc/app_host/xr-lxc-app/ directory.
14. Verify if the rootfs tar ball and the LXC XML spec file are present in the home directory.
root@vagrant-ubuntu-trusty-64:~# pwd
/home/vagrant
root@vagrant-ubuntu-trusty-64:~# ls -l
total 119988
-rw-r--r-- 1 root root 122863332 Jun 16 19:41 xr-lxc-app-rootfs.tar.gz
-rw-r--r-- 1 root root 590 Jun 16 23:29 xr-lxc-app.xml
root@vagrant-ubuntu-trusty-64:~#
15. Transfer the rootfs tar ball and XML spec file to XR.
There are two ways of transferring the files: Through the GigE interface (a little slower) or the
management interface. You can use the method that works best for you.
• Transfer Through the Management Interface of XR:
a. Check the port number that maps to the management port on XR.
Vagrant forwards the port number 57722 to a host port for XR over the management port. In
a virtual box, the IP address of the host (your laptop) is always 10.0.2.2 for the port that was
translated (NAT).
vagrant@vagrant-ubuntu-trusty-64:~$ exit
logout
Connection to 127.0.0.1 closed.
The output shows that port number 2222 maps to port number 57722.
b. Access devbox and use the port number 2222 to transfer the rootfs tar ball and XML spec file
to XR.
annseque@ANNSEQUE-WS02 MINGW64 ~/vagrant-xrdocs/lxc-app-topo-bootstrap (master)
$ vagrant ssh devbox
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-87-generic x86_64)
* Documentation: https://help.ubuntu.com/
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
83
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
84
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
c. Copy the XML spec file to XR by using the GigE interface address.
vagrant@vagrant-ubuntu-trusty-64:~$ scp -P 57722 /home/vagrant/xr-lxc-app.xml
[email protected]:/misc/app_host/scratch/
[email protected]'s password:
xr-lxc-app.xml
16. Create a directory (/misc/app_host/xr-lxc-app/)on XR (rtr) to untar the rootfs tar ball.
vagrant@vagrant-ubuntu-trusty-64:~$ exit
logout
Connection to 127.0.0.1 closed.
17. Navigate to the /misc/app_host/xr-lxc-app/ directory and untar the tar ball.
xr-vm_node0_RP0_CPU0:~$ cd /misc/app_host/xr-lxc-app/
xr-vm_node0_RP0_CPU0:/misc/app_host/xr-lxc-app$ sudo tar -zxf
../scratch/xr-lxc-app-rootfs.tar.gz
tar: dev/audio3: Cannot mknod: Operation not permitted
...
18. Use the XML spec file to launch the container and verify its existence on XR.
xr-vm_node0_RP0_CPU0:/misc/app_host/xr-lxc-app$ virsh create
/misc/app_host/scratch/xr-lxc-app.xml
Domain xr-lxc-app created from /misc/app_host/scratch/xr-lxc-app.xml
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
85
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
19. Log into the container. The default login credentials are ubuntu/ubuntu.
There are two ways of logging into the container. You can use the method that works best for you:
• Logging into the container by using virsh command:
xr-vm_node0_RP0_CPU0:/misc/app_host/xr-lxc-app$ virsh console xr-lxc-app
Connected to domain xr-lxc-app
Escape character is ^]
init: Unable to create device: /dev/kmsg
* Stopping Send an event to indicate plymouth is up [ OK ]
* Starting Mount filesystems on boot [ OK ]
* Starting Signal sysvinit that the rootfs is mounted [ OK ]
* Starting Fix-up sensitive /proc filesystem entries [ OK ]
* Documentation: https://help.ubuntu.com/
ubuntu@xr-lxc-app:~$
* Documentation: https://help.ubuntu.com/
Last login: Fri Sep 2 07:42:37 2016
ubuntu@xr-lxc-app:~$
Note • To exit the container, use the press CTRL and ] keys simultaneously.
• To access the container directly from your host machine, ensure you forward the intended port (in this
example, 58822) to your laptop (any port of your choice), in the Vagrant file:
node.vm.network "forwarded_port", guest: 58822, host: 58822
You can then SSH to the LXC container by using the following command:
ssh -p 58822 vagrant@localhost
20. Verify if the interfaces on XR are available inside the LXC container.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
86
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
The LXC container operates as your own Linux server on XR. Because the network namespace is shared
between the LXC and XR, all of XR interfaces (GigE, management, and so on) are available to bind to
and run your applications.
ubuntu@xr-lxc-app:~$ ifconfig
Gi0_0_0_0 Link encap:Ethernet HWaddr 08:00:27:5a:29:77
inet addr:11.1.1.10 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe5a:2977/64 Scope:Link
UP RUNNING NOARP MULTICAST MTU:1514 Metric:1
RX packets:186070 errors:0 dropped:0 overruns:0 frame:0
TX packets:155519 errors:0 dropped:3 overruns:0 carrier:1
collisions:0 txqueuelen:1000
RX bytes:301968784 (301.9 MB) TX bytes:10762900 (10.7 MB)
21. Configure the container to communicate outside XR with other nodes in the network.
By default, the IOS-XRv vagrant box is set up to talk to the internet using a default route through your
management port. If you want the router to use the routing table to talk to other nodes in the network,
then you must configure tpa-address. This becomes the src-hint for all Linux application traffic.
In this example, we use Loopback 0 for tpa-address to ensure that the IP address for any originating
traffic for applications on the XR is a reachable IP address across your topology.
ubuntu@xr-lxc-app:~$ exit
logout
Connection to 11.1.1.10 closed.
xr-vm_node0_RP0_CPU0:/misc/app_host/xr-lxc-app$ exit
logout
Connection to 127.0.0.1 closed.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
87
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
RP/0/RP0/CPU0:ios# configure
Fri Sep 2 08:03:05.094 UTC
RP/0/RP0/CPU0:ios(config)# interface loopback 0
RP/0/RP0/CPU0:ios(config-if)# ip address 1.1.1.1/32
RP/0/RP0/CPU0:ios(config-if)# exit
RP/0/RP0/CPU0:ios(config)# tpa address-family ipv4 update-source loopback 0
RP/0/RP0/CPU0:ios(config)# commit
Fri Sep 2 08:03:39.602 UTC
RP/0/RP0/CPU0:ios(config)# exit
RP/0/RP0/CPU0:ios# bash
Fri Sep 2 08:03:58.232 UTC
[xr-vm_node0_RP0_CPU0:~]$ ip route
default dev fwdintf scope link src 1.1.1.1
10.0.2.0/24 dev Mg0_RP0_CPU0_0 proto kernel scope link src 10.0.2.15
a. Check if the iPerf server is running within the LXC container on XR.
[xr-vm_node0_RP0_CPU0:~]$ssh -p 58822 [email protected]
Warning: Permanently added '[11.1.1.10]:58822' (ECDSA) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.14.23-WR7.0.0.2_standard x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Fri Sep 2 07:47:28 2016 from 11.1.1.10
ubuntu@xr-lxc-app:~$ iperf -s -u
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size: 64.0 MByte (default)
------------------------------------------------------------
b. Check if XR Loopback interface is accessible on devbox. (Open a new Git bash window for this
step.)
annseque@ANNSEQUE-WS02 MINGW64 ~
$ cd vagrant-xrdocs
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
88
Hosting Applications on IOS XR
Hosting an Application within a Linux Container (LXC) by Using Vagrant
* Documentation: https://help.ubuntu.com/
d. Launch the iPerf client on devbox and verify if it is communicating with the iPerf server within the
LXC on XR.
vagrant@vagrant-ubuntu-trusty-64:~$ iperf -u -c 1.1.1.1
------------------------------------------------------------
Client connecting to 1.1.1.1, UDP port 5001
Sending 1470 byte datagrams
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
89
Hosting Applications on IOS XR
Installing Docker on Cisco IOS XR By Using Vagrant
You have successfully hosted an application within a Linux container by using vagrant.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
90
CHAPTER 5
Hosting Applications Using Configuration
Management Tools
Configuration management tools are used to automate manual tasks, such as setting up servers and network
devices. As application delivery requirements keep changing, reconfiguring network equipment becomes a
challenge. The manual reconfiguration process is prone to errors, which in turn can cause network outages.
Configuration management tools help when configurations need to be updated constantly, and on multiple
network devices.
The Cisco IOS XR Software works well with the following configuration management tools:
• Chef
• Puppet
This section explains how you can install, configure, and use the configuration management tools, Chef and
Puppet for application hosting on IOS XR.
• Using Chef for Configuring Cisco IOS XR, on page 91
• Using Puppet for Configuring Cisco IOS XR, on page 95
You also need three Chef built-in resources to deploy your application natively on IOS XR. The three built-in
Chef Resources are:
• Package Resource
• File Resource
• Service Resource
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
91
Hosting Applications Using Configuration Management Tools
Installing and Configuring the Chef Client
Access the links provided in the following table for additional details on Chef and Chef resources:
Topic Link
Prerequisites
Ensure that the following requirements are met before you proceed with installation:
• Your workstation is set up with the Chef repository and the Chef Development Kit.
• Chef Server Version 12.4, or higher is installed and accessible from your Linux box.
• The Chef Server identification files are available.
• You have the right name server and domain name entries configured in the Linux environment
(/etc/resolv.conf).
• The router is using a valid NTP server.
Configuration Procedure
To install and configure the Chef Client on IOS XR, follow these steps:
1. From your Linux box, access the IOS XR console through SSH, and log in.
cisco@host:~$ ssh [email protected]
[email protected]'s password:
RP/0/RP0/CPU0:ios#
/* If you are using Cisco IOS XR Version 6.0.0, run the following command */
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
92
Hosting Applications Using Configuration Management Tools
Installing and Configuring the Chef Client
/* If you are using Cisco IOS XR Version 6.0.2 or higher, run the following command */
RP/0/RP0/CPU0:ios# bash
[xr-vm_node0_RP0_CPU0:~]$ ifconfig
Gi0_0_0_0 Link encap:Ethernet HWaddr 52:46:04:87:19:3c
inet addr:192.164.168.10 Mask:255.255.255.0
inet6 addr: fe80::5046:4ff:fe87:193c/64 Scope:Link
UP RUNNING NOARP MULTICAST MTU:1514 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:210 (210.0 B)
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
93
Hosting Applications Using Configuration Management Tools
Creating a Chef Cookbook with Recipes
The Chef install.sh script automatically determines the latest version of the Chef Client RPM for
installation.
5. Copy the validation.pem file from the Chef server to /etc/chef/validation.pem
6. Edit the Chef Client configuration file at /etc/chef/client.rb with Chef Server identification and Client
settings.
validation_client_name 'chef-validator'
chef_server_url 'https://my_chef_server.youtube.com/organizations/chef'
node_name 'n3k.youtube.com' # "This" client device.
cookbook_sync_threads 5 # necessary for small memory switches (4G or less)
interval 30 # client-run interval; remove for "never"
Note To run the Client once, use the chef-client --once command. For more information, see the Chef documentation
at https://docs.chef.io/chef_client.html
Prerequisites
Ensure the following requirements are met before you proceed:
• You have access to the application package compatible with the native IOS XR environment.
• Target application package is hosted on an accessible repository or downloaded to a boot flash.
Configuration Procedure
Use the following procedure to create a Chef recipe that starts the bootlogd service, and installs iPerf on IOS
XR:
1. Create a cookbook on your Linux workstation by using the corresponding knife command.
knife cookbook create cisco-network-chef-cookbook
2. Create the Chef recipe file to install iPerf, and add it to the cookbook.
The Chef recipe must be created in the cisco-network-chef-cookbook/recipes/ directory. For it to be
loaded automatically by the Chef Client, the Chef recipe must be named as default.rb.
#
# Recipe:: demo_default_providers
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
94
Hosting Applications Using Configuration Management Tools
Using Puppet for Configuring Cisco IOS XR
package = 'iperf-2.0.5-r0.0.core2_64.rpm'
service = 'bootlogd'
remote_file "/#{package}" do
source "http://10.105.247.73/wrl7_yum_repo/#{package}"
action :create
end
yum_package "#{package}" do
source "/#{package}"
action :install
end
service "#{service}" do
action :start
end
3. Access the Chef Server from your Linux workstation and upload the cookbook to the server.
4. Log into the IOS XR shell, and run the Chef Client to load and execute the cookbook.
[xr-vm_node0_RP0_CPU0:~]$chef-client
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
95
Hosting Applications Using Configuration Management Tools
Installing and Configuring the Puppet Agent
1. The Puppet Agent sends information about IOS XR to the Puppet Server.
2. The Puppet Server compiles the information into a Catalog, and sends to the Puppet Agent.
3. The Puppet Agent applies the catalog to XR.
4. The Puppet Agent sends a configuration complete report to the Puppet Server.
Topic Link
Prerequisites
Ensure that the following requirements are met before you proceed with installation.
• Puppet Server Version 4.0, or higher is installed and accessible from your workstation.
• You have the right name server and domain name entries configured in the Linux environment
(/etc/resolv.conf).
• The router is using a valid NTP server.
Configuration Procedure
To install and configure the Puppet Agent on IOS XR, follow these steps:
1. From your Linux box, access the IOS XR console through SSH, and log in.
cisco@host:~$ ssh [email protected]
[email protected]'s password:
RP/0/RP0/CPU0:ios#
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
96
Hosting Applications Using Configuration Management Tools
Installing and Configuring the Puppet Agent
/* If you are using Cisco IOS XR Version 6.0.0, run the following command */
RP/0/RP0/CPU0:ios# run ip netns exec tpnns bash
/* If you are using Cisco IOS XR Version 6.0.2 or higher, run the following command */
RP/0/RP0/CPU0:ios# bash
[xr-vm_node0_RP0_CPU0:~]$ ifconfig
Gi0_0_0_0 Link encap:Ethernet HWaddr 52:46:04:87:19:3c
inet addr:192.164.168.10 Mask:255.255.255.0
inet6 addr: fe80::5046:4ff:fe87:193c/64 Scope:Link
UP RUNNING NOARP MULTICAST MTU:1514 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:210 (210.0 B)
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
97
Hosting Applications Using Configuration Management Tools
Creating a Puppet Manifest
http_proxy=http://proxy.youtube.com:8080
https_proxy=https://proxy.youtube.com:8080
5. Edit the Puppet Agent configuration file at /etc/puppetlabs/puppet/puppet.conf with Puppet Server
identification and Agent settings.
The Puppet Agent is successfully installed on IOS XR.
Prerequisites
Ensure the following requirements are met before you proceed:
• You have access to the application package compatible with the native IOS XR environment.
• Target application package is hosted on an accessible repository, or downloaded to a boot flash.
Configuration Procedure
To create a sample Puppet manifest to start the bootlogd service, and install iPerf on IOS XR, follow these
steps:
1. Create a Puppet manifest on Puppet Server to install your application.
The manifest must be created in the /etc/puppetlabs/code/environments/production/manifests/
directory. For it to be launched automatically by Puppet Server, the manifest file must be named, site.pp.
# Manifest to demo builtin providers
#
class ciscopuppet::demo_builtin_providers {
$package = 'iperf'
$service = 'bootlogd'
yumrepo { 'wrl7-repo':
ensure => present,
name => 'wrl7-repo',
baseurl => 'http://10.105.247.73/wrl7_yum_repo/',
gpgcheck => 0,
enabled => 1,
proxy => '_none_',
}
package { $package:
ensure => present,
require => Yumrepo['wrl7-repo'],
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
98
Hosting Applications Using Configuration Management Tools
Creating a Puppet Manifest
service { $service:
ensure => running,
}
node 'default' {
include ciscopuppet::demo_builtin_providers
}
2. Access and trigger the Puppet Agent to converge the system based on the manifest defined on the Puppet
Server.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
99
Hosting Applications Using Configuration Management Tools
Creating a Puppet Manifest
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
100
CHAPTER 6
Use Cases: Application Hosting
This chapter describes use cases for running applications on IOS XR.
• Running a Telemetry Receiver in a Linux Container (LXC) , on page 101
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
101
Use Cases: Application Hosting
Running a Telemetry Receiver in a Linux Container (LXC)
"FirstGroup": {
"Period": 30,
"Paths": [
"RootOper.InfraStatistics.Interface(*).Latest.GenericCounters"
]
}
}
}
3. Enter the XR Linux bash shell, and copy the policy file to IOS XR by using Secure Copy Protocol (SCP).
/* If you are using Cisco IOS XR Version 6.0.0, run the following command */
RP/0/RP0/CPU0:ios# run ip netns exec tpnns bash
/* If you are using Cisco IOS XR Version 6.0.2, run the following command */
RP/0/RP0/CPU0:ios# bash
Where 10.0.0.1 is the IP address of the device on which you are copying the policy file.
4. Navigate to the IOS XR prompt and verify if the policy file has been successfully installed.
RP/0/RP0/CPU0:ios# show telemetry policies brief
Wed Aug 26 02:24:40.556 PDT
Name |Active?| Version | Description
----------------------------|-------|---------|------------------------------
Test N 1 This is a sample policy
The .proto file is generated by an on-box tool. The tool ignores naming parameters, and are hence optional.
Note The tool ignores text within quotes; therefore, the path should not contain quotes.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
102
Use Cases: Application Hosting
Running a Telemetry Receiver in a Linux Container (LXC)
b. Access the copy of the .proto file from Dev Hub, and run the standard compiler on your Linux box,
as shown here:
protoc python_out . -I=/
sw/packages/protoc/current/google/include/:.
generic_counters.proto ipv4_counters.proto
2. Configure the encoder to stream the policy to the loopback interface of IOS XR that was just configured.
telemetry
encoder gpb
policy group alpha
policy demo
destination ipv4 2.2.2.2 port 5555
!
!
!
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
103
Use Cases: Application Hosting
Running a Telemetry Receiver in a Linux Container (LXC)
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
104
Use Cases: Application Hosting
Use Cases on Vagrant: Container Application Hosting
output_underruns:0
packets_received:0
packets_sent:0
parity_packets_received:0
resets:0
runt_packets_received:0
seconds_since_last_clear_counters:0
seconds_since_packet_received:4294967295
seconds_since_packet_sent:4294967295
throttled_packets_received:0
unknown_protocol_packets_received:0
Waiting for message
Got message of length:510bytes from address:('2.2.2.2', 5555)
Encoding:2271560481
Policy Name:demo
Version:25
Identifier:<data that may be sent by the encoder to the mgmt stn>
Start Time:Wed Jan 21 09:54:33 1970
End Time:Wed Aug 26 09:28:38 2015
# Tables:1
Schema Path:RootOper.InfraStatistics.Interface.Latest.Protocol
# Rows:5
Row 0:
bytes_received:0
bytes_sent:0
input_data_rate:0
input_packet_rate:0
interface_name:Loopback2
last_data_time:1440606517
output_data_rate:0
output_packet_rate:0
packets_received:0
packets_sent:0
protocol:24
protocol_name:IPV4_UNICAST
The telemetry receiver runs successfully within the third-party container (LXC).
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
105
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
Topology
The topology used for OSPF path remediation is illustrated in the following figure.
The router on the left is rtr1 and is the source of traffic. We run the pathchecker application inside an LXC
on this router. Pathchecker uses an iPerf client to determine the health of the path.
The router on the right is rtr2 and is the destination for traffic. We run the pathchecker application inside an
LXC on this router. Pathchecker uses an iPerf server that talks to the iPerf client on rtr1.
devbox serves two purposes in this topology:
• To create an LXC tar ball with pathchecker before being deployed to the routers.
• To bridge the two networks between the two routers over the parallel paths.
Figure 13: OSPF Path Failover with iPerf and Netconf on Vagrant
This example uses the following process for OSPF path failover:
1. Configure and establish OSPF neighbor relationship between two routers over two parallel paths.
2. Increase the cost of one path so that the other path is the preferred active path.
3. Use the pathchecker python application to monitor the OSPF active path by determining the bandwidth,
jitter, packet loss and other parameters. Pathchecker uses the iPerf application to measure health of the
active traffic path.
4. Use pathchecker to simulate network degradation by changing the OSPF active path cost during a Netconf
session.
Procedure
Use the following steps to use iPerf with Netconf for OSPF path failover.
1. Generate an API key and a CCO ID by using the steps described on Github.
2. Download the latest stable version of the IOS-XRv vagrant box.
$ curl <cco-id>:<API-KEY>
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
106
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
107
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
* Documentation: https://help.ubuntu.com/
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
...
9. Install all the required iPerf and Netconf application dependencies within the LXC.
ubuntu@pathchecker:~$ sudo apt-get -y install python-pip python-lxml
python-dev libffi-dev libssl-dev iperf git
10. Retrieve the iPerf and Netconf application code from Github.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
108
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
vagrant@vagrant-ubuntu-trusty-64:~$ sudo -s
root@vagrant-ubuntu-trusty-64:~# whoami
root
c. Navigate to the /var/lib/lxc/pathchecker/rootfs/ directory and package the rootfs into a tar
ball.
root@vagrant-ubuntu-trusty-64:~# cd /var/lib/lxc/pathchecker/rootfs/
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/pathchecker/rootfs/# tar -czvf
/vagrant/pathchecker_rootfs.tar.gz *
tar: dev/log: socket ignored
root@vagrant-ubuntu-trusty-64:/var/lib/lxc/pathchecker/rootfs/# exit
vagrant@vagrant-ubuntu-trusty-64:~$ exit
logout
Connection to 127.0.0.1 closed.
This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.
14. Verify if OSPF is running on rtr1 and check the path state.
You can also see the cost of the OSPF path.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
109
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
15. Start the iPerf server on rtr2 and configure it for receiving packets from rtr1.
Note iPerf was launched as a native application on rtr2 while launching the vagrant instance.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
110
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
* Documentation: https://help.ubuntu.com/
Last login: Mon Jul 18 15:19:45 2016 from 10.0.2.2
ubuntu@pathchecker:~$
b. Navigate to the pathchecker repository within the LXC, and check the contents of the pathchecker
script.
ubuntu@pathchecker:~$ cd pathchecker/
ubuntu@pathchecker:~/pathchecker$ cat pc_run.sh
#!/bin/bash
-I represents the threshold for packet loss and has been set to 5% for this run. -j represents the
jitter threshold that has a value of 4.
c. Start the pathchecker application by running the script.
ubuntu@pathchecker:~/pathchecker$ ./pc_run.sh
Error while opening state file, let's assume low cost state
Currently, on reference link GigabitEthernet0/0/0/0
Starting an iperf run.....
20160718162513,1.1.1.1,62786,2.2.2.2,5001,6,0.0-10.0,1311240,1048992
20160718162513,1.1.1.1,62786,2.2.2.2,5001,6,0.0-10.0,1312710,1048474
20160718162513,2.2.2.2,5001,1.1.1.1,62786,6,0.0-10.0,1312710,1048679,2.453,0,892,0.000,1
bw is
1025.5546875
jitter is
2.453
pkt_loss is
0.000
verdict is
False
Currently, on reference link GigabitEthernet0/0/0/0
Starting an iperf run.....
17. Open a parallel Git bash window and simulate impairment on the active path.
a. Access devbox through SSH.
...
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
111
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
vagrant@vagrant-ubuntu-trusty-64:~$ ls
impair_backup.sh impair_reference.sh stop_impair.sh
vagrant@vagrant-ubuntu-trusty-64:~$ ./impair_reference.sh
Stopping all current impairments
Starting packet loss on reference link
18. Open the first Git bash window to view the pathchecker application running on rtr1.
Currently, on reference link GigabitEthernet0/0/0/0
Starting an iperf run.....
20160718164745,1.1.1.1,60318,2.2.2.2,5001,6,0.0-10.0,1311240,1048992
20160718164745,1.1.1.1,60318,2.2.2.2,5001,6,0.0-10.0,1312710,1048516
20160718164745,2.2.2.2,5001,1.1.1.1,60318,6,0.0-573.0,1312710,18328,5.215,0,892,0.000,1
bw is
1025.5546875
jitter is
5.215
pkt_loss is
0.000
verdict is
True
Woah! iperf run reported discrepancy, increase cost of reference link !
Increasing cost of the reference link GigabitEthernet0/0/0/0
Currently, on backup link
Starting an iperf run.....
20160718164755,1.1.1.1,61649,2.2.2.2,5001,6,0.0-10.0,1311240,1048992
20160718164755,1.1.1.1,61649,2.2.2.2,5001,6,0.0-10.0,1312710,1048577
20160718164755,2.2.2.2,5001,1.1.1.1,61649,6,0.0-583.3,1312710,18002,1.627,0,893,0.000,0
bw is
1025.5546875
jitter is
1.627
pkt_loss is
0.000
verdict is
False
Currently, on backup link
Starting an iperf run.....
20160718164805,1.1.1.1,59343,2.2.2.2,5001,6,0.0-10.0,1311240,1048992
20160718164805,1.1.1.1,59343,2.2.2.2,5001,6,0.0-10.0,1312710,1048520
20160718164805,2.2.2.2,5001,1.1.1.1,59343,6,0.0-593.4,1312710,17697,2.038,0,893,0.000,0
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
112
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
The path cost from the GigabitEthernet0/0/0/0 interface is greater than that from the
GigabitEthernet0/0/0/1 interface. Hence, failover takes place to the GigabitEthernet0/0/0/1 interface for
traffic from rt1 to rtr2.
20. Verify the OSPF path failover on rtr1.
The Loopback 0 interface IP address of rtr1 in this example is 2.2.2.2
The next hop for rtr1 is 11.1.1.20 through the backup reference link: GigabitEthernet0/0/0/1
You have successfully configured OSPF path failover by using iPerf and Netconf on vagrant.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
113
Use Cases: Application Hosting
OSPF Path Failover by Running iPerf with Netconf on Vagrant
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
114
CHAPTER 7
Cisco Secure DDoS Edge Protection
Table 14: Feature History Table
Cisco Secure DDoS Edge Release 24.3.1 You can now block malicious traffic at
Protection peering edge routers, stopping distributed
denial-of-service (DDoS) attacks at the
network entry point and ensuring
constant service availability and
reliability in your network.
A centralized controller manages DDoS
mitigation capabilities using information
from a collection of detectors deployed
on the routers. These detectors analyze
IPv4 and IPv6 traffic in real-time to
identify DDoS attacks. Upon detection,
the controller enforces deny ACLs to
block malicious traffic while allowing
legitimate traffic.
This local inspection enhances visibility,
speeds up response times, and optimizes
the network without the need for
additional hardware or attack traffic
redirection.
The Cisco Secure DDoS Edge Protection software actively halts DDoS attacks at the network entry point,
enabling immediate response to threats. Positioned at the network edge, it identifies and counteracts DDoS
threats directly on the router. This strategy minimizes network and application impact without affecting core
bandwidth by avoiding backhaul of malicious traffic.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
115
Cisco Secure DDoS Edge Protection
• A collection of detectors that are deployed on edge or peering routers. The detector is a resource-efficient
application container for real-time DDoS detection deployed on routers and managed by the centralized
controller. It analyzes IPv4 and IPv6 traffic on each ingress interface to identify DDoS attacks as they
occur.
Upon detecting a DDoS attack, the centralized controller promptly begins mitigation. The mitigation includes
enforcing a deny ACL to block the attack traffic while still allowing legitimate traffic to pass through.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
116
Cisco Secure DDoS Edge Protection
Restrictions of Cisco Secure DDoS Edge Protection
• A99-32X100GE-X-SE
• A99-10X400GE-X-TR, and
• A99-10X400GE-X-SE.
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
117
Cisco Secure DDoS Edge Protection
Install and Configure DDoS Edge Protection
Procedure
Step 1 Download and install the DDoS Edge Protection Controller Software package from the Software Download page.
You can access the user interface when the controller installation is complete. Log in to the controller services instance
to monitor, manage, and control the device.
For more information on implementing access lists and prefix lists, see Understanding Access-List.
If there is any DDoS attack, the controller performs the mitigation action using the ACL rule automatically.
Here is a sample configuration to deny DDoS attacker traffic using a user-defined ACL rule:
1 deny udp any eq 19 host 45.0.0.1 eq 0 packet-length eq 128 ttl eq 64
2 deny tcp any host 45.0.0.1 eq www match-all -established -fin -psh +syn -urg packet-length eq 60
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
118
Cisco Secure DDoS Edge Protection
Install and Configure DDoS Edge Protection
ttl eq 64
1301 permit ipv4 any any
Step 5 Execute the ping command on the router and check the router connection to the DDoS controller.
Example:
Router#ping 10.105.237.54
Thu Jun 1 07:16:43.654 UTC
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.105.237.54 timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/4 ms
RP/0/RP0/CPU0:Router#bash
Thu Jun 1 07:16:53.024 UTC
[Router:~]$ping 10.105.237.54
PING 10.105.237.54 (10.105.237.54) 56(84) bytes of data.
64 bytes from 10.105.237.54: icmp_seq=1 ttl=63 time=1.73 ms
64 bytes from 10.105.237.54: icmp_seq=2 ttl=63 time=1.29 ms
64 bytes from 10.105.237.54: icmp_seq=3 ttl=63 time=1.27 ms
64 bytes from 10.105.237.54: icmp_seq=4 ttl=63 time=1.75 ms
^C
--- 10.105.237.54 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.270/1.510/1.751/0.230 ms
[Router:~]$
Step 6 Enter the details of the device into the DDoS edge protection controller panel and verify that the Deployment, Container,
and Configuration indicators all display green.
The controller automatically performs the following netflow configuration on the router:
//Configuring Monitor Map
Router(config)#flow monitor-map DetectPro_Monitor_IPV6
Router(config-fmm)# record ipv6 extended
Router(config-fmm)#exporter DetectPro_GPB
Router(config-fmm)# cache entries 1000000
Router(config-fmm)#cache entries active 1
Router(config-fmm)#cache entries inactive 1
Router(config-fmm)#cache timeout inactive 1
Router(config-fmm)#cache timeout rate-limit 1000000
Router(config-fmm)#exit
Router(config)#flow monitor-map DetectPro_Monitor_IPV4
Router(config-fmm)# record ipv4 extended
Router(config-fmm)#exporter DetectPro_GPB
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
119
Cisco Secure DDoS Edge Protection
Verify DDoS Edge Protection Application Configuration
For more information on installing the DDoS controller, see the Cisco Secure DDoS Edge Protection Installation
guide.
For more information on the DDoS Edge Protection, see Cisco Secure DDoS Edge Protection Data Sheet.
Procedure
Step 1 Execute the show running-config appmgr command on the router to verify the appmgr configuration.
Example:
Router#show running-config appmgr
Thu Jun 1 07:33:36.741 UTC
appmgr
application esentryd
activate type docker source esentryd-cisco-20230431633 docker-run-opts "--env-file
/harddisk:/ENV_6478443711ac6830700d1aeb --net=host"
!
!
Step 2 Execute the show flow monitor command on the router to check the monitor map that is automatically created.
Example:
Router#show flow monitor DetectPro_Monitor_IPV4 cache location 0/0/CPU0
Thu Nov 16 06:13:38.066 UTC
Cache summary for Flow Monitor DetectPro_Monitor_IPV4:
Cache size: 1000000
Current entries: 0
Flows added: 2243884200
Flows not added: 0
Ager Polls: 2243884200
- Active timeout 0
- Inactive timeout 0
- Immediate 0
- TCP FIN flag 0
- Emergency aged 0
- Counter wrap aged 0
- Total 2243884200
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
120
Cisco Secure DDoS Edge Protection
Verify DDoS Edge Protection Application Configuration
Periodic export:
- Counter wrap 0
- TCP FIN flag 0
Flows exported 2243884200
Matching entries: 0
Example:
Router#show flow monitor DetectPro_Monitor_IPV6 cache location 0/0/CPU0
Thu Nov 16 06:13:43.734 UTC
Cache summary for Flow Monitor DetectPro_Monitor_IPV6:
Cache size: 1000000
Current entries: 0
Flows added: 59971
Flows not added: 0
Ager Polls: 94437
- Active timeout 59971
- Inactive timeout 0
- Immediate 0
- TCP FIN flag 0
- Emergency aged 0
- Counter wrap aged 0
- Total 59971
Periodic export:
- Counter wrap 0
- TCP FIN flag 0
Flows exported 59971
Matching entries: 0
Step 3 Execute the show flow exporter command on the router to check the exporter map that is automatically created.
Example:
Status: Disabled
Transport: UDP
Destination: 15.1.1.2 (5005) VRF default
Source: 0.0.0.0 (54482)
Flows exported: 0 (0 bytes)
Flows dropped: 0 (0 bytes)
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
121
Cisco Secure DDoS Edge Protection
Verify DDoS Edge Protection Application Configuration
Step 4 Execute the show appmgr application-table command on the router to check the status of docker application.
Example:
Router#show appmgr application-table
Thu Nov 16 06:13:58.059 UTC
Name Type Config State Status
-------- ------ ------------ --------------------------------------------------
esentryd Docker Activated Up 8 minutes
Router#
Application Hosting Configuration Guide for Cisco ASR 9000 Series Routers, Cisco IOS XR Releases
122