Configuration Guide for Cisco NCS 1004, IOS XR Release 25.x.x
Bias-Free Language
The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This section illustrates how, with the Packet I/O functionality, you can use Linux applications to manage communication with
the IOS XR interfaces. It describes how the OS environment must be set up to establish packet I/O communication with hosted
applications.
Verify Reachability of IOS XR and Packet I/O Infrastructure
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.
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.
Procedure
Step 1
From your Linux box, access the IOS XR console through SSH, and log in.
This command shows the ip-address and status of of NCS 1004 interfaces.
RP/0/RP0/CPU0:ios#show ip interface brief
This outsput displays the ip-address and the status of the active NCS 1004 interfaces.
Tue Oct 28 17:53:00.194 IST
Interface IP-Address Status Protocol Vrf-Name
Loopback2 2.2.2.2 Up Up default
MgmtEth0/RP0/CPU0/0 10.127.60.173 Up Up default
MgmtEth0/RP0/CPU0/1 4.25.0.68 Down Down default
MgmtEth0/RP0/CPU0/2 unassigned Shutdown Down default
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.
Example:
This command checks the details of the MgmtEth0/RP0/CPU0/0 as it is in UP state.
The to_xr interface indicates access to the global VRF.
Step 5
Access the Linux shell.
Example:
RP/0/RP0/CPU0:ios#bash
[ios:~]$
Step 6
(Optional) View the IP routes used by the to_xr interfaces.
Example:
[ios:~]$ip route
default dev to_xr proto static scope link src 10.127.60.173 metric 2048 mtu 1500 advmss 1460
10.127.59.46 via 10.127.60.1 dev Mg0_RP0_CPU0_0 proto static metric 2048
10.127.60.0/24 dev Mg0_RP0_CPU0_0 proto static scope link src 10.127.60.173
[ios:~]$
Programme Routes in the Kernel
The basic routes required to allow applications to send or receive traffic can be programmed into the kernel. The Linux network
stack that is part of the kernel is used by normal Linux applications to send/receive packets. In an IOS XR stack, IOS XR
acts as the network stack for the system. Therefore to allow the Linux network stack to connect into and use the IOS XR network
stack, basic routes must be programmed into the Linux Kernel.
Procedure
Step 1
View the routes from the bash shell.
Enter the bash shell.
Example:
RP/0/RP0/CPU0:NE_173#bash
Tue Oct 28 18:17:47.331 IST
In the bash shell, view the IP routes used by the to_xr interfaces
Example:
[ios:~]$ip route
default dev to_xr proto static scope link src 10.127.60.173 metric 2048 mtu 1500 advmss 1460
10.127.59.46 via 10.127.60.1 dev Mg0_RP0_CPU0_0 proto static metric 2048
10.127.60.0/24 dev Mg0_RP0_CPU0_0 proto static scope link src 10.127.60.173
Step 2
Programme the routes in the kernel.
Two types of routes can be programmed in the kernel:
Default Route: The default route sends traffic destined to unknown subnets out of the kernel using a special to_xr interface. This interface sends packets to IOS XR for routing using the routing state in XR Routing Information Base (RIB)
or Forwarding Information Base (FIB). The to_xr interface does not have an associated IP address. In Linux, most applications expect the outgoing packets to use the IP address
of the outgoing interface as the source IP address.
With the to_xr interface, because there is no IP address, a source hint is required. The source hint can be changed to use the IP address
another physical interface IP or loopback IP address. In this example, the source hint is set to 10.127.60.173, which is the
IP address of the management interface. To use the Management port IP address, change the source hint:
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.127.60.173 network is associated
with the Mg0_RP0_CPU0 interface.
Manage IOS XR Interfaces through Linux
The Linux system contains a number of individual network namespaces. Each namespace contains a set of interfaces that map
to a single interface in the XR control plane. These interfaces represent the exposed XR interfaces (eXI). By default, all
interfaces in IOS XR are managed through the IOS XR configuration (CLI or YANG models), and the attributes of the interface
(IP address, MTU, and state) are inherited from the corresponding configuration and the state of the interface in XR.
With the new Packet I/O functionality, it is possible to have an IOS XR interface completely managed by Linux. This also means
that one or more of the interfaces can be configured to be managed by Linux, and standard automation tools can be used on
Linux servers can be used to manage interfaces in IOS XR.
Configure an Interface to be Linux-Managed
This section shows how to configure an interface to be Linux-managed.
Before you begin
Enter the configuration mode using the config command.
Procedure
Step 1
Check the available exposed-interfaces in the system.
Example:
RRP/0/RP0/CPU0:ios(config)#linux networking exposed-interfaces interface ?
GCC0 OTN GCC0 interface(s) | short name is G0
GCC1 OTN GCC1 interface(s) | short name is G1
GCC2 OTN GCC2 interface(s) | short name is G2
Loopback Loopback interface(s) | short name is Lo
MgmtEth Ethernet/IEEE 802.3 interface(s) | short name is Mg
Step 2
Configure the interface to be managed by Linux.
Example:
This command configures a MgmtEth interface to be managed by Linux.
This section shows how to bring up the interface and configure a custom MTU in a Linux-managed interface.
Procedure
Step 1
Configure the MTU setting.
Example:
[ios:~]$ifconfig Mg0_RP0_CPU0_0 up
[ios:~]$Router:Aug 1 17:41:54.824 UTC: ifmgr[266]: %PKT_INFRA-LINK-3-UPDOWN : Interface
HundredGigE0/0/0/24, changed state to Down
Router:Aug 1 17:41:54.824 UTC: ifmgr[266]: %PKT_INFRA-LINEPROTO-5-UPDOWN : Line protocol on
Interface HundredGigE0/0/0/24, changed state to Down
Router:Aug 1 17:41:56.448 UTC: xlncd[253]: %MGBL-CONFIG-6-DB_COMMIT : Configuration committed by
user 'system'. Use 'show configuration commit changes 1000000022' to view the changes.
Router:Aug 1 17:41:56.471 UTC: ifmgr[266]: %PKT_INFRA-LINK-3-UPDOWN : Interface
HundredGigE0/0/0/24, changed state to Up
Router:Aug 1 17:41:56.484 UTC: ifmgr[266]: %PKT_INFRA-LINEPROTO-5-UPDOWN : Line protocol on
Interface HundredGigE0/0/0/24, changed state to Up
Router:Aug 1 17:41:58.493 UTC: xlncd[253]: %MGBL-CONFIG-6-DB_COMMIT : Configuration committed by
user 'system'. Use 'show configuration commit changes 1000000023' to view the changes.
[ios:~]$
[ios:~]$ip link set dev Mg0_RP0_CPU0_0 mtu 1400
[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:
This example highlights the MTU setting for all interfaces in Linux.
(Optional) Use the show ip interface brief | include MgmtEth0/RP0/CPU0/0 to see the MgmtEth0/RP0/CPU0/0 interface only.
Example:
RP/0/RP0/CPU0:ios#show ip interface brief | include MgmtEth0/RP0/CPU0/0MgmtEth0/RP0/CPU0/0 10.127.60.229 Up Up default
RP/0/RP0/CPU0:ios#
The output indicates that the interface acts as a regular Linux interface, and IOS XR configuration receives inputs from Linux.
Synchronize Statistics Between IOS XR and Linux
This example shows how the bundle-ether interface packet statistics are synchronized between IOS XR and Linux. The packet
and byte counters maintained by Linux for IOS XR interfaces display only the traffic sourced in Linux. You can configure to
periodically synchronize these counters with the IOS XR statistics for the interfaces.
Before you begin
Enter the configuration mode using the configuration command.
Procedure
Step 1
Configure the statistics synchronization including the direction and synchronization interval.
Example:
The example shows statistics synchronization in global configuration:
RP/0/RP0/CPU0:ios(config)#linux networking statistics-synchronization from-xr
every 30s
Example:
The example shows statistics synchronization in exposed-interface configuration:
RP/0/RP0/CPU0:ios(config)#linux networking exposed-interfaces interface mgmtEth 0/RP0/CPU0/2 statistics-synchronization from-xr every 10s
where —
from-xr: The direction indicating that the interface packet statistics will be pushed from IOS XR to the Linux kernel.
every: Shows the frequency at which to synchronize statistics. The intervals supported for global configuration are 30s and 60s.
The intervals supported for exposed interfaces are 5s, 10s, 30s or 60s. The interval s is in seconds.
Step 2
Verify that the statistics synchronization is applied successfully on IOS XR.
Example:
This example highlights the statistics synchronization that is applied on IOS XR interface.
RP/0/RP0/CPU0:ios(config)#show running-config linux networking
linux networking
vrf default
address-family ipv4
protection
protocol tcp local-port all default-action deny
permit interface bundle-ether 1
!
!
!
!
exposed-interfaces
interface bundle-ether 1 linux-managed
statistics-synchronization from-xr every 10s
!
!
!
For troubleshooting purposes, use the show tech-support linux networking command to display debugging information.
Synchronize Routes Between IOS XR and Linux
The NCS 1004 allows you to synchronoze routes between the IOS XR and linux interfaces. You can achieve route synchronization
in three methods.
Sending traffic from Linux via a connected network.
Sending traffic from Linux via a network requiring a route, where the route is present in XR.
Sending traffic from Linux via a network requiring a route (no route present).
For each of the three scenarios, we will use the following back-to-back topology for illustration. All interfaces are assumed
to be configured with their IP addresses and up.
Figure 1. NCS 1004 back-to-back topology
All the three methods consider the R1 node has the same configuration.
In this method, we are sending traffic to 12.0.0.2 or 100.0.0.2 from Linux on R1. No extra configuration is required in Linux.
XLNC syncs all of the relevant IP addresses and the kernel populates the routes.
Procedure
Step 1
View the IP routes used by the to_xr interfaces.
Example:
RP/0/RP0/CPU0:ios#bash
[ios:~]$ ip route
default via 10.127.60.1 dev Mg0_RP0_CPU0_0
10.127.59.46 via 10.127.60.1 dev Mg0_RP0_CPU0_0
10.127.60.0/24 dev Mg0_RP0_CPU0_0 scope link src 10.127.60.173
Step 2
Verify connectivity with R2 node.
Example:
This output shows the details of network connectivity to R2 node IP 12.0.0.2.
[ios:~]$ping 10.127.60.173
PING 10.127.60.173 (10.127.60.173) 56(84) bytes of data.
64 bytes from 10.127.60.173: icmp_seq=1 ttl=64 time=0.046 ms
64 bytes from 10.127.60.173: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 10.127.60.173: icmp_seq=3 ttl=64 time=0.030 ms
64 bytes from 10.127.60.173: icmp_seq=4 ttl=64 time=0.030 ms
64 bytes from 10.127.60.173: icmp_seq=5 ttl=64 time=0.030 ms
64 bytes from 10.127.60.173: icmp_seq=6 ttl=64 time=0.031 ms
64 bytes from 10.127.60.173: icmp_seq=7 ttl=64 time=0.038 ms
^C
--- 10.127.60.173 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 5999ms
rtt min/avg/max/mdev = 0.030/0.034/0.046/0.009 ms
Send traffic from Linux via a network using an XR route
This example shows how to the use the to_xr Linux interface. This interface uses Rx-inject to inject a packet as though it
had just been received by the router. This leads to the packet being routed as per routes installed in the RIB.
The key piece of information required here is the source address which should be chosen. Linux has no way of determining this
without a route, but in typical deployments the XR features that rely on Linux Networking (Model Driven Telemetry, and IOS-XR
Install) need connectivity. To allow these to work, XR uses the IP of the lowest-numbered Loopback (e.g. Loopback0) interface
and sets it as the source hint for the default route.
If connectivity is instead needed to a destination that cannot route to the lowest-numbered loopback, the user must manually
add a new route to Linux. (In future releases it will be possible to configure XR routes to be added to Linux automatically,
but manual intervention is needed in the first release.)
Procedure
Step 1
Check the route details for the NCS 1004 node R1.
Example:
RP/0/RP0/CPU0:NE_173#show route
Fri Oct 31 15:20:43.596 IST
Codes: C - connected, S - static, R - RIP, B - BGP, (>) - Diversion path
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - ISIS, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, su - IS-IS summary null, * - candidate default
U - per-user static route, o - ODR, L - local, G - DAGR, l - LISP
A - access/subscriber, a - Application route
M - mobile route, r - RPL, t - Traffic Engineering, (!) - FRR Backup path
Gateway of last resort is 10.127.60.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 10.127.60.1, 01:18:21
L 2.2.2.2/32 is directly connected, 01:18:22, Loopback2
S 10.127.59.46/32 [1/0] via 10.127.60.1, 01:18:21
C 10.127.60.0/24 is directly connected, 01:18:21, MgmtEth0/RP0/CPU0/0
L 10.127.60.173/32 is directly connected, 01:18:21, MgmtEth0/RP0/CPU0/0
Step 2
View the IP routes used by the to_xr interfaces.
Example:
RP/0/RP0/CPU0:ios#bash
Fri Oct 31 15:22:32.218 IST
[:~]$ ip route
default via 10.127.60.1 dev Mg0_RP0_CPU0_0
10.127.59.46 via 10.127.60.1 dev Mg0_RP0_CPU0_0
10.127.60.0/24 dev Mg0_RP0_CPU0_0 scope link src 10.127.60.173
[:~]$exit
RP/0/RP0/CPU0:ios#show running-config linux networking
Tue Oct 28 16:39:44.951 IST
linux networking
vrf default
east-west Loopback2
address-family ipv4
source-hint default-route interface MgmtEth0/RP0/CPU0/0
!
!
!
Step 5
Add a route with source IP address in Linux
Example:
RP/0/RP0/CPU0:ios#bash
Fri Oct 31 15:22:32.218 IST
[:~]$#ip route add 10.127.60.0/24 dev to_xr scope link src 10.127.60.173
Step 6
Verify connectivity with R2 node.
Example:
[:~]$# ping 10.127.60.1
PING 10.127.60.1 (10.127.60.1) 56(84) bytes of data.
64 bytes from 10.127.60.1: icmp_seq=1 ttl=254 time=0.876 ms
64 bytes from 10.127.60.1: icmp_seq=2 ttl=254 time=0.768 ms
64 bytes from 10.127.60.1: icmp_seq=3 ttl=254 time=0.697 ms
64 bytes from 10.127.60.1: icmp_seq=4 ttl=254 time=0.824 ms
^C
--- 10.127.60.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.697/0.791/0.876/0.069 ms
[:~]$
Send traffic from Linux via a network without an XR route
This method uses only the Linux networking stack to accomplish the same as scenario 2. Here the required configuration is
to set the route in Linux. You can omit the source IP, as this will be resolved via Linux.
Procedure
Step 1
Check the route details for the NCS 1004 node R1.
Example:
RP/0/RP0/CPU0:ios#show route
Fri Oct 31 15:58:52.236 IST
Codes: C - connected, S - static, R - RIP, B - BGP, (>) - Diversion path
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - ISIS, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, su - IS-IS summary null, * - candidate default
U - per-user static route, o - ODR, L - local, G - DAGR, l - LISP
A - access/subscriber, a - Application route
M - mobile route, r - RPL, t - Traffic Engineering, (!) - FRR Backup path
Gateway of last resort is 10.127.60.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 10.127.60.1, 01:56:30
L 2.2.2.2/32 is directly connected, 01:56:31, Loopback2
S 10.127.59.46/32 [1/0] via 10.127.60.1, 01:56:30
C 10.127.60.0/24 is directly connected, 01:56:30, MgmtEth0/RP0/CPU0/0
L 10.127.60.173/32 is directly connected, 01:56:30, MgmtEth0/RP0/CPU0/0
Step 2
View the IP routes used by the to_xr interfaces.
Example:
RP/0/RP0/CPU0:ios#bash
Fri Oct 31 15:59:14.656 IST
[ios:~]$ ip route
default via 10.127.60.1 dev Mg0_RP0_CPU0_0
10.127.59.46 via 10.127.60.1 dev Mg0_RP0_CPU0_0
10.127.60.0/24 dev Mg0_RP0_CPU0_0 scope link src 10.127.60.173
[NE_173:~]$
Step 3
Set the route in Linux.
Example:
This command sets the route in the linux interface.
[ios:~]$ ip route add 10.127.60.0/24 dev to_xr scope link src 10.127.60.173
Step 4
Verify connectivity with R2 node.
Example:
[:~]$# ping 10.127.60.1
PING 10.127.60.1 (10.127.60.1) 56(84) bytes of data.
64 bytes from 10.127.60.1: icmp_seq=1 ttl=254 time=0.876 ms
64 bytes from 10.127.60.1: icmp_seq=2 ttl=254 time=0.768 ms
64 bytes from 10.127.60.1: icmp_seq=3 ttl=254 time=0.697 ms
64 bytes from 10.127.60.1: icmp_seq=4 ttl=254 time=0.824 ms
^C
--- 10.127.60.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.697/0.791/0.876/0.069 ms
[:~]$